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

Variables of specific Type

r_weber
DynaMight Champion
DynaMight Champion

Is there a way to specify a dashboard variable of type "duration"?
Or a way to convert a string to a duration within the makeTimeseries command, like this?

Aggregation = 1d,7d,30d

fetch logs, scanLimitGBytes: 5000
| filter isNotNull(k8s.deployment.name)
| filter loglevel == "INFO"
| fields k8s.deployment.name, chars=stringLength(content), timestamp
| makeTimeseries sum_content_chars=sum(chars), by: {k8s.deployment.name}, interval:asDuration($Aggregation)

 The above DQL fails with "Execution failed with error: failure to statically evaluate expression"

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net
5 REPLIES 5

zietho
Dynatrace Champion
Dynatrace Champion

E.g. with duration(toLong($resolution), unit:"m"))} 

FInd an example here: https://docs.dynatrace.com/docs/shortlink/dashboard-component-variable#limitations-when-using-variab... 

r_weber
DynaMight Champion
DynaMight Champion

I tried that before in this form:

...
| makeTimeseries sum_content_chars=sum(chars), by: {k8s.deployment.name}, interval:duration(toLong($Aggregation),unit:d)

 

However this didn't work:
"The parameter `interval` has to be constant, but `duration(toLong("1"), d)` accesses data."

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

zietho
Dynatrace Champion
Dynatrace Champion

odd seems like there have been some changes. 

What works for me is the following, where I just pass the unit as a second parameter: 

zietho_0-1701990573960.png

timeseries avg(dt.host.cpu.idle), interval: duration(toLong("2"),"d")

 

r_weber
DynaMight Champion
DynaMight Champion

*Facepalm*...unit has to be a string!

 

| makeTimeseries sum_content_chars=sum(chars), by: {k8s.deployment.name}, interval:duration(toLong($Aggregation),unit:"d")

 

That works, also if the unit itself is a variable 

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

zietho
Dynatrace Champion
Dynatrace Champion

Totally missed the quotation marks! Well cool then I am happy it works for you! Keep us in the loop when you face other issues! Always on the lookout for variable feedback. 

Featured Posts