DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Duration unit in timeseries

mgreene
Frequent Guest

Hi, I'm hoping I'm missing something simple here, when I run this query I'm using duration() to get a queue time duration, in table it outputs as seconds with the correct type of duration and I can display it as a line graph and the units display correctly. However if I add the commented out maketimeseries command it displays the units in the Y axis as B, where I'd be expecting seconds

fetch logs
| filter source_filename == "/var/log/job-log/job-runner.log"
| parse content, "JSON{STRING:job,ISO8601:time,INT:time_in_queue_seconds}:gl.content"
| fieldsAdd  job = gl.content[job], queue_time = duration(gl.content[time_in_queue_seconds], unit:"s"), end_time = gl.content[time]
| filter matchesPhrase(msg, "Removed*")
| fields timestamp = end_time, project, queue_time, runner_type
// | maketimeseries avg(queue_time), interval: 1m

mgreene_0-1763056289116.png

Does anyone know how to display this correctly?

2 REPLIES 2

dannemca
DynaMight Guru
DynaMight Guru

Try this

...
| fields timestamp = end_time, project, queue_time, runner_type, graph_queue_time=gl.content[time_in_queue_seconds]
| maketimeseries avg(graph_queue_time), interval: 1m

And then, in the graph options, set the units and formats for that field.

Regards

Site Reliability Engineer @ Kyndryl

mgreene
Frequent Guest

Thanks, that was the answer, I guess I was thrown because B isn't a duration unit, but setting it to ns in the units did the trick.

Featured Posts