提取 Grafana Prometheus 标签值

huangapple go评论61阅读模式
英文:

Grafana Prometheus extract label value

问题

label: pv_total{app="example"}

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 like this (last 7 days, just one line): enter image description here

I don't know how to write a query metrics expression to remove the "day" field from the value.

I have tried using the expression label_replace(), but it didn't work.

英文:

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

得分: -1

你可以使用Prometheus的sum()方法,在你的情况下,像这样:sum(pv_total{job="$job"})

英文:

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

huangapple
  • 本文由 发表于 2023年3月15日 20:12:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744530.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定