-1

My current query: locust_user_count

Graph: Here's what my graph currently looks like

Problem: If you see the graph, you see for the most part there is little to no data (mostly 0 values), but there's a big bump in between. What I want to achieve is 2 things

  1. The graph only displays non zero values.
  2. The graph only displays the section which has non zero values (so that the starting time is = first non zero value and end time is last non zero value).

The problem right now is that as time passes, the bump goes out of picture, what I want to do is, everytime the graph loads it recenters the bump to be the center for that graph.

Is that possible? Thanks. Source is prometheus.

Viv
  • 1,706
  • 1
  • 18
  • 27

1 Answers1

1

First part is possible: use query

locust_user_count > 0

This way Prometheus will return values only where they are bigger than zero.

Second part is not possible, though. Grafana can't adjust time limits based on query results. Time adjustment is possible only using constant values, like shift time for N hours.

Only thing I can suggest is to add new panel with query like

min_over_time(timestamp(locust_user_count > 0)[$__range])

to show time of first appearance of non zero value.

markalex
  • 8,623
  • 2
  • 7
  • 32
  • Thank you, I was afraid second part probably isn't possible. I was hoping something through transformations might work. – Viv May 05 '23 at 22:06
  • 1
    @Viv, no, transformations are for data, not panel configuration. – markalex May 06 '23 at 06:01