【问题标题】:Springboot-Prometheus: Increment the http_server_requests_seconds_count counter only if it is from a particular sourceSpringboot-Prometheus:仅当来自特定来源时才增加 http_server_requests_seconds_count 计数器
【发布时间】:2019-12-02 06:31:47
【问题描述】:

我有一个带有 prometheus 和 micrometer 的 Springboot 项目。当我检查 http_server_requests_seconds_count 时,我得到了调用特定 Web 服务的次数。但我只想在 Web 服务请求仅来自特定来源时才增加计数器。知道怎么做吗? 尝试单独为几个调用传递查询字符串。但是普罗米修斯计数器并没有根据查询字符串来区分计数。

【问题讨论】:

  • 我会为此引入一个单独的指标。然后以编程方式递增。

标签: java rest prometheus spring-boot-actuator micrometer


【解决方案1】:

也许服务器有一个特殊的主机名?如果是这样,您可以在收到此特定名称时增加它。或者,也许您有某个函数可以处理此服务器的请求,如果是这样,您可以查看路径并仅在获取 /

时增加指标

【讨论】:

    猜你喜欢
    • 2019-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多