【问题标题】:Prometheus TimeStamp Returns NullPrometheus 时间戳返回 Null
【发布时间】:2020-07-15 14:13:15
【问题描述】:

我使用以下代码段注册了一个 Prometheus 计数器。

public static final Counter requestsReceived = Counter.build("total_request_count_proxy_serv", "Total number of requests to a proxy service").labelNames("service", "method", "endpoint", "remoteAddress").register();

当我公开指标并在浏览器中查看它们时,我得到了以下时间戳为空的结果。

Name: total_request_count_proxy_serv Type: COUNTER Help: Total number of requests to a proxy service Samples: [Name: total_request_count_proxy_serv LabelNames: [service, method, endpoint, remoteAddress] labelValues: [TestProxy, GET, /services/TestProxy, 127.0.0.1] Value: 2.0 **TimestampMs: null**]

为什么时间戳显示为空?

【问题讨论】:

    标签: prometheus prometheus-java


    【解决方案1】:

    直接检测没有时间戳,所以这是正确的。时间戳仅出现在出口商的特定利基用例中。

    指标名称也应该从最少到最具体,避免冗余并且计数器以_total 结尾,所以myproxy_requests_total 将是一个更清晰、更简洁的名称。

    【讨论】:

      猜你喜欢
      • 2018-07-09
      • 1970-01-01
      • 1970-01-01
      • 2020-09-10
      • 1970-01-01
      • 2022-01-07
      • 2014-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多