0

label: pv_total{app="example",day="2023_03_15",} 123.0

Current Grafana dashboard:image

The day in my data is redundant, I want to display without it in the data

i hope my dashboard is this(last 7 days, just one line):

enter image description here

i don't know how to write query metrics expression to delete the day filed of value

i hava try expression label_replace(), but it's not work,

  • 1
    Since your counter starts "counting" every day from 0, you would not have a way to create a continuous line like in your desired image. Why are you using such a strange label in your metric, and is there a way to convert it to more traditional counter? – markalex Mar 15 '23 at 12:26

1 Answers1

-1

You can use prometheus' sum() method, in your case, like this: sum(pv_total{job="$job"}).

SIMULATAN
  • 833
  • 2
  • 17
  • While this will result in a single metric - this wouldn't make result graph continuous. Obviously every day metric starts from 0. – markalex Mar 15 '23 at 12:22
  • I don't want the data to accumulate, I want my data to be displayed as if there is no day attribute – tony zheng Mar 15 '23 at 12:22
  • Could you show what the graph looks like now? Every time it starts at 0, the color changes and a different series seems to be started, therefore, summing them together _should_ work right? – SIMULATAN Mar 15 '23 at 12:24
  • @SIMULATAN The data starts from 0 every time because my daily data will be cleared. I can make it continuous through some functions, but it still has many colored lines – tony zheng Mar 16 '23 at 01:51