cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Converting a string variable (1m, 1h, 1d) for use in interval

Duran_Narbona
Participant

Hi,

I have created a variable group_by in Dashboards/Notrbook to be able to group the result of a query. But I don't know how to transform this string into a valid value:

fetch events
| filter event.kind == "DAVIS_PROBLEM"
| summarize {count = count(),event.status_transition = takeLast(event.status)}, by: {status = event.status_transition,`interval` = bin(timestamp, $group_by)}

 I haven't seen how I can do that in the documentation: https://www.dynatrace.com/support/help/platform/grail/dynatrace-query-language/functions

Many thanks

1 REPLY 1

sinisa_zubic
Dynatrace Champion
Dynatrace Champion

Hi @Duran_Narbona 

There is a similar example in our help: https://www.dynatrace.com/support/help/shortlink/dashboard-component-variable#resolution-in-dql-comm...

Just add 2 variables to dashboard, one for resolution and one for unit.

Then the query can look like this:

fetch events
| filter event.kind == "DAVIS_PROBLEM"
| fieldsAdd toDuration(multiplier)
| summarize {count = count(),event.status_transition = takeLast(event.status)}, by: {status = event.status_transition,`interval` = bin(timestamp, duration($resolution, unit:$unit))}

sinisa_zubic_0-1694156036812.png

Best,
Sini

 

Featured Posts