03 Apr 2023 03:40 PM - last edited on 22 May 2023 12:48 PM by Michal_Gebacki
Hi all,
I'm ingesting metrics via api (Metrics API v2).
So, I collect a state (string="OK") and in the script I change for a (integer = 1). The unit type im using is State.
Now in Dynatrace I would like to transform again the metric to string. I have multiple applications with various states so its hard to follow/memorize all the tansformations String<-->Integer.
The challenge that Im facing now is to show the state in a human readable way. I have to create alerts and generate a reasonable dashboard.
Thanks all,
RD
Solved! Go to Solution.
04 Apr 2023 12:49 AM
Hey RD,
In my example below I'm ingesting a metric thats random from 1-99 and has a device name as a dimension. You can then use partitions and a table view to display each dimension (in your case application) as being in a different state based on the last value.
The expression I used is as follows:
test.metric.average:splitBy("devicename"):last:max:partition("State",value("State10",gt(90)),value("State9",gt(80)),value("State8",gt(70)),value("State7",gt(60)),value("State6",gt(50)),value("State5",gt(40)),value("State4",gt(30)),value("State3",gt(20)),value("State2",gt(10)),value("State1",gt(0))):sort(dimension("devicename",descending))
Hope this helps!
04 Apr 2023 10:23 AM - edited 04 Apr 2023 10:27 AM
Thank you very much @Fin_Ubels, exactly what I needed 😁