You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rework the 'Supported Metrics' documentation to improve consistency
access subsections. Details about the `@Timer` annotation have been
pulled into a new section so that they can be referenced rather than
repeated.
See gh-22217
* Uptime metrics (both the amount of time the application has been running as well as a fixed gauge of the absolute start time)
2142
2155
2143
2156
2144
2157
2145
-
[[production-ready-metrics-spring-mvc]]
2146
-
==== Spring MVC Metrics
2147
-
Auto-configuration enables the instrumentation of requests handled by Spring MVC.
2148
-
When `management.metrics.web.server.request.autotime.enabled` is `true`, this instrumentation occurs for all requests.
2149
-
Alternatively, when set to `false`, you can enable instrumentation by adding `@Timed` to a request-handling method:
2158
+
[[production-ready-metrics-logger]]
2159
+
==== Logger Metrics
2160
+
Auto-configuration enables the event metrics for both Logback and Log4J2.
2161
+
Details are published under the `log4j2.events.` or `logback.events.` meter names.
2150
2162
2151
-
[source,java,pending-extract=true,indent=0]
2152
-
----
2153
-
@RestController
2154
-
@Timed <1>
2155
-
public class MyController {
2156
2163
2157
-
@GetMapping("/api/people")
2158
-
@Timed(extraTags = { "region", "us-east-1" }) <2>
2159
-
@Timed(value = "all.people", longTask = true) <3>
2160
-
public List<Person> listPeople() { ... }
2161
-
2162
-
}
2163
-
----
2164
-
<1> A controller class to enable timings on every request handler in the controller not directly annotated with `@Timed`.
2165
-
<2> A method to enable for an individual endpoint.
2166
-
This is not necessary if you have it on the class, but can be used to customize the timer for this particular endpoint.
2167
-
<3> A method with `longTask = true` to enable a long task timer for the method.
2168
-
Long task timers require a separate metric name, and can be stacked with a short task timer.
2169
2164
2165
+
[[production-ready-metrics-spring-mvc]]
2166
+
==== Spring MVC Metrics
2167
+
Auto-configuration enables the instrumentation of all requests handled by Spring MVC controllers and functional handlers.
2170
2168
By default, metrics are generated with the name, `http.server.requests`.
2171
2169
The name can be customized by setting the configprop:management.metrics.web.server.request.metric-name[] property.
2172
2170
2173
-
By default, Spring MVC-related metrics are tagged with the following information:
2171
+
`@Timed` annotations are supported on `@Controller` classes and `@RequestMapping` methods (see <<production-ready-metrics-timed-annotation>> for details).
2172
+
If you don't want to record metrics for all Spring MVC requests, you can set configprop:management.metrics.web.server.request.autotime.enabled[] to `false` and exclusively use `@Timed` annotations instead.
2173
+
2174
+
By default, Spring MVC related metrics are tagged with the following information:
2174
2175
2175
2176
|===
2176
2177
| Tag | Description
@@ -2202,14 +2203,14 @@ Applications can opt-in and record exceptions by <<spring-boot-features.adoc#boo
2202
2203
2203
2204
[[production-ready-metrics-web-flux]]
2204
2205
==== Spring WebFlux Metrics
2205
-
Auto-configuration enables the instrumentation of all requests handled by WebFlux controllers and functional handlers.
2206
-
When `management.metrics.web.server.request.autotime.enabled` is `true`, this instrumentation occurs for all requests.
2207
-
Alternatively, when set to `false`, you can enable instrumentation by adding `@Timed` to a request-handling method in the same way the Spring MVC example above.
2206
+
Auto-configuration enables the instrumentation of all requests handled by Spring WebFlux controllers and functional handlers.
2207
+
By default, metrics are generated with the name, `http.server.requests`.
2208
+
The name can be customized by setting the configprop:management.metrics.web.server.request.metric-name[] property.
2208
2209
2209
-
By default, metrics are generated with the name `http.server.requests`.
2210
-
You can customize the name by setting the configprop:management.metrics.web.server.request.metric-name[] property.
2210
+
`@Timed` annotations are supported on `@Controller` classes and `@RequestMapping` methods (see <<production-ready-metrics-timed-annotation>> for details).
2211
+
If you don't want to record metrics for all Spring WebFlux requests, you can set configprop:management.metrics.web.server.request.autotime.enabled[] to `false` and exclusively use `@Timed` annotations instead.
2211
2212
2212
-
By default, WebFlux-related metrics are tagged with the following information:
2213
+
By default, WebFluxrelated metrics are tagged with the following information:
2213
2214
2214
2215
|===
2215
2216
| Tag | Description
@@ -2241,31 +2242,13 @@ Applications can opt-in and record exceptions by <<spring-boot-features.adoc#boo
2241
2242
2242
2243
[[production-ready-metrics-jersey-server]]
2243
2244
==== Jersey Server Metrics
2244
-
When Micrometer's `micrometer-jersey2` module is on the classpath, auto-configuration enables the instrumentation of requests handled by the Jersey JAX-RS implementation.
2245
-
When `management.metrics.web.server.request.autotime.enabled` is `true`, this instrumentation occurs for all requests.
2246
-
Alternatively, when set to `false`, you can enable instrumentation by adding `@Timed` to a request-handling method:
2247
-
2248
-
[source,java,pending-extract=true,indent=0]
2249
-
----
2250
-
@Component
2251
-
@Path("/api/people")
2252
-
@Timed <1>
2253
-
public class Endpoint {
2254
-
@GET
2255
-
@Timed(extraTags = { "region", "us-east-1" }) <2>
2256
-
@Timed(value = "all.people", longTask = true) <3>
2257
-
public List<Person> listPeople() { ... }
2258
-
}
2259
-
----
2260
-
<1> On a resource class to enable timings on every request handler in the resource.
2261
-
<2> On a method to enable for an individual endpoint.
2262
-
This is not necessary if you have it on the class, but can be used to further customize the timer for this particular endpoint.
2263
-
<3> On a method with `longTask = true` to enable a long task timer for the method.
2264
-
Long task timers require a separate metric name, and can be stacked with a short task timer.
2265
-
2245
+
Auto-configuration enables the instrumentation of all requests handled by the Jersey JAX-RS implementation whenever Micrometer's `micrometer-jersey2` module is on the classpath.
2266
2246
By default, metrics are generated with the name, `http.server.requests`.
2267
2247
The name can be customized by setting the configprop:management.metrics.web.server.request.metric-name[] property.
2268
2248
2249
+
`@Timed` annotations are supported on request-handling classes and methods (see <<production-ready-metrics-timed-annotation>> for details).
2250
+
If you don't want to record metrics for all Jersey requests, you can set configprop:management.metrics.web.server.request.autotime.enabled[] to `false` and exclusively use `@Timed` annotations instead.
2251
+
2269
2252
By default, Jersey server metrics are tagged with the following information:
2270
2253
2271
2254
|===
@@ -2332,6 +2315,14 @@ There are convenience static functions in `RestTemplateExchangeTags` and `WebCli
2332
2315
2333
2316
2334
2317
2318
+
==== Tomcat Metrics
2319
+
Auto-configuration will enable the instrumentation of Tomcat only when an `MBeanRegistry` is enabled.
2320
+
By default, the `MBeanRegistry` is disabled, but you can enable it by setting configprop:server.tomcat.mbeanregistry.enabled[] to `true`.
2321
+
2322
+
Tomcat metrics are published under the `tomcat.` meter name.
2323
+
2324
+
2325
+
2335
2326
[[production-ready-metrics-cache]]
2336
2327
==== Cache Metrics
2337
2328
Auto-configuration enables the instrumentation of all available ``Cache``s on startup with metrics prefixed with `cache`.
@@ -2394,6 +2385,14 @@ Auto-configuration will enable the instrumentation of all available RabbitMQ con
2394
2385
2395
2386
2396
2387
2388
+
2389
+
[[production-ready-metrics-integration]]
2390
+
==== Spring Integration Metrics
2391
+
Spring Integration provides {spring-integration-docs}system-management.html#micrometer-integration[Micrometer support] automatically whenever a `MeterRegistry` bean is available.
2392
+
Metrics are published under the `spring.integration.` meter name.
2393
+
2394
+
2395
+
2397
2396
[[production-ready-metrics-kafka]]
2398
2397
==== Kafka Metrics
2399
2398
Auto-configuration will register a `MicrometerConsumerListener` and `MicrometerProducerListener` for the auto-configured consumer factory and producer factory respectively.
@@ -2447,6 +2446,9 @@ To disable the auto-configured command metrics, set the following property:
0 commit comments