Hi,
I tried to build the heatmap you described and here are the findings.
Using metrics alone (e.g., avg(duration) and sum(calls)) it’s not possible to derive a distribution of calls across duration buckets. Timeseries metrics don’t contain per-call durations, so DQL can’t “unwind” them into individual events.
To calculate the distribution correctly you need to use span-level data, which contains the actual duration of every call.
For example:
fetch spans
| fieldsAdd
day_of_week = getDayOfWeek(start_time),
duration_bucket = range(duration, duration(100, "ms"))
| summarize calls = count(), by: { day_of_week, duration_bucket }
| sort day_of_week asc
This produces a clean distribution table (day of week × duration bucket × calls).
However, Dynatrace heatmap does not support span-based queries, so even with correctly shaped data this cannot be visualized as a heatmap.
I also tried converting the buckets into strings:
fetch spans
| fieldsAdd
day = formatTimestamp(start_time, format:"EEE"),
bucket = concat(
toLong(duration / duration(100,"ms")) * 100,
"-",
toLong(duration / duration(100,"ms")) * 100 + 100,
" ms"
)
| summarize calls = count(), by: { day, bucket }
| sort day asc, bucket asc
This gives the right structure (string/string/number), but heatmap still rejects it because the heatmap visualization currently works only for metric-based queries, not for span/log/event queries.
You can try this on your data