亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Actuator /metrics 端點不包括 http.server.requests

Actuator /metrics 端點不包括 http.server.requests

收到一只叮咚 2022-05-25 16:47:50
根據彈簧靴執行器的文檔Auto-configuration enables the instrumentation of requests handled by Spring MVC. When management.metrics.web.server.auto-time-requests is true, this instrumentation occurs for all requests. Alternatively, when set to false, you can enable instrumentation by adding @Timed和By default, metrics are generated with the name, http.server.requests當我訪問 /metrics 端點時,我得到了{  "mem": 405105,  "mem.free": 150352,  "processors": 8,  "instance.uptime": 440055,  "uptime": 455888,  "systemload.average": 1.904296875,  "heap.committed": 315392,  "heap.init": 262144,  "heap.used": 164015,  "heap": 4194304,  "nonheap.committed": 92800,  "nonheap.init": 4992,  "nonheap.used": 89714,  "nonheap": 0,  "threads.peak": 64,  "threads.daemon": 43,  "threads.totalStarted": 95,  "threads": 46,  "classes": 12459,  "classes.loaded": 12459,  "classes.unloaded": 0,  "gc.g1_young_generation.count": 12,  "gc.g1_young_generation.time": 127,  "gc.g1_old_generation.count": 0,  "gc.g1_old_generation.time": 0,  "httpsessions.max": -1,  "httpsessions.active": 0,  "datasource.primary.active": 0,  "datasource.primary.usage": 0.0,  "gauge.response.example.users": 2.0,  "counter.status.200.example.users": 5}所以 http.server.requests 不存在。counter.status.200.example 顯示了通過我的應用程序的請求,但它們在每個端點上是分開的。我需要整個應用程序的整體。我嘗試禁用management.metrics.web.server.auto-time-requests并添加@Timed到端點,但效果不佳。結果與上述相同。有誰知道我如何顯示對應用程序提出的總體請求?先感謝您。*編輯當我添加時, compile('io.micrometer:micrometer-registry-prometheus:latest.release') 我收到以下錯誤Parameter 0 of method prometheusEndpointFix in PrometheusEndpointConfiguration required a bean of type 'PrometheusEndpoint' that could not be found.即使@Bean 在那里..@Configurationclass PrometheusEndpointConfiguration {  @Bean  public PrometheusEndpoint prometheusEndpoint() {    return new PrometheusEndpoint(CollectorRegistry.defaultRegistry);  }...}
查看完整描述

2 回答

?
子衿沉夜

TA貢獻1828條經驗 獲得超3個贊

一個問題是在使用執行器并遵循spring boot 2.2.6的指南時,我注意到如果到目前為止還沒有請求發生, http.server.requests將不會顯示在指標列表中。發出第一個 REST 請求后,http 指標變為可用。



查看完整回答
反對 回復 2022-05-25
?
動漫人物

TA貢獻1815條經驗 獲得超10個贊

當通過Spring Boot 1.5 Actuator 框架micrometer-spring-legacy中的“舊”/metrics端點將 Micrometer 與 Spring Boot 1.5 一起使用時,不會被 Micrometer 取代。在 Spring Boot 1.5 應用程序中,舊的執行器指標實現和 Micrometer 彼此完全獨立。

目前,我知道在這種情況下輕松可視化 Micrometer 收集的指標的唯一方法是使用 Micrometers Prometheus 后端,micrometer-registry-prometheus另外包含micrometer-spring-legacy. 默認情況下,這將公開/prometheus端點并以 Prometheus 公開格式公開指標。

當然,您也可以推出自己的端點實現,它模仿 Spring Boot 2/actuator/metrics端點,查詢MeterRegistry并可視化所有包含的指標。但即便如此,這也應該僅用于調試事物,而不是永久讀取此端點并將該數據保存在度量存儲中的某個位置。Prometheus 展示格式已針對該確切用例“開發”。(而且它的可讀性很強,因此可以作為第一個入口點,以防您不抓取這些指標。)


查看完整回答
反對 回復 2022-05-25
  • 2 回答
  • 0 關注
  • 257 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號