Tempo Metrics Aggregate

Hi there! I’m trying to find the total count of spans over the timerange aggregated by some event value

Say I have spans with event my_event
And that even has an attribute: attr wich value might be either foo or bar

Say 11 spans have the event with attr=foo and 9 have attr=bar over last 24 hours.

I wan to get some table like:

attr | count
-----+------
foo  |    11
bar  |     9

Or some equivalent way to get that tottal count.

I was able to write something like

{event:name="my_event"} | count_over_time() by(event.attr)

It shows a graph with values overtime (obviously)…

Is there a way to get a table with the total number of spans?

Hi, yes, the current TraceQL panel is always executing a “range query” which is why it returns the time-series graph. In a future version we will add support for “instant query” which is for this use case and returns the final totals.

For now it should work to do the following:

  • Use Table visualization type
  • Use a “Reduce” transformation with “Total” calculation
  • This should preserve the attr groups and give the total over the whole time range

Example screenshots:

Thank you, @martindisibio!
That’s exactly what I was asking!