Actuator /metrics 端點不包括 http.server.requests
根據彈簧靴執行器的文檔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); }...}
查看完整描述