![](/img/trans.png)
[英]why prometheus using the rate to calculate the request_duration
[英]Calculate request rate for prometheus
我有一個用 python 編寫的示例python
應用程序。
每個容器報告(使用prometheus-python
客戶端庫)其總請求數。
因此,由於我有 2 個副本,因此在 prometheus 儀表板中查詢my_metric_request
時,我得到 2 個時間序列(每個 pod 一個)
myapp_requests_overall_total{container="myapp", endpoint="metricsport", instance="172.17.0.4:8282", job="my-service-exposing-the-metrics", namespace="default", pod="my-app-ff75c4784-xxtx4", service="my-service-exposing-the-metrics"}
243
myapp_requests_overall_total{container="myapp", endpoint="metricsport", instance="172.17.0.4:8282", job="my-service-exposing-the-metrics", namespace="default", pod="my-app-ff75c4784-dk40", service="my-service-exposing-the-metrics"}
我的問題是如何生成(具有請求總和)一個指示請求速率的指標?
您需要將結果匯總一個(或多個)有用的 label。
例如,如果您想按作業監控平均請求數,那么您將擁有以下內容:
sum(rate(myapp_requests_overall_total[5m])) by (job)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.