向普罗米修斯添加指标

Adding metrics to Prometheus

我是 prometheus 的新手,对如何将以下指标插入 prometheus 以便将它们显示到 grafana 感到有点困惑。我的想法是每隔 5 分钟从我拥有 returns 信息的服务中轮询 api。

post 请求的结果如下所示:

{
  "items" : [ {
    "name" : "1VLj4-XPRRqbl3sXyv6d9w",
    "earliestTimestamp" : 1612796264194,
    "cursor" : {
      "@class" : ".IngestionOffsetCursor",
      "ingestionTime" : 1613401054408,
      "offset" : 1
    },
    "metrics" : {
      "http2xx.sum" : [ [ 1613401060000, 211716.0 ] ],
      "http4xx.sum" : [ [ 1613401060000, 45.0 ] ],
      "http5xx.sum" : [ [ 1613401060000, 6.0 ] ]
    }
  } ],
  "canLoadMore" : false,
  "totalHits" : 1,
  "totalRepresentedItemCount" : 1
}

有人可以为我指出正确的方向,告诉我如何处理这个问题。

我刚刚关注了这个博客 post - https://www.robustperception.io/writing-json-exporters-in-python.