Renaming 'value' in Loki

Grafana 10.2.3

I am currently trying to mimic a kibana dashboard that reports on Teams call errors and stacks the errors in bars.

(Kibana Dashboard):

In Grafana using Loki, I am having a hardtime doing this.

Query: count_over_time({bucket=“bucketname”} |= guid | json FailureType=“Properties.TestType” [$__auto])

This gives me:

I was able to color code the different error names inside the JSON but I cannot ge them to stack.

When this wouldn’t work, I attempted to use 4 different queries:

count_over_time({bucket=“bucketname”} |= guid | json FailureType=“Properties.TestType.CallFailure” [$__auto])

count_over_time({bucket=“bucketname”} |= guid | json FailureType=“Properties.TestType.VideoDevice” [$__auto])

count_over_time({bucket=“bucketname”} |= guid | json FailureType=“Properties.TestType.AudioDevice” [$__auto])

count_over_time({bucket=“bucketname”} |= guid | json FailureType=“Properties.TestType.NetworkAudio” [$__auto])

However this outputs each query as “value” and not the name of “TestType”.

Another thing of note, when clicking on the ledgend to filter based off one of the 4 options, it blanks the entire visulazation out.

I have a few questions here.

  1. How do I rename the output for each query to not just be “Value”
  2. How can I get these Names/Bars to stack
  3. How can I get the legend to work properly?

wonder if it needs to be pivoted via the group by matrix?

Whelp, looks like a co-worker got the solution after I posted this lol.

sum by(FailureType) (count_over_time({bucket=“bucketName”} |= guid | json FailureType=“Properties.TestType” | line_format {{.FailureType}} [$__interval]))

1 Like