Skip to content

Commit

Permalink
Update docs for 0.2.0.RELEASE
Browse files Browse the repository at this point in the history
  • Loading branch information
jkschneider committed May 18, 2017
1 parent 2d9ab96 commit c39fdfa
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ to Spring MVC and Spring WebFlux server endpoints.

=== Web MVC and Annotation-Based WebFlux

Spring Boot 2.+ autoconfigures these interceptors. If you are using Spring Boot 1.x, simply add `@Import(WebMetricsConfiguration.class)`
to your `@SpringBootApplication` class.
Adding `@EnableMetrics` to your `@SpringBootApplication` class autoconfigures these
interceptors.

The interceptors need to be enabled for every request handler or controller that you want
to time. Add `@Timed` to:
Expand All @@ -431,7 +431,7 @@ public class MyController {
```

The `Timer` is registered with a name of `http_server_requests` by default. This can be changed by setting
`spring.metrics.web.name`.
`spring.metrics.web.server_requests.name`.

The `Timer` contains a set of dimensions for every request, governed by the primary bean `WebMetricsTagProvider` registered
in your application context. If you don't provide such a bean, a default implementation is selected which adds the following dimensions:
Expand Down Expand Up @@ -464,6 +464,15 @@ RouterFunction<ServerResponse> routes = RouterFunctions

The filter applies to all routes defined by this router function.

=== `RestTemplate` Timing

Adding `@EnableMetrics` to your `@SpringBootApplication` class autoconfigures a `BeanPostProcessor` for `RestTemplate`,
so every instance you create via the application context will be instrumented.

A timer is recorded for each invocation that includes tags for URI (before parameter substitution), host, and status.
The name of this timer is `http_client_requests`, and can be changed via the `spring.metrics.web.client_requests.name`
property.

== Prometheus

=== Quickstart for Prometheus-based monitoring
Expand All @@ -479,8 +488,8 @@ Register the Prometheus registry and enable Prometheus scraping:

```java
@SpringBootApplication
@EnableMetrics
@EnablePrometheusScraping
@Import(WebMetricsConfiguration.class) // to enable automatic timing of Web MVC endpoints
public class MyApp {
@Bean
public MeterRegistry prometheusRegistry() {
Expand Down

0 comments on commit c39fdfa

Please sign in to comment.