admin管理员组文章数量:1200972
Need only the top first element of the prometheus metrics.
i did topk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) but it is not only showing the displayName=7 record, but also other 6 records as well.
I need only and only this metric.
deploy_time_total{accountName="deploy-dev",displayName="7",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4X5A5MVRS28HXTZ2PYCQ7W",status="SUCCEEDED"} 1.737479079809E12 1737543094457
but bottomk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) is showing only the displayName=1 record.
Here is my grafana output. I need only and only the pink line in the grafana page(which is nothing but the displayName=7 record.
grafana screenshot.
i did topk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) but it is not only showing the displayName=7 record but also the other records.(screenshot attached)
but bottomk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) is showing only the displayName=1 record.
here is the display Name flow -- 1-> 2 -> 3-> 4 -> 5-> 6 ->7
topk(1,metric) should give me only 7
bottomk(1,metric) should give me only 1(which is showing)
see the above grafana screenshot.
deploy_time_total{accountName="deploy-dev",displayName="3",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WDDHP2R8G1DXAVVF4908E",status="SUCCEEDED"} 1.737478296332E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="5",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WV13BHBEE5HN11DKRH5P8",status="SUCCEEDED"} 1.737478742459E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="4",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WJMB9R7B4G627D4WW3YG4",status="SUCCEEDED"} 1.737478467509E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="6",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WZWBA1F3HSBDWR05TDAPX",status="SUCCEEDED"} 1.737478901437E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="2",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4W65J43T4DNTYRR41YY65R",status="SUCCEEDED"} 1.737478058649E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="7",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4X5A5MVRS28HXTZ2PYCQ7W",status="SUCCEEDED"} 1.737479079809E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="1",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4W3D4729SG71QE2QW9KYFT",status="SUCCEEDED"} 1.737477990148E12 1737543094457
Need only the top first element of the prometheus metrics.
i did topk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) but it is not only showing the displayName=7 record, but also other 6 records as well.
I need only and only this metric.
deploy_time_total{accountName="deploy-dev",displayName="7",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4X5A5MVRS28HXTZ2PYCQ7W",status="SUCCEEDED"} 1.737479079809E12 1737543094457
but bottomk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) is showing only the displayName=1 record.
Here is my grafana output. I need only and only the pink line in the grafana page(which is nothing but the displayName=7 record.
grafana screenshot.
i did topk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) but it is not only showing the displayName=7 record but also the other records.(screenshot attached)
but bottomk(1,deploy_time_total{status="SUCCEEDED"}) by (imageName) is showing only the displayName=1 record.
here is the display Name flow -- 1-> 2 -> 3-> 4 -> 5-> 6 ->7
topk(1,metric) should give me only 7
bottomk(1,metric) should give me only 1(which is showing)
see the above grafana screenshot.
deploy_time_total{accountName="deploy-dev",displayName="3",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WDDHP2R8G1DXAVVF4908E",status="SUCCEEDED"} 1.737478296332E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="5",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WV13BHBEE5HN11DKRH5P8",status="SUCCEEDED"} 1.737478742459E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="4",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WJMB9R7B4G627D4WW3YG4",status="SUCCEEDED"} 1.737478467509E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="6",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4WZWBA1F3HSBDWR05TDAPX",status="SUCCEEDED"} 1.737478901437E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="2",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4W65J43T4DNTYRR41YY65R",status="SUCCEEDED"} 1.737478058649E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="7",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4X5A5MVRS28HXTZ2PYCQ7W",status="SUCCEEDED"} 1.737479079809E12 1737543094457
deploy_time_total{accountName="deploy-dev",displayName="1",imageName="opsmx11/nginx-demo:1853",namespace="demo-dev",pipelineId="01JJ4W3D4729SG71QE2QW9KYFT",status="SUCCEEDED"} 1.737477990148E12 1737543094457
Share
Improve this question
asked Jan 22 at 14:09
SanjeevSanjeev
1
1
|
1 Answer
Reset to default 0your screenshot shows result of a query on a graph which demonstrates data points in a selected time range. that is completely normal since pink started somewhere and before that another metric had the highest value.
instead of a range query, you can use instant query to always get last top 1 in your metric.
本文标签: grafanaNeed only the top first element of the prometheus metricsStack Overflow
版权声明:本文标题:grafana - Need only the top first element of the prometheus metrics - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738555724a2098245.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
@end()
. It is finicky though. If you'll go that route take a look atlast_over_time
also. – markalex Commented Jan 26 at 9:09