05 Dec 2023 11:12 AM
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"
Solved! Go to Solution.
07 Dec 2023 02:51 PM
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...
07 Dec 2023 05:11 PM
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."
07 Dec 2023 11:12 PM
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:
timeseries avg(dt.host.cpu.idle), interval: duration(toLong("2"),"d")
08 Dec 2023 09:12 AM - edited 08 Dec 2023 09:12 AM
*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
09 Dec 2023 07:16 AM
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.