@@ -1756,6 +1756,47 @@ To customize the tags, provide a `@Bean` that implements `WebFluxTagsProvider`.
17561756
17571757
17581758
1759+ [[production-ready-metrics-jersey-server]]
1760+ ==== Jersey Server Metrics
1761+ Auto-configuration enables the instrumentation of requests handled by the Jersey JAX-RS
1762+ implementation. When `management.metrics.jersey2.server.auto-time-requests` is `true`,
1763+ this instrumentation occurs for all requests. Alternatively, when set to `false`, you
1764+ can enable instrumentation by adding `@Timed` to a request-handling method:
1765+
1766+ [source,java,indent=0]
1767+ ----
1768+ @Component
1769+ @Path("/api/people")
1770+ @Timed <1>
1771+ public class Endpoint {
1772+ @GET
1773+ @Timed(extraTags = { "region", "us-east-1" }) <2>
1774+ @Timed(value = "all.people", longTask = true) <3>
1775+ public List<Person> listPeople() { ... }
1776+ }
1777+ ----
1778+ <1> On a resource class to enable timings on every request handler in the resource.
1779+ <2> On a method to enable for an individual endpoint. This is not necessary if you have it on
1780+ the class, but can be used to further customize the timer for this particular endpoint.
1781+ <3> On a method with `longTask = true` to enable a long task timer for the method. Long task
1782+ timers require a separate metric name, and can be stacked with a short task timer.
1783+
1784+ By default, metrics are generated with the name, `http.server.requests`. The name can be
1785+ customized by setting the `management.metrics.jersey2.server.requests-metric-name` property.
1786+
1787+ By default, Jersey server metrics are tagged with the following information:
1788+
1789+ * `method`, the request's method (for example, `GET` or `POST`).
1790+ * `uri`, the request's URI template prior to variable substitution, if possible (for
1791+ example, `/api/person/{id}`).
1792+ * `status`, the response's HTTP status code (for example, `200` or `500`).
1793+ * `exception`, the simple class name of any exception that was thrown while handling the
1794+ request.
1795+
1796+ To customize the tags, provide a `@Bean` that implements `JerseyTagsProvider`.
1797+
1798+
1799+
17591800[[production-ready-metrics-http-clients]]
17601801==== HTTP Client Metrics
17611802Spring Boot Actuator manages the instrumentation of both `RestTemplate` and `WebClient`.
0 commit comments