diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/auditing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/auditing.adoc index 2a18952ed1..bac2395df0 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/auditing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/auditing.adoc @@ -3,9 +3,9 @@ Once Spring Security is in play, Spring Boot Actuator has a flexible audit framework that publishes events (by default, "`authentication success`", "`failure`" and "`access denied`" exceptions). This feature can be very useful for reporting and for implementing a lock-out policy based on authentication failures. -Auditing can be enabled by providing a bean of type `AuditEventRepository` in your application's configuration. +You can enable auditing by providing a bean of type `AuditEventRepository` in your application's configuration. For convenience, Spring Boot offers an `InMemoryAuditEventRepository`. -`InMemoryAuditEventRepository` has limited capabilities and we recommend using it only for development environments. +`InMemoryAuditEventRepository` has limited capabilities, and we recommend using it only for development environments. For production environments, consider creating your own alternative `AuditEventRepository` implementation. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/cloud-foundry.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/cloud-foundry.adoc index cf44dca874..f6032fba95 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/cloud-foundry.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/cloud-foundry.adoc @@ -4,10 +4,10 @@ Spring Boot's actuator module includes additional support that is activated when The `/cloudfoundryapplication` path provides an alternative secured route to all `@Endpoint` beans. The extended support lets Cloud Foundry management UIs (such as the web application that you can use to view deployed applications) be augmented with Spring Boot actuator information. -For example, an application status page may include full health information instead of the typical "`running`" or "`stopped`" status. +For example, an application status page can include full health information instead of the typical "`running`" or "`stopped`" status. NOTE: The `/cloudfoundryapplication` path is not directly accessible to regular users. -In order to use the endpoint, a valid UAA token must be passed with the request. +To use the endpoint, you must pass a valid UAA token with the request. @@ -15,7 +15,6 @@ In order to use the endpoint, a valid UAA token must be passed with the request. === Disabling Extended Cloud Foundry Actuator Support If you want to fully disable the `/cloudfoundryapplication` endpoints, you can add the following setting to your `application.properties` file: - [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- management: @@ -41,12 +40,12 @@ If your Cloud Foundry UAA or Cloud Controller services use self-signed certifica [[actuator.cloud-foundry.custom-context-path]] === Custom Context Path -If the server's context-path has been configured to anything other than `/`, the Cloud Foundry endpoints will not be available at the root of the application. -For example, if `server.servlet.context-path=/app`, Cloud Foundry endpoints will be available at `/app/cloudfoundryapplication/*`. +If the server's context-path has been configured to anything other than `/`, the Cloud Foundry endpoints are not available at the root of the application. +For example, if `server.servlet.context-path=/app`, Cloud Foundry endpoints are available at `/app/cloudfoundryapplication/*`. -If you expect the Cloud Foundry endpoints to always be available at `/cloudfoundryapplication/*`, regardless of the server's context-path, you will need to explicitly configure that in your application. -The configuration will differ depending on the web server in use. -For Tomcat, the following configuration can be added: +If you expect the Cloud Foundry endpoints to always be available at `/cloudfoundryapplication/*`, regardless of the server's context-path, you need to explicitly configure that in your application. +The configuration differs, depending on the web server in use. +For Tomcat, you can add the following configuration: [source,java,indent=0,subs="verbatim"] ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/enabling.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/enabling.adoc index a962b0ce45..a4078dd998 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/enabling.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/enabling.adoc @@ -1,7 +1,7 @@ [[actuator.enabling]] == Enabling Production-ready Features The {spring-boot-code}/spring-boot-project/spring-boot-actuator[`spring-boot-actuator`] module provides all of Spring Boot's production-ready features. -The recommended way to enable the features is to add a dependency on the `spring-boot-starter-actuator` '`Starter`'. +The recommended way to enable the features is to add a dependency on the `spring-boot-starter-actuator` "`Starter`". .Definition of Actuator **** @@ -9,7 +9,7 @@ An actuator is a manufacturing term that refers to a mechanical device for movin Actuators can generate a large amount of motion from a small change. **** -To add the actuator to a Maven based project, add the following '`Starter`' dependency: +To add the actuator to a Maven-based project, add the following '`Starter`' dependency: [source,xml,indent=0,subs="verbatim"] ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc index 386c491b99..74bf92161d 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc @@ -4,13 +4,13 @@ Actuator endpoints let you monitor and interact with your application. Spring Boot includes a number of built-in endpoints and lets you add your own. For example, the `health` endpoint provides basic application health information. -Each individual endpoint can be <> and <>. +You can <> each individual endpoint and <>. An endpoint is considered to be available when it is both enabled and exposed. -The built-in endpoints will only be auto-configured when they are available. -Most applications choose exposure via HTTP, where the ID of the endpoint along with a prefix of `/actuator` is mapped to a URL. +The built-in endpoints are auto-configured only when they are available. +Most applications choose exposure over HTTP, where the ID of the endpoint and a prefix of `/actuator` is mapped to a URL. For example, by default, the `health` endpoint is mapped to `/actuator/health`. -TIP: To learn more about the Actuator's endpoints and their request and response formats, please refer to the separate API documentation ({spring-boot-actuator-restapi-docs}[HTML] or {spring-boot-actuator-restapi-pdfdocs}[PDF]). +TIP: To learn more about the Actuator's endpoints and their request and response formats, see the separate API documentation ({spring-boot-actuator-restapi-docs}[HTML] or {spring-boot-actuator-restapi-pdfdocs}[PDF]). The following technology-agnostic endpoints are available: @@ -63,7 +63,7 @@ The following technology-agnostic endpoints are available: Requires one or more `Liquibase` beans. | `metrics` -| Shows '`metrics`' information for the current application. +| Shows "`metrics`" information for the current application. | `mappings` | Displays a collated list of all `@RequestMapping` paths. @@ -76,7 +76,7 @@ The following technology-agnostic endpoints are available: | `sessions` | Allows retrieval and deletion of user sessions from a Spring Session-backed session store. - Requires a Servlet-based web application using Spring Session. + Requires a servlet-based web application that uses Spring Session. | `shutdown` | Lets the application be gracefully shutdown. @@ -102,11 +102,11 @@ If your application is a web application (Spring MVC, Spring WebFlux, or Jersey) On an OpenJ9 JVM, a `PHD`-format file is returned. | `jolokia` -| Exposes JMX beans over HTTP (when Jolokia is on the classpath, not available for WebFlux). +| Exposes JMX beans over HTTP when Jolokia is on the classpath (not available for WebFlux). Requires a dependency on `jolokia-core`. | `logfile` -| Returns the contents of the logfile (if `logging.file.name` or `logging.file.path` properties have been set). +| Returns the contents of the logfile (if the `logging.file.name` or the `logging.file.path` property has been set). Supports the use of the HTTP `Range` header to retrieve part of the log file's content. | `prometheus` @@ -150,7 +150,7 @@ If you want to change only the technologies over which an endpoint is exposed, u [[actuator.endpoints.exposing]] === Exposing Endpoints -Since Endpoints may contain sensitive information, careful consideration should be given about when to expose them. +Since Endpoints may contain sensitive information, you should carefully consider when to expose them. The following table shows the default exposure for the built-in endpoints: [cols="1,1,1"] @@ -280,7 +280,7 @@ To change which endpoints are exposed, use the following technology-specific `in The `include` property lists the IDs of the endpoints that are exposed. The `exclude` property lists the IDs of the endpoints that should not be exposed. The `exclude` property takes precedence over the `include` property. -Both `include` and `exclude` properties can be configured with a list of endpoint IDs. +You can configure both the `include` and the `exclude` properties with a list of endpoint IDs. For example, to stop exposing all endpoints over JMX and only expose the `health` and `info` endpoints, use the following property: @@ -306,7 +306,7 @@ For example, to expose everything over HTTP except the `env` and `beans` endpoin exclude: "env,beans" ---- -NOTE: `*` has a special meaning in YAML, so be sure to add quotes if you want to include (or exclude) all endpoints. +NOTE: `*` has a special meaning in YAML, so be sure to add quotation marks if you want to include (or exclude) all endpoints. NOTE: If your application is exposed publicly, we strongly recommend that you also <>. @@ -317,14 +317,14 @@ TIP: If you want to implement your own strategy for when endpoints are exposed, [[actuator.endpoints.security]] === Security For security purposes, all actuators other than `/health` are disabled by default. -The configprop:management.endpoints.web.exposure.include[] property can be used to enable the actuators. +You can use the configprop:management.endpoints.web.exposure.include[] property to enable the actuators. -NOTE: Before setting the `management.endpoints.web.exposure.include`, ensure that the exposed actuators do not contain sensitive information and/or are secured by placing them behind a firewall or by something like Spring Security. +NOTE: Before setting the `management.endpoints.web.exposure.include`, ensure that the exposed actuators do not contain sensitive information, are secured by placing them behind a firewall, or are secured by something like Spring Security. If Spring Security is on the classpath and no other `WebSecurityConfigurerAdapter` or `SecurityFilterChain` bean is present, all actuators other than `/health` are secured by Spring Boot auto-configuration. -If you define a custom `WebSecurityConfigurerAdapter` or `SecurityFilterChain` bean, Spring Boot auto-configuration will back off and you will be in full control of actuator access rules. +If you define a custom `WebSecurityConfigurerAdapter` or `SecurityFilterChain` bean, Spring Boot auto-configuration backs off and lets you fully control the actuator access rules. -If you wish to configure custom security for HTTP endpoints, for example, only allow users with a certain role to access them, Spring Boot provides some convenient `RequestMatcher` objects that can be used in combination with Spring Security. +If you wish to configure custom security for HTTP endpoints (for example, to allow only users with a certain role to access them), Spring Boot provides some convenient `RequestMatcher` objects that you can use in combination with Spring Security. A typical Spring Security configuration might look something like the following example: @@ -349,31 +349,33 @@ You can do so by changing the configprop:management.endpoints.web.exposure.inclu include: "*" ---- -Additionally, if Spring Security is present, you would need to add custom security configuration that allows unauthenticated access to the endpoints as shown in the following example: +Additionally, if Spring Security is present, you would need to add custom security configuration that allows unauthenticated access to the endpoints, as the following example shows: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/endpoints/security/exposeall/MySecurityConfiguration.java[] ---- -NOTE: In both the examples above, the configuration applies only to the actuator endpoints. -Since Spring Boot's security configuration backs off completely in the presence of any `SecurityFilterChain` bean, you will need to configure an additional `SecurityFilterChain` bean with rules that apply to the rest of the application. +NOTE: In both of the preceding examples, the configuration applies only to the actuator endpoints. +Since Spring Boot's security configuration backs off completely in the presence of any `SecurityFilterChain` bean, you need to configure an additional `SecurityFilterChain` bean with rules that apply to the rest of the application. + + [[actuator.endpoints.security.csrf]] ==== Cross Site Request Forgery Protection Since Spring Boot relies on Spring Security's defaults, CSRF protection is turned on by default. -This means that the actuator endpoints that require a `POST` (shutdown and loggers endpoints), `PUT` or `DELETE` will get a 403 forbidden error when the default security configuration is in use. +This means that the actuator endpoints that require a `POST` (shutdown and loggers endpoints), a `PUT`, or a `DELETE` get a 403 (forbidden) error when the default security configuration is in use. NOTE: We recommend disabling CSRF protection completely only if you are creating a service that is used by non-browser clients. -Additional information about CSRF protection can be found in the {spring-security-docs}#csrf[Spring Security Reference Guide]. +You can find additional information about CSRF protection in the {spring-security-docs}#csrf[Spring Security Reference Guide]. [[actuator.endpoints.caching]] === Configuring Endpoints Endpoints automatically cache responses to read operations that do not take any parameters. -To configure the amount of time for which an endpoint will cache a response, use its `cache.time-to-live` property. +To configure the amount of time for which an endpoint caches a response, use its `cache.time-to-live` property. The following example sets the time-to-live of the `beans` endpoint's cache to 10 seconds: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -385,7 +387,7 @@ The following example sets the time-to-live of the `beans` endpoint's cache to 1 time-to-live: "10s" ---- -NOTE: The prefix `management.endpoint.` is used to uniquely identify the endpoint that is being configured. +NOTE: The `management.endpoint.` prefix uniquely identifies the endpoint that is being configured. @@ -406,7 +408,7 @@ To disable the "`discovery page`", add the following property to your applicatio ---- When a custom management context path is configured, the "`discovery page`" automatically moves from `/actuator` to the root of the management context. -For example, if the management context path is `/management`, then the discovery page is available from `/management`. +For example, if the management context path is `/management`, the discovery page is available from `/management`. When the management context path is set to `/`, the discovery page is disabled to prevent the possibility of a clash with other mappings. @@ -414,9 +416,9 @@ When the management context path is set to `/`, the discovery page is disabled t [[actuator.endpoints.cors]] === CORS Support https://en.wikipedia.org/wiki/Cross-origin_resource_sharing[Cross-origin resource sharing] (CORS) is a https://www.w3.org/TR/cors/[W3C specification] that lets you specify in a flexible way what kind of cross-domain requests are authorized. -If you use Spring MVC or Spring WebFlux, Actuator's web endpoints can be configured to support such scenarios. +If you use Spring MVC or Spring WebFlux, you can configure Actuator's web endpoints to support such scenarios. -CORS support is disabled by default and is only enabled once the configprop:management.endpoints.web.cors.allowed-origins[] property has been set. +CORS support is disabled by default and is only enabled once you have set the configprop:management.endpoints.web.cors.allowed-origins[] property. The following configuration permits `GET` and `POST` calls from the `example.com` domain: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -429,15 +431,15 @@ The following configuration permits `GET` and `POST` calls from the `example.com allowed-methods: "GET,POST" ---- -TIP: See {spring-boot-actuator-autoconfigure-module-code}/endpoint/web/CorsEndpointProperties.java[CorsEndpointProperties] for a complete list of options. +TIP: See {spring-boot-actuator-autoconfigure-module-code}/endpoint/web/CorsEndpointProperties.java[`CorsEndpointProperties`] for a complete list of options. [[actuator.endpoints.implementing-custom]] === Implementing Custom Endpoints If you add a `@Bean` annotated with `@Endpoint`, any methods annotated with `@ReadOperation`, `@WriteOperation`, or `@DeleteOperation` are automatically exposed over JMX and, in a web application, over HTTP as well. -Endpoints can be exposed over HTTP using Jersey, Spring MVC, or Spring WebFlux. -If both Jersey and Spring MVC are available, Spring MVC will be used. +Endpoints can be exposed over HTTP by using Jersey, Spring MVC, or Spring WebFlux. +If both Jersey and Spring MVC are available, Spring MVC is used. The following example exposes a read operation that returns a custom object: @@ -459,13 +461,13 @@ Finally, if you need access to web-framework-specific functionality, you can imp [[actuator.endpoints.implementing-custom.input]] ==== Receiving Input -Operations on an endpoint receive input via their parameters. -When exposed via the web, the values for these parameters are taken from the URL's query parameters and from the JSON request body. -When exposed via JMX, the parameters are mapped to the parameters of the MBean's operations. +Operations on an endpoint receive input through their parameters. +When exposed over the web, the values for these parameters are taken from the URL's query parameters and from the JSON request body. +When exposed over JMX, the parameters are mapped to the parameters of the MBean's operations. Parameters are required by default. They can be made optional by annotating them with either `@javax.annotation.Nullable` or `@org.springframework.lang.Nullable`. -Each root property in the JSON request body can be mapped to a parameter of the endpoint. +You can map each root property in the JSON request body to a parameter of the endpoint. Consider the following JSON request body: [source,json,indent=0,subs="verbatim"] @@ -476,7 +478,7 @@ Consider the following JSON request body: } ---- -This can be used to invoke a write operation that takes `String name` and `int counter` parameters, as shown in the following example: +You can use this to invoke a write operation that takes `String name` and `int counter` parameters, as the following example shows: [source,java,indent=0,subs="verbatim"] ---- @@ -484,24 +486,24 @@ include::{docs-java}/actuator/endpoints/implementingcustom/MyEndpoint.java[tag=w ---- TIP: Because endpoints are technology agnostic, only simple types can be specified in the method signature. -In particular declaring a single parameter with a `CustomData` type defining a `name` and `counter` properties is not supported. +In particular, declaring a single parameter with a `CustomData` type that defines a `name` and `counter` properties is not supported. -NOTE: To allow the input to be mapped to the operation method's parameters, Java code implementing an endpoint should be compiled with `-parameters`, and Kotlin code implementing an endpoint should be compiled with `-java-parameters`. -This will happen automatically if you are using Spring Boot's Gradle plugin or if you are using Maven and `spring-boot-starter-parent`. +NOTE: To let the input be mapped to the operation method's parameters, Java code that implements an endpoint should be compiled with `-parameters`, and Kotlin code that implements an endpoint should be compiled with `-java-parameters`. +This will happen automatically if you use Spring Boot's Gradle plugin or if you use Maven and `spring-boot-starter-parent`. [[actuator.endpoints.implementing-custom.input.conversion]] ===== Input Type Conversion The parameters passed to endpoint operation methods are, if necessary, automatically converted to the required type. -Before calling an operation method, the input received via JMX or an HTTP request is converted to the required types using an instance of `ApplicationConversionService` as well as any `Converter` or `GenericConverter` beans qualified with `@EndpointConverter`. +Before calling an operation method, the input received over JMX or HTTP is converted to the required types by using an instance of `ApplicationConversionService` as well as any `Converter` or `GenericConverter` beans qualified with `@EndpointConverter`. [[actuator.endpoints.implementing-custom.web]] ==== Custom Web Endpoints Operations on an `@Endpoint`, `@WebEndpoint`, or `@EndpointWebExtension` are automatically exposed over HTTP using Jersey, Spring MVC, or Spring WebFlux. -If both Jersey and Spring MVC are available, Spring MVC will be used. +If both Jersey and Spring MVC are available, Spring MVC is used. @@ -513,14 +515,14 @@ A request predicate is automatically generated for each operation on a web-expos [[actuator.endpoints.implementing-custom.web.path-predicates]] ===== Path -The path of the predicate is determined by the ID of the endpoint and the base path of web-exposed endpoints. +The path of the predicate is determined by the ID of the endpoint and the base path of the web-exposed endpoints. The default base path is `/actuator`. -For example, an endpoint with the ID `sessions` will use `/actuator/sessions` as its path in the predicate. +For example, an endpoint with an ID of `sessions` uses `/actuator/sessions` as its path in the predicate. -The path can be further customized by annotating one or more parameters of the operation method with `@Selector`. +You can further customize the path by annotating one or more parameters of the operation method with `@Selector`. Such a parameter is added to the path predicate as a path variable. The variable's value is passed into the operation method when the endpoint operation is invoked. -If you want to capture all remaining path elements, you can add `@Selector(Match=ALL_REMAINING)` to the last parameter and make it a type that is conversion compatible with a `String[]`. +If you want to capture all remaining path elements, you can add `@Selector(Match=ALL_REMAINING)` to the last parameter and make it a type that is conversion-compatible with a `String[]`. @@ -546,20 +548,20 @@ The HTTP method of the predicate is determined by the operation type, as shown i [[actuator.endpoints.implementing-custom.web.consumes-predicates]] ===== Consumes -For a `@WriteOperation` (HTTP `POST`) that uses the request body, the consumes clause of the predicate is `application/vnd.spring-boot.actuator.v2+json, application/json`. -For all other operations the consumes clause is empty. +For a `@WriteOperation` (HTTP `POST`) that uses the request body, the `consumes` clause of the predicate is `application/vnd.spring-boot.actuator.v2+json, application/json`. +For all other operations, the `consumes` clause is empty. [[actuator.endpoints.implementing-custom.web.produces-predicates]] ===== Produces -The produces clause of the predicate can be determined by the `produces` attribute of the `@DeleteOperation`, `@ReadOperation`, and `@WriteOperation` annotations. +The `produces` clause of the predicate can be determined by the `produces` attribute of the `@DeleteOperation`, `@ReadOperation`, and `@WriteOperation` annotations. The attribute is optional. -If it is not used, the produces clause is determined automatically. +If it is not used, the `produces` clause is determined automatically. -If the operation method returns `void` or `Void` the produces clause is empty. -If the operation method returns a `org.springframework.core.io.Resource`, the produces clause is `application/octet-stream`. -For all other operations the produces clause is `application/vnd.spring-boot.actuator.v2+json, application/json`. +If the operation method returns `void` or `Void`, the `produces` clause is empty. +If the operation method returns a `org.springframework.core.io.Resource`, the `produces` clause is `application/octet-stream`. +For all other operations, the `produces` clause is `application/vnd.spring-boot.actuator.v2+json, application/json`. @@ -567,19 +569,19 @@ For all other operations the produces clause is `application/vnd.spring-boot.act ===== Web Endpoint Response Status The default response status for an endpoint operation depends on the operation type (read, write, or delete) and what, if anything, the operation returns. -A `@ReadOperation` returns a value, the response status will be 200 (OK). +If a `@ReadOperation` returns a value, the response status will be 200 (OK). If it does not return a value, the response status will be 404 (Not Found). If a `@WriteOperation` or `@DeleteOperation` returns a value, the response status will be 200 (OK). -If it does not return a value the response status will be 204 (No Content). +If it does not return a value, the response status will be 204 (No Content). -If an operation is invoked without a required parameter, or with a parameter that cannot be converted to the required type, the operation method will not be called and the response status will be 400 (Bad Request). +If an operation is invoked without a required parameter or with a parameter that cannot be converted to the required type, the operation method is not called, and the response status will be 400 (Bad Request). [[actuator.endpoints.implementing-custom.web.range-requests]] ===== Web Endpoint Range Requests -An HTTP range request can be used to request part of an HTTP resource. +You can use an HTTP range request to request part of an HTTP resource. When using Spring MVC or Spring Web Flux, operations that return a `org.springframework.core.io.Resource` automatically support range requests. NOTE: Range requests are not supported when using Jersey. @@ -590,14 +592,14 @@ NOTE: Range requests are not supported when using Jersey. ===== Web Endpoint Security An operation on a web endpoint or a web-specific endpoint extension can receive the current `java.security.Principal` or `org.springframework.boot.actuate.endpoint.SecurityContext` as a method parameter. The former is typically used in conjunction with `@Nullable` to provide different behavior for authenticated and unauthenticated users. -The latter is typically used to perform authorization checks using its `isUserInRole(String)` method. +The latter is typically used to perform authorization checks by using its `isUserInRole(String)` method. [[actuator.endpoints.implementing-custom.servlet]] ==== Servlet Endpoints A `Servlet` can be exposed as an endpoint by implementing a class annotated with `@ServletEndpoint` that also implements `Supplier`. -Servlet endpoints provide deeper integration with the Servlet container but at the expense of portability. +Servlet endpoints provide deeper integration with the servlet container but at the expense of portability. They are intended to be used to expose an existing `Servlet` as an endpoint. For new endpoints, the `@Endpoint` and `@WebEndpoint` annotations should be preferred whenever possible. @@ -605,8 +607,8 @@ For new endpoints, the `@Endpoint` and `@WebEndpoint` annotations should be pref [[actuator.endpoints.implementing-custom.controller]] ==== Controller Endpoints -`@ControllerEndpoint` and `@RestControllerEndpoint` can be used to implement an endpoint that is only exposed by Spring MVC or Spring WebFlux. -Methods are mapped using the standard annotations for Spring MVC and Spring WebFlux such as `@RequestMapping` and `@GetMapping`, with the endpoint's ID being used as a prefix for the path. +You can use `@ControllerEndpoint` and `@RestControllerEndpoint` to implement an endpoint that is exposed only by Spring MVC or Spring WebFlux. +Methods are mapped by using the standard annotations for Spring MVC and Spring WebFlux, such as `@RequestMapping` and `@GetMapping`, with the endpoint's ID being used as a prefix for the path. Controller endpoints provide deeper integration with Spring's web frameworks but at the expense of portability. The `@Endpoint` and `@WebEndpoint` annotations should be preferred whenever possible. @@ -616,7 +618,7 @@ The `@Endpoint` and `@WebEndpoint` annotations should be preferred whenever poss === Health Information You can use health information to check the status of your running application. It is often used by monitoring software to alert someone when a production system goes down. -The information exposed by the `health` endpoint depends on the configprop:management.endpoint.health.show-details[] and configprop:management.endpoint.health.show-components[] properties which can be configured with one of the following values: +The information exposed by the `health` endpoint depends on the configprop:management.endpoint.health.show-details[] and configprop:management.endpoint.health.show-components[] properties, which can be configured with one of the following values: [cols="1, 3"] |=== @@ -626,8 +628,8 @@ The information exposed by the `health` endpoint depends on the configprop:manag | Details are never shown. | `when-authorized` -| Details are only shown to authorized users. - Authorized roles can be configured using `management.endpoint.health.roles`. +| Details are shown only to authorized users. + Authorized roles can be configured by using `management.endpoint.health.roles`. | `always` | Details are shown to all users. @@ -635,32 +637,32 @@ The information exposed by the `health` endpoint depends on the configprop:manag The default value is `never`. A user is considered to be authorized when they are in one or more of the endpoint's roles. -If the endpoint has no configured roles (the default) all authenticated users are considered to be authorized. -The roles can be configured using the configprop:management.endpoint.health.roles[] property. +If the endpoint has no configured roles (the default), all authenticated users are considered to be authorized. +You can configure the roles by using the configprop:management.endpoint.health.roles[] property. NOTE: If you have secured your application and wish to use `always`, your security configuration must permit access to the health endpoint for both authenticated and unauthenticated users. -Health information is collected from the content of a {spring-boot-actuator-module-code}/health/HealthContributorRegistry.java[`HealthContributorRegistry`] (by default all {spring-boot-actuator-module-code}/health/HealthContributor.java[`HealthContributor`] instances defined in your `ApplicationContext`). -Spring Boot includes a number of auto-configured `HealthContributors` and you can also write your own. +Health information is collected from the content of a {spring-boot-actuator-module-code}/health/HealthContributorRegistry.java[`HealthContributorRegistry`] (by default, all {spring-boot-actuator-module-code}/health/HealthContributor.java[`HealthContributor`] instances defined in your `ApplicationContext`). +Spring Boot includes a number of auto-configured `HealthContributors`, and you can also write your own. -A `HealthContributor` can either be a `HealthIndicator` or a `CompositeHealthContributor`. +A `HealthContributor` can be either a `HealthIndicator` or a `CompositeHealthContributor`. A `HealthIndicator` provides actual health information, including a `Status`. A `CompositeHealthContributor` provides a composite of other `HealthContributors`. Taken together, contributors form a tree structure to represent the overall system health. -By default, the final system health is derived by a `StatusAggregator` which sorts the statuses from each `HealthIndicator` based on an ordered list of statuses. +By default, the final system health is derived by a `StatusAggregator`, which sorts the statuses from each `HealthIndicator` based on an ordered list of statuses. The first status in the sorted list is used as the overall health status. If no `HealthIndicator` returns a status that is known to the `StatusAggregator`, an `UNKNOWN` status is used. -TIP: The `HealthContributorRegistry` can be used to register and unregister health indicators at runtime. +TIP: You can use the `HealthContributorRegistry` to register and unregister health indicators at runtime. [[actuator.endpoints.health.auto-configured-health-indicators]] ==== Auto-configured HealthIndicators -The following `HealthIndicators` are auto-configured by Spring Boot when appropriate. -You can also enable/disable selected indicators by configuring `management.health.key.enabled`, -with the `key` listed in the table below. +When appropriate, Spring Boot auto-configures the `HealthIndicators` listed in the following table. +You can also enable or disable selected indicators by configuring `management.health.key.enabled`, +with the `key` listed in the following table: [cols="2,4,6"] |=== @@ -733,7 +735,7 @@ with the `key` listed in the table below. TIP: You can disable them all by setting the configprop:management.health.defaults.enabled[] property. -Additional `HealthIndicators` are available but not enabled by default: +Additional `HealthIndicators` are available but are not enabled by default: [cols="3,4,6"] |=== @@ -741,11 +743,11 @@ Additional `HealthIndicators` are available but not enabled by default: | `livenessstate` | {spring-boot-actuator-module-code}/availability/LivenessStateHealthIndicator.java[`LivenessStateHealthIndicator`] -| Exposes the "Liveness" application availability state. +| Exposes the "`Liveness`" application availability state. | `readinessstate` | {spring-boot-actuator-module-code}/availability/ReadinessStateHealthIndicator.java[`ReadinessStateHealthIndicator`] -| Exposes the "Readiness" application availability state. +| Exposes the "`Readiness`" application availability state. |=== @@ -765,10 +767,10 @@ include::{docs-java}/actuator/endpoints/health/writingcustomhealthindicators/MyH NOTE: The identifier for a given `HealthIndicator` is the name of the bean without the `HealthIndicator` suffix, if it exists. In the preceding example, the health information is available in an entry named `my`. -In addition to Spring Boot's predefined {spring-boot-actuator-module-code}/health/Status.java[`Status`] types, it is also possible for `Health` to return a custom `Status` that represents a new system state. -In such cases, a custom implementation of the {spring-boot-actuator-module-code}/health/StatusAggregator.java[`StatusAggregator`] interface also needs to be provided, or the default implementation has to be configured by using the configprop:management.endpoint.health.status.order[] configuration property. +In addition to Spring Boot's predefined {spring-boot-actuator-module-code}/health/Status.java[`Status`] types, `Health` can return a custom `Status` that represents a new system state. +In such cases, you also need to provide a custom implementation of the {spring-boot-actuator-module-code}/health/StatusAggregator.java[`StatusAggregator`] interface, or you must configure the default implementation by using the configprop:management.endpoint.health.status.order[] configuration property. -For example, assume a new `Status` with code `FATAL` is being used in one of your `HealthIndicator` implementations. +For example, assume a new `Status` with a code of `FATAL` is being used in one of your `HealthIndicator` implementations. To configure the severity order, add the following property to your application properties: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -785,7 +787,7 @@ By default, `OUT_OF_SERVICE` and `DOWN` map to 503. Any unmapped health statuses, including `UP`, map to 200. You might also want to register custom status mappings if you access the health endpoint over HTTP. Configuring a custom mapping disables the defaults mappings for `DOWN` and `OUT_OF_SERVICE`. -If you want to retain the default mappings they must be configured explicitly alongside any custom mappings. +If you want to retain the default mappings, you must explicitly configure them, alongside any custom mappings. For example, the following property maps `FATAL` to 503 (service unavailable) and retains the default mappings for `DOWN` and `OUT_OF_SERVICE`: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -825,12 +827,12 @@ The following table shows the default status mappings for the built-in statuses: [[actuator.endpoints.health.reactive-health-indicators]] ==== Reactive Health Indicators -For reactive applications, such as those using Spring WebFlux, `ReactiveHealthContributor` provides a non-blocking contract for getting application health. -Similar to a traditional `HealthContributor`, health information is collected from the content of a {spring-boot-actuator-module-code}/health/ReactiveHealthContributorRegistry.java[`ReactiveHealthContributorRegistry`] (by default all {spring-boot-actuator-module-code}/health/HealthContributor.java[`HealthContributor`] and {spring-boot-actuator-module-code}/health/ReactiveHealthContributor.java[`ReactiveHealthContributor`] instances defined in your `ApplicationContext`). +For reactive applications, such as those that use Spring WebFlux, `ReactiveHealthContributor` provides a non-blocking contract for getting application health. +Similar to a traditional `HealthContributor`, health information is collected from the content of a {spring-boot-actuator-module-code}/health/ReactiveHealthContributorRegistry.java[`ReactiveHealthContributorRegistry`] (by default, all {spring-boot-actuator-module-code}/health/HealthContributor.java[`HealthContributor`] and {spring-boot-actuator-module-code}/health/ReactiveHealthContributor.java[`ReactiveHealthContributor`] instances defined in your `ApplicationContext`). Regular `HealthContributors` that do not check against a reactive API are executed on the elastic scheduler. -TIP: In a reactive application, The `ReactiveHealthContributorRegistry` should be used to register and unregister health indicators at runtime. -If you need to register a regular `HealthContributor`, you should wrap it using `ReactiveHealthContributor#adapt`. +TIP: In a reactive application, you should use the `ReactiveHealthContributorRegistry` to register and unregister health indicators at runtime. +If you need to register a regular `HealthContributor`, you should wrap it with `ReactiveHealthContributor#adapt`. To provide custom health information from a reactive API, you can register Spring beans that implement the {spring-boot-actuator-module-code}/health/ReactiveHealthIndicator.java[`ReactiveHealthIndicator`] interface. The following code shows a sample `ReactiveHealthIndicator` implementation: @@ -846,7 +848,7 @@ TIP: To handle the error automatically, consider extending from `AbstractReactiv [[actuator.endpoints.health.auto-configured-reactive-health-indicators]] ==== Auto-configured ReactiveHealthIndicators -The following `ReactiveHealthIndicators` are auto-configured by Spring Boot when appropriate: +When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndicators`: [cols="2,4,6"] |=== @@ -884,9 +886,9 @@ Also, any `HealthIndicator` that is not handled explicitly is wrapped automatica [[actuator.endpoints.health.groups]] ==== Health Groups -It's sometimes useful to organize health indicators into groups that can be used for different purposes. +It is sometimes useful to organize health indicators into groups that you can use for different purposes. -To create a health indicator group you can use the `management.endpoint.health.group.` property and specify a list of health indicator IDs to `include` or `exclude`. +To create a health indicator group, you can use the `management.endpoint.health.group.` property and specify a list of health indicator IDs to `include` or `exclude`. For example, to create a group that includes only database indicators you can define the following: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -913,8 +915,9 @@ Similarly, to create a group that excludes the database indicators from the grou exclude: "db" ---- -By default groups will inherit the same `StatusAggregator` and `HttpCodeStatusMapper` settings as the system health, however, these can also be defined on a per-group basis. -It's also possible to override the `show-details` and `roles` properties if required: +By default, groups inherit the same `StatusAggregator` and `HttpCodeStatusMapper` settings as the system health. +However, you can also define these on a per-group basis. +You can also override the `show-details` and `roles` properties if required: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -966,9 +969,9 @@ The path must be a single path segment. [[actuator.endpoints.health.datasource]] ==== DataSource Health -The `DataSource` health indicator shows the health of both standard data source and routing data source beans. +The `DataSource` health indicator shows the health of both standard data sources and routing data source beans. The health of a routing data source includes the health of each of its target data sources. -In the health endpoint's response, each of a routing data source's targets is named using its routing key. +In the health endpoint's response, each of a routing data source's targets is named by using its routing key. If you prefer not to include routing data sources in the indicator's output, set configprop:management.health.db.ignore-routing-data-sources[] to `true`. @@ -976,12 +979,12 @@ If you prefer not to include routing data sources in the indicator's output, set [[actuator.endpoints.kubernetes-probes]] === Kubernetes Probes Applications deployed on Kubernetes can provide information about their internal state with https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes[Container Probes]. -Depending on https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/[your Kubernetes configuration], the kubelet will call those probes and react to the result. +Depending on https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/[your Kubernetes configuration], the kubelet calls those probes and reacts to the result. -Spring Boot manages your <> out-of-the-box. -If deployed in a Kubernetes environment, actuator will gather the "Liveness" and "Readiness" information from the `ApplicationAvailability` interface and use that information in dedicated <>: `LivenessStateHealthIndicator` and `ReadinessStateHealthIndicator`. -These indicators will be shown on the global health endpoint (`"/actuator/health"`). -They will also be exposed as separate HTTP Probes using <>: `"/actuator/health/liveness"` and `"/actuator/health/readiness"`. +By default, Spring Boot manages your <>. +If deployed in a Kubernetes environment, actuator gathers the "`Liveness`" and "`Readiness`" information from the `ApplicationAvailability` interface and uses that information in dedicated <>: `LivenessStateHealthIndicator` and `ReadinessStateHealthIndicator`. +These indicators are shown on the global health endpoint (`"/actuator/health"`). +They are also exposed as separate HTTP Probes by using <>: `"/actuator/health/liveness"` and `"/actuator/health/readiness"`. You can then configure your Kubernetes infrastructure with the following endpoint information: @@ -1003,13 +1006,13 @@ readinessProbe: ---- NOTE: `` should be set to the port that the actuator endpoints are available on. -It could be the main web server port, or a separate management port if the `"management.server.port"` property has been set. +It could be the main web server port or a separate management port if the `"management.server.port"` property has been set. -These health groups are only enabled automatically if the application is <>. -You can enable them in any environment using the configprop:management.endpoint.health.probes.enabled[] configuration property. +These health groups are automatically enabled only if the application <>. +You can enable them in any environment by using the configprop:management.endpoint.health.probes.enabled[] configuration property. -NOTE: If an application takes longer to start than the configured liveness period, Kubernetes mention the `"startupProbe"` as a possible solution. -The `"startupProbe"` is not necessarily needed here as the `"readinessProbe"` fails until all startup tasks are done, see <>. +NOTE: If an application takes longer to start than the configured liveness period, Kubernetes mentions the `"startupProbe"` as a possible solution. +The `"startupProbe"` is not necessarily needed here, as the `"readinessProbe"` fails until all startup tasks are done. See the section that describes <>. If your Actuator endpoints are deployed on a separate management context, the endpoints do not use the same web infrastructure (port, connection pools, framework components) as the main application. In this case, a probe check could be successful even if the main application does not work properly (for example, it cannot accept new connections). @@ -1028,7 +1031,8 @@ This would make `liveness` available at `/livez` and `readiness` at `readyz` on [[actuator.endpoints.kubernetes-probes.external-state]] ==== Checking External State with Kubernetes Probes -Actuator configures the "liveness" and "readiness" probes as Health Groups; this means that all the <> are available for them. +Actuator configures the "`liveness`" and "`readiness`" probes as Health Groups. +This means that all the <> are available for them. You can, for example, configure additional Health Indicators: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -1041,36 +1045,38 @@ You can, for example, configure additional Health Indicators: include: "readinessState,customCheck" ---- -By default, Spring Boot does not add other Health Indicators to these groups. +By default, Spring Boot does not add other health indicators to these groups. -The "`liveness`" Probe should not depend on health checks for external systems. -If the <> is broken, Kubernetes will try to solve that problem by restarting the application instance. -This means that if an external system fails (e.g. a database, a Web API, an external cache), Kubernetes might restart all application instances and create cascading failures. +The "`liveness`" probe should not depend on health checks for external systems. +If the <> is broken, Kubernetes tries to solve that problem by restarting the application instance. +This means that if an external system (such as a database, a Web API, or an external cache) fails, Kubernetes might restart all application instances and create cascading failures. -As for the "`readiness`" Probe, the choice of checking external systems must be made carefully by the application developers, i.e. Spring Boot does not include any additional health checks in the readiness probe. -If the <> is unready, Kubernetes will not route traffic to that instance. -Some external systems might not be shared by application instances, in which case they could quite naturally be included in a readiness probe. +As for the "`readiness`" probe, the choice of checking external systems must be made carefully by the application developers. +For this reason, Spring Boot does not include any additional health checks in the readiness probe. +If the <> is unready, Kubernetes does not route traffic to that instance. +Some external systems might not be shared by application instances, in which case they could be included in a readiness probe. Other external systems might not be essential to the application (the application could have circuit breakers and fallbacks), in which case they definitely should not be included. -Unfortunately, an external system that is shared by all application instances is common, and you have to make a judgement call: include it in the readiness probe and expect that the application is taken out of service when the external service is down, or leave it out and deal with failures higher up the stack, e.g. using a circuit breaker in the caller. +Unfortunately, an external system that is shared by all application instances is common, and you have to make a judgement call: Include it in the readiness probe and expect that the application is taken out of service when the external service is down or leave it out and deal with failures higher up the stack, perhaps by using a circuit breaker in the caller. -NOTE: If all instances of an application are unready, a Kubernetes Service with `type=ClusterIP` or `NodePort` will not accept any incoming connections. -There is no HTTP error response (503 etc.) since there is no connection. -A Service with `type=LoadBalancer` might or might not accept connections, depending on the provider. -A Service that has an explicit https://kubernetes.io/docs/concepts/services-networking/ingress/[Ingress] will also respond in a way that depends on the implementation - the ingress service itself will have to decide how to handle the "connection refused" from downstream. +NOTE: If all instances of an application are unready, a Kubernetes Service with `type=ClusterIP` or `NodePort` does not accept any incoming connections. +There is no HTTP error response (503 and so on), since there is no connection. +A service with `type=LoadBalancer` might or might not accept connections, depending on the provider. +A service that has an explicit https://kubernetes.io/docs/concepts/services-networking/ingress/[ingress] also responds in a way that depends on the implementation -- the ingress service itself has to decide how to handle the "`connection refused`" from downstream. HTTP 503 is quite likely in the case of both load balancer and ingress. -Also, if an application is using Kubernetes https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/[autoscaling] it may react differently to applications being taken out of the load-balancer, depending on its autoscaler configuration. +Also, if an application uses Kubernetes https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/[autoscaling], it may react differently to applications being taken out of the load-balancer, depending on its autoscaler configuration. [[actuator.endpoints.kubernetes-probes.lifecycle]] ==== Application Lifecycle and Probe States An important aspect of the Kubernetes Probes support is its consistency with the application lifecycle. -There is a significant difference between the `AvailabilityState` which is the in-memory, internal state of the application -and the actual Probe which exposes that state: depending on the phase of application lifecycle, the Probe might not be available. +There is a significant difference between the `AvailabilityState` (which is the in-memory, internal state of the application) +and the actual probe (which exposes that state). +Depending on the phase of application lifecycle, the probe might not be available. -Spring Boot publishes <>, -and Probes can listen to such events and expose the `AvailabilityState` information. +Spring Boot publishes <>, +and probes can listen to such events and expose the `AvailabilityState` information. The following tables show the `AvailabilityState` and the state of HTTP connectors at different stages. @@ -1124,7 +1130,7 @@ When a Spring Boot application shuts down: |The application context is closed and the application is shut down. |=== -TIP: Check out the <> for more information about Kubernetes deployment. +TIP: See <> for more information about Kubernetes deployment. @@ -1137,7 +1143,7 @@ Spring Boot includes a number of auto-configured `InfoContributor` beans, and yo [[actuator.endpoints.info.auto-configured-info-contributors]] ==== Auto-configured InfoContributors -The following `InfoContributor` beans are auto-configured by Spring Boot, when appropriate: +When appropriate, Spring auto-configures the following `InfoContributor` beans: [cols="1,4"] |=== @@ -1153,7 +1159,7 @@ The following `InfoContributor` beans are auto-configured by Spring Boot, when a | Exposes build information if a `META-INF/build-info.properties` file is available. |=== -TIP: It is possible to disable them all by setting the configprop:management.info.defaults.enabled[] property. +TIP: You can disable them all by setting the configprop:management.info.defaults.enabled[] property. @@ -1195,13 +1201,13 @@ Assuming you use Maven, you could rewrite the preceding example as follows: [[actuator.endpoints.info.git-commit-information]] ==== Git Commit Information Another useful feature of the `info` endpoint is its ability to publish information about the state of your `git` source code repository when the project was built. -If a `GitProperties` bean is available, the `info` endpoint can be used to expose these properties. +If a `GitProperties` bean is available, you can use the `info` endpoint to expose these properties. TIP: A `GitProperties` bean is auto-configured if a `git.properties` file is available at the root of the classpath. -See "<>" for more details. +See "<>" for more detail. By default, the endpoint exposes `git.branch`, `git.commit.id`, and `git.commit.time` properties, if present. -If you don't want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file. +If you do not want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file. If you want to display the full git information (that is, the full content of `git.properties`), use the configprop:management.info.git.mode[] property, as follows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -1230,7 +1236,7 @@ If a `BuildProperties` bean is available, the `info` endpoint can also publish i This happens if a `META-INF/build-info.properties` file is available in the classpath. TIP: The Maven and Gradle plugins can both generate that file. -See "<>" for more details. +See "<>" for more details. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/jmx.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/jmx.adoc index f22e8b13b6..af4626e31c 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/jmx.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/jmx.adoc @@ -1,17 +1,18 @@ [[actuator.jmx]] == Monitoring and Management over JMX Java Management Extensions (JMX) provide a standard mechanism to monitor and manage applications. -By default, this feature is not enabled and can be turned on by setting the configuration property configprop:spring.jmx.enabled[] to `true`. +By default, this feature is not enabled. +You can turn it on by setting the configprop:spring.jmx.enabled[] configuration property to `true`. Spring Boot exposes the most suitable `MBeanServer` as a bean with an ID of `mbeanServer`. Any of your beans that are annotated with Spring JMX annotations (`@ManagedResource`, `@ManagedAttribute`, or `@ManagedOperation`) are exposed to it. -If your platform provides a standard `MBeanServer`, Spring Boot will use that and default to the VM `MBeanServer` if necessary. -If all that fails, a new `MBeanServer` will be created. +If your platform provides a standard `MBeanServer`, Spring Boot uses that and defaults to the VM `MBeanServer`, if necessary. +If all that fails, a new `MBeanServer` is created. See the {spring-boot-autoconfigure-module-code}/jmx/JmxAutoConfiguration.java[`JmxAutoConfiguration`] class for more details. -Spring Boot also exposes management endpoints as JMX MBeans under the `org.springframework.boot` domain by default. -To Take full control over endpoints registration in the JMX domain, consider registering your own `EndpointObjectNameFactory` implementation. +By default, Spring Boot also exposes management endpoints as JMX MBeans under the `org.springframework.boot` domain. +To take full control over endpoint registration in the JMX domain, consider registering your own `EndpointObjectNameFactory` implementation. @@ -41,7 +42,7 @@ The following settings show an example of doing so in `application.properties`: [[actuator.jmx.disable-jmx-endpoints]] === Disabling JMX Endpoints -If you do not want to expose endpoints over JMX, you can set the configprop:management.endpoints.jmx.exposure.exclude[] property to `*`, as shown in the following example: +If you do not want to expose endpoints over JMX, you can set the configprop:management.endpoints.jmx.exposure.exclude[] property to `*`, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -68,12 +69,12 @@ For example, with Maven, you would add the following dependency: ---- -The Jolokia endpoint can then be exposed by adding `jolokia` or `*` to the configprop:management.endpoints.web.exposure.include[] property. +You can then expose the Jolokia endpoint by adding `jolokia` or `*` to the configprop:management.endpoints.web.exposure.include[] property. You can then access it by using `/actuator/jolokia` on your management HTTP server. NOTE: The Jolokia endpoint exposes Jolokia's servlet as an actuator endpoint. -As a result, it is specific to servlet environments such as Spring MVC and Jersey. -The endpoint will not be available in a WebFlux application. +As a result, it is specific to servlet environments, such as Spring MVC and Jersey. +The endpoint is not available in a WebFlux application. @@ -81,7 +82,7 @@ The endpoint will not be available in a WebFlux application. ==== Customizing Jolokia Jolokia has a number of settings that you would traditionally configure by setting servlet parameters. With Spring Boot, you can use your `application.properties` file. -To do so, prefix the parameter with `management.endpoint.jolokia.config.`, as shown in the following example: +To do so, prefix the parameter with `management.endpoint.jolokia.config.`, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/loggers.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/loggers.adoc index 8ada3ab66d..816d5acd9c 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/loggers.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/loggers.adoc @@ -19,7 +19,7 @@ These levels can be one of: [[actuator.loggers.configure]] === Configure a Logger -To configure a given logger, `POST` a partial entity to the resource's URI, as shown in the following example: +To configure a given logger, `POST` a partial entity to the resource's URI, as the following example shows: [source,json,indent=0,subs="verbatim"] ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc index a0a1e6e6cc..8df74bba92 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc @@ -21,7 +21,7 @@ Spring Boot Actuator provides dependency management and auto-configuration for h - <> - <> -TIP: To learn more about Micrometer's capabilities, please refer to its https://micrometer.io/docs[reference documentation], in particular the {micrometer-concepts-docs}[concepts section]. +TIP: To learn more about Micrometer's capabilities, see its https://micrometer.io/docs[reference documentation], in particular the {micrometer-concepts-docs}[concepts section]. @@ -32,7 +32,7 @@ Having a dependency on `micrometer-registry-\{system}` in your runtime classpath Most registries share common features. For instance, you can disable a particular registry even if the Micrometer registry implementation is on the classpath. -For example, to disable Datadog: +The following example disables Datadog: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -43,7 +43,7 @@ For example, to disable Datadog: enabled: false ---- -You can also disable all registries unless stated otherwise by the registry-specific property, as shown in the following example: +You can also disable all registries unless stated otherwise by the registry-specific property, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -54,7 +54,7 @@ You can also disable all registries unless stated otherwise by the registry-spec enabled: false ---- -Spring Boot will also add any auto-configured registries to the global static composite registry on the `Metrics` class unless you explicitly tell it not to: +Spring Boot also adds any auto-configured registries to the global static composite registry on the `Metrics` class, unless you explicitly tell it not to: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -77,18 +77,19 @@ You can apply customizations to particular registry implementations by being mor include::{docs-java}/actuator/metrics/gettingstarted/specifictype/MyMeterRegistryConfiguration.java[] ---- -Spring Boot also <> that you can control via configuration or dedicated annotation markers. +Spring Boot also <> that you can control through configuration or dedicated annotation markers. [[actuator.metrics.export]] === Supported Monitoring Systems +This section briefly describes each of the supported monitoring systems. [[actuator.metrics.export.appoptics]] ==== AppOptics -By default, the AppOptics registry pushes metrics to `https://api.appoptics.com/v1/measurements` periodically. +By default, the AppOptics registry periodically pushes metrics to `https://api.appoptics.com/v1/measurements`. To export metrics to SaaS {micrometer-registry-docs}/appOptics[AppOptics], your API token must be provided: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -105,7 +106,7 @@ To export metrics to SaaS {micrometer-registry-docs}/appOptics[AppOptics], your [[actuator.metrics.export.atlas]] ==== Atlas By default, metrics are exported to {micrometer-registry-docs}/atlas[Atlas] running on your local machine. -The location of the https://github.com/Netflix/atlas[Atlas server] to use can be provided using: +You can provide the location of the https://github.com/Netflix/atlas[Atlas server]: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -120,8 +121,8 @@ The location of the https://github.com/Netflix/atlas[Atlas server] to use can be [[actuator.metrics.export.datadog]] ==== Datadog -Datadog registry pushes metrics to https://www.datadoghq.com[datadoghq] periodically. -To export metrics to {micrometer-registry-docs}/datadog[Datadog], your API key must be provided: +A Datadog registry periodically pushes metrics to https://www.datadoghq.com[datadoghq]. +To export metrics to {micrometer-registry-docs}/datadog[Datadog], you must provide your API key: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -148,26 +149,26 @@ You can also change the interval at which metrics are sent to Datadog: [[actuator.metrics.export.dynatrace]] ==== Dynatrace Dynatrace offers two metrics ingest APIs, both of which are implemented for {micrometer-registry-docs}/dynatrace[Micrometer]. -Config properties in the `v1` namespace only apply when exporting to the {dynatrace-help}/dynatrace-api/environment-api/metric-v1/[Timeseries v1 API]. -Config properties in the `v2` namespace only apply when exporting to the {dynatrace-help}/dynatrace-api/environment-api/metric-v2/post-ingest-metrics/[Metrics v2 API]. -Please note that this integration can only export to either the `v1` or `v2` version of the API at a time. -If the `device-id` (required for v1, but not used in v2) is set in the `v1` namespace, metrics will be exported to the `v1` endpoint. +Configuration properties in the `v1` namespace apply only when exporting to the {dynatrace-help}/dynatrace-api/environment-api/metric-v1/[Timeseries v1 API]. +Configuration properties in the `v2` namespace apply only when exporting to the {dynatrace-help}/dynatrace-api/environment-api/metric-v2/post-ingest-metrics/[Metrics v2 API]. +Note that this integration can export only to either the `v1` or `v2` version of the API at a time. +If the `device-id` (required for v1 but not used in v2) is set in the `v1` namespace, metrics are exported to the `v1` endpoint. Otherwise, `v2` is assumed. [[actuator.metrics.export.dynatrace.v2-api]] ===== v2 API -The v2 API can be used in two ways. +You can use the v2 API in two ways. -If a local OneAgent is running on the host, metrics will be automatically exported to the {dynatrace-help}/how-to-use-dynatrace/metrics/metric-ingestion/ingestion-methods/local-api/[local OneAgent ingest endpoint]. +If a local OneAgent is running on the host, metrics are automatically exported to the {dynatrace-help}/how-to-use-dynatrace/metrics/metric-ingestion/ingestion-methods/local-api/[local OneAgent ingest endpoint]. The ingest endpoint forwards the metrics to the Dynatrace backend. -This is the default behaviour and requires no special setup beyond a dependency on `io.micrometer:micrometer-registry-dynatrace`. +This is the default behavior and requires no special setup beyond a dependency on `io.micrometer:micrometer-registry-dynatrace`. If no local OneAgent is running, the endpoint of the {dynatrace-help}/dynatrace-api/environment-api/metric-v2/post-ingest-metrics/[Metrics v2 API] and an API token are required. -The {dynatrace-help}/dynatrace-api/basics/dynatrace-api-authentication/[API token] must have the "Ingest metrics" (`metrics.ingest`) permission set. -It is recommended to limit the scope of the token to this one permission. -Please ensure that the endpoint URI contains the path (e.g. `/api/v2/metrics/ingest`). +The {dynatrace-help}/dynatrace-api/basics/dynatrace-api-authentication/[API token] must have the "`Ingest metrics`" (`metrics.ingest`) permission set. +We recommend limiting the scope of the token to this one permission. +You must ensure that the endpoint URI contains the path (for example, `/api/v2/metrics/ingest`): [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -182,11 +183,10 @@ Please ensure that the endpoint URI contains the path (e.g. `/api/v2/metrics/ing When using the Dynatrace v2 API, the following optional features are available: -* Metric key prefix: sets a prefix that will be prepended to all exported metric keys. -* Enrich with Dynatrace metadata: if a OneAgent or Dynatrace operator is running, enrich metrics with additional metadata (e.g. about the host, process or pod). -* Default dimensions: specify key-value pairs that are added to all exported metrics. - If tags with the same key are specified using Micrometer, they overwrite the default dimensions. - +* Metric key prefix: Sets a prefix that is prepended to all exported metric keys. +* Enrich with Dynatrace metadata: If a OneAgent or Dynatrace operator is running, enrich metrics with additional metadata (for example, about the host, process, or pod). +* Default dimensions: Specify key-value pairs that are added to all exported metrics. + If tags with the same key are specified with Micrometer, they overwrite the default dimensions. [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -207,8 +207,8 @@ When using the Dynatrace v2 API, the following optional features are available: [[actuator.metrics.export.dynatrace.v1-api]] ===== v1 API (Legacy) -The Dynatrace v1 API metrics registry pushes metrics to the configured URI periodically using the {dynatrace-help}/dynatrace-api/environment-api/metric-v1/[Timeseries v1 API]. -For backwards-compatibility with existing setups, when `device-id` is set (required for v1, but not used in v2), metrics will be exported to the Timeseries v1 endpoint. +The Dynatrace v1 API metrics registry pushes metrics to the configured URI periodically by using the {dynatrace-help}/dynatrace-api/environment-api/metric-v1/[Timeseries v1 API]. +For backwards-compatibility with existing setups, when `device-id` is set (required for v1, but not used in v2), metrics are exported to the Timeseries v1 endpoint. To export metrics to {micrometer-registry-docs}/dynatrace[Dynatrace], your API token, device ID, and URI must be provided: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -224,7 +224,7 @@ To export metrics to {micrometer-registry-docs}/dynatrace[Dynatrace], your API t device-id: "YOUR_DEVICE_ID" ---- -For the v1 API, the base environment URI must be specified without a path as the v1 endpoint path will be added automatically. +For the v1 API, you must specify the base environment URI without a path, as the v1 endpoint path is added automatically. @@ -232,6 +232,7 @@ For the v1 API, the base environment URI must be specified without a path as the ===== Version-independent Settings In addition to the API endpoint and token, you can also change the interval at which metrics are sent to Dynatrace. The default export interval is `60s`. +The following example sets the export interval to 30 seconds: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -242,14 +243,14 @@ The default export interval is `60s`. step: "30s" ---- -More information on how to set up the Dynatrace exporter for Micrometer can be found in {micrometer-registry-docs}/dynatrace[the Micrometer documentation]. +You can find more information on how to set up the Dynatrace exporter for Micrometer in {micrometer-registry-docs}/dynatrace[the Micrometer documentation]. [[actuator.metrics.export.elastic]] ==== Elastic By default, metrics are exported to {micrometer-registry-docs}/elastic[Elastic] running on your local machine. -The location of the Elastic server to use can be provided using the following property: +You can provide the location of the Elastic server to use by using the following property: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -263,7 +264,7 @@ The location of the Elastic server to use can be provided using the following pr [[actuator.metrics.export.ganglia]] ==== Ganglia By default, metrics are exported to {micrometer-registry-docs}/ganglia[Ganglia] running on your local machine. -The http://ganglia.sourceforge.net[Ganglia server] host and port to use can be provided using: +You can provide the http://ganglia.sourceforge.net[Ganglia server] host and port, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -280,7 +281,7 @@ The http://ganglia.sourceforge.net[Ganglia server] host and port to use can be p [[actuator.metrics.export.graphite]] ==== Graphite By default, metrics are exported to {micrometer-registry-docs}/graphite[Graphite] running on your local machine. -The https://graphiteapp.org[Graphite server] host and port to use can be provided using: +You can provide the https://graphiteapp.org[Graphite server] host and port, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -292,22 +293,25 @@ The https://graphiteapp.org[Graphite server] host and port to use can be provide port: 9004 ---- -Micrometer provides a default `HierarchicalNameMapper` that governs how a dimensional meter id is {micrometer-registry-docs}/graphite#_hierarchical_name_mapping[mapped to flat hierarchical names]. +Micrometer provides a default `HierarchicalNameMapper` that governs how a dimensional meter ID is {micrometer-registry-docs}/graphite#_hierarchical_name_mapping[mapped to flat hierarchical names]. -TIP: To take control over this behavior, define your `GraphiteMeterRegistry` and supply your own `HierarchicalNameMapper`. +[TIP] +==== +To take control over this behavior, define your `GraphiteMeterRegistry` and supply your own `HierarchicalNameMapper`. An auto-configured `GraphiteConfig` and `Clock` beans are provided unless you define your own: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/metrics/export/graphite/MyGraphiteConfiguration.java[] ---- +==== [[actuator.metrics.export.humio]] ==== Humio -By default, the Humio registry pushes metrics to https://cloud.humio.com periodically. -To export metrics to SaaS {micrometer-registry-docs}/humio[Humio], your API token must be provided: +By default, the Humio registry periodically pushes metrics to https://cloud.humio.com. +To export metrics to SaaS {micrometer-registry-docs}/humio[Humio], you must provide your API token: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -318,7 +322,7 @@ To export metrics to SaaS {micrometer-registry-docs}/humio[Humio], your API toke api-token: "YOUR_TOKEN" ---- -You should also configure one or more tags to identify the data source to which metrics will be pushed: +You should also configure one or more tags to identify the data source to which metrics are pushed: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -337,7 +341,7 @@ You should also configure one or more tags to identify the data source to which ==== Influx By default, metrics are exported to an {micrometer-registry-docs}/influx[Influx] v1 instance running on your local machine with the default configuration. To export metrics to InfluxDB v2, configure the `org`, `bucket`, and authentication `token` for writing metrics. -The location of the https://www.influxdata.com[Influx server] to use can be provided using: +You can provide the location of the https://www.influxdata.com[Influx server] to use by using: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -354,7 +358,7 @@ The location of the https://www.influxdata.com[Influx server] to use can be prov ==== JMX Micrometer provides a hierarchical mapping to {micrometer-registry-docs}/jmx[JMX], primarily as a cheap and portable way to view metrics locally. By default, metrics are exported to the `metrics` JMX domain. -The domain to use can be provided using: +You can provide the domain to use by using: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -365,22 +369,25 @@ The domain to use can be provided using: domain: "com.example.app.metrics" ---- -Micrometer provides a default `HierarchicalNameMapper` that governs how a dimensional meter id is {micrometer-registry-docs}/jmx#_hierarchical_name_mapping[mapped to flat hierarchical names]. +Micrometer provides a default `HierarchicalNameMapper` that governs how a dimensional meter ID is {micrometer-registry-docs}/jmx#_hierarchical_name_mapping[mapped to flat hierarchical names]. -TIP: To take control over this behavior, define your `JmxMeterRegistry` and supply your own `HierarchicalNameMapper`. +[TIP] +==== +To take control over this behavior, define your `JmxMeterRegistry` and supply your own `HierarchicalNameMapper`. An auto-configured `JmxConfig` and `Clock` beans are provided unless you define your own: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/metrics/export/jmx/MyJmxConfiguration.java[] ---- +==== [[actuator.metrics.export.kairos]] ==== KairosDB By default, metrics are exported to {micrometer-registry-docs}/kairos[KairosDB] running on your local machine. -The location of the https://kairosdb.github.io/[KairosDB server] to use can be provided using: +You can provide the location of the https://kairosdb.github.io/[KairosDB server] to use by using: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -395,8 +402,8 @@ The location of the https://kairosdb.github.io/[KairosDB server] to use can be p [[actuator.metrics.export.newrelic]] ==== New Relic -New Relic registry pushes metrics to {micrometer-registry-docs}/new-relic[New Relic] periodically. -To export metrics to https://newrelic.com[New Relic], your API key and account id must be provided: +A New Relic registry periodically pushes metrics to {micrometer-registry-docs}/new-relic[New Relic]. +To export metrics to https://newrelic.com[New Relic], you must provide your API key and account ID: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -419,7 +426,7 @@ You can also change the interval at which metrics are sent to New Relic: step: "30s" ---- -By default, metrics are published via REST calls but it is also possible to use the Java Agent API if you have it on the classpath: +By default, metrics are published through REST calls, but you can also use the Java Agent API if you have it on the classpath: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -436,12 +443,12 @@ Finally, you can take full control by defining your own `NewRelicClientProvider` [[actuator.metrics.export.prometheus]] ==== Prometheus -{micrometer-registry-docs}/prometheus[Prometheus] expects to scrape or poll individual app instances for metrics. -Spring Boot provides an actuator endpoint available at `/actuator/prometheus` to present a https://prometheus.io[Prometheus scrape] with the appropriate format. +{micrometer-registry-docs}/prometheus[Prometheus] expects to scrape or poll individual application instances for metrics. +Spring Boot provides an actuator endpoint at `/actuator/prometheus` to present a https://prometheus.io[Prometheus scrape] with the appropriate format. -TIP: The endpoint is not available by default and must be exposed, see <> for more details. +TIP: By default, the endpoint is not available and must be exposed. See <> for more details. -Here is an example `scrape_config` to add to `prometheus.yml`: +The following example `scrape_config` adds to `prometheus.yml`: [source,yaml,indent=0,subs="verbatim"] ---- @@ -452,7 +459,7 @@ Here is an example `scrape_config` to add to `prometheus.yml`: - targets: ['HOST:PORT'] ---- -For ephemeral or batch jobs which may not exist long enough to be scraped, https://github.com/prometheus/pushgateway[Prometheus Pushgateway] support can be used to expose their metrics to Prometheus. +For ephemeral or batch jobs that may not exist long enough to be scraped, you can use https://github.com/prometheus/pushgateway[Prometheus Pushgateway] support to expose the metrics to Prometheus. To enable Prometheus Pushgateway support, add the following dependency to your project: [source,xml,indent=0,subs="verbatim"] @@ -466,15 +473,15 @@ To enable Prometheus Pushgateway support, add the following dependency to your p When the Prometheus Pushgateway dependency is present on the classpath and the configprop:management.metrics.export.prometheus.pushgateway.enabled[] property is set to `true`, a `PrometheusPushGatewayManager` bean is auto-configured. This manages the pushing of metrics to a Prometheus Pushgateway. -The `PrometheusPushGatewayManager` can be tuned using properties under `management.metrics.export.prometheus.pushgateway`. +You can tune the `PrometheusPushGatewayManager` by using properties under `management.metrics.export.prometheus.pushgateway`. For advanced configuration, you can also provide your own `PrometheusPushGatewayManager` bean. [[actuator.metrics.export.signalfx]] ==== SignalFx -SignalFx registry pushes metrics to {micrometer-registry-docs}/signalFx[SignalFx] periodically. -To export metrics to https://www.signalfx.com[SignalFx], your access token must be provided: +SignalFx registry periodically pushes metrics to {micrometer-registry-docs}/signalFx[SignalFx]. +To export metrics to https://www.signalfx.com[SignalFx], you must provide your access token: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -501,9 +508,9 @@ You can also change the interval at which metrics are sent to SignalFx: [[actuator.metrics.export.simple]] ==== Simple Micrometer ships with a simple, in-memory backend that is automatically used as a fallback if no other registry is configured. -This allows you to see what metrics are collected in the <>. +This lets you see what metrics are collected in the <>. -The in-memory backend disables itself as soon as you're using any of the other available backend. +The in-memory backend disables itself as soon as you use any other available backend. You can also disable it explicitly: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] @@ -519,8 +526,8 @@ You can also disable it explicitly: [[actuator.metrics.export.stackdriver]] ==== Stackdriver -Stackdriver registry pushes metrics to https://cloud.google.com/stackdriver/[Stackdriver] periodically. -To export metrics to SaaS {micrometer-registry-docs}/stackdriver[Stackdriver], your Google Cloud project id must be provided: +The Stackdriver registry periodically pushes metrics to https://cloud.google.com/stackdriver/[Stackdriver]. +To export metrics to SaaS {micrometer-registry-docs}/stackdriver[Stackdriver], you must provide your Google Cloud project ID: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -546,9 +553,9 @@ You can also change the interval at which metrics are sent to Stackdriver: [[actuator.metrics.export.statsd]] ==== StatsD -The StatsD registry pushes metrics over UDP to a StatsD agent eagerly. +The StatsD registry eagerly pushes metrics over UDP to a StatsD agent. By default, metrics are exported to a {micrometer-registry-docs}/statsD[StatsD] agent running on your local machine. -The StatsD agent host, port, and protocol to use can be provided using: +You can provide the StatsD agent host, port, and protocol to use by using: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -561,7 +568,7 @@ The StatsD agent host, port, and protocol to use can be provided using: protocol: "udp" ---- -You can also change the StatsD line protocol to use (default to Datadog): +You can also change the StatsD line protocol to use (it defaults to Datadog): [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -576,8 +583,8 @@ You can also change the StatsD line protocol to use (default to Datadog): [[actuator.metrics.export.wavefront]] ==== Wavefront -Wavefront registry pushes metrics to {micrometer-registry-docs}/wavefront[Wavefront] periodically. -If you are exporting metrics to https://www.wavefront.com/[Wavefront] directly, your API token must be provided: +The Wavefront registry periodically pushes metrics to {micrometer-registry-docs}/wavefront[Wavefront]. +If you are exporting metrics to https://www.wavefront.com/[Wavefront] directly, you must provide your API token: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -588,7 +595,7 @@ If you are exporting metrics to https://www.wavefront.com/[Wavefront] directly, api-token: "YOUR_API_TOKEN" ---- -Alternatively, you may use a Wavefront sidecar or an internal proxy set up in your environment that forwards metrics data to the Wavefront API host: +Alternatively, you can use a Wavefront sidecar or an internal proxy in your environment to forward metrics data to the Wavefront API host: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -599,7 +606,7 @@ Alternatively, you may use a Wavefront sidecar or an internal proxy set up in yo uri: "proxy://localhost:2878" ---- -TIP: If publishing metrics to a Wavefront proxy (as described in https://docs.wavefront.com/proxies_installing.html[the documentation]), the host must be in the `proxy://HOST:PORT` format. +NOTE: If you publish metrics to a Wavefront proxy (as described in https://docs.wavefront.com/proxies_installing.html[the Wavefront documentation]), the host must be in the `proxy://HOST:PORT` format. You can also change the interval at which metrics are sent to Wavefront: @@ -617,34 +624,34 @@ You can also change the interval at which metrics are sent to Wavefront: [[actuator.metrics.supported]] === Supported Metrics and Meters Spring Boot provides automatic meter registration for a wide variety of technologies. -In most situations, the out-of-the-box defaults will provide sensible metrics that can be published to any of the supported monioring systems. +In most situations, the defaults provide sensible metrics that can be published to any of the supported monitoring systems. [[actuator.metrics.supported.jvm]] ==== JVM Metrics -Auto-configuration will enable JVM Metrics using core Micrometer classes. +Auto-configuration enables JVM Metrics by using core Micrometer classes. JVM metrics are published under the `jvm.` meter name. The following JVM metrics are provided: * Various memory and buffer pool details * Statistics related to garbage collection -* Threads utilization -* The Number of classes loaded/unloaded +* Thread utilization +* The number of classes loaded and unloaded [[actuator.metrics.supported.system]] ==== System Metrics -Auto-configuration will enable system metrics using core Micrometer classes. +Auto-configuration enables system metrics by using core Micrometer classes. System metrics are published under the `system.`, `process.`, and `disk.` meter names. The following system metrics are provided: * CPU metrics * File descriptor metrics -* Uptime metrics (both the amount of time the application has been running as well as a fixed gauge of the absolute start time) +* Uptime metrics (both the amount of time the application has been running and a fixed gauge of the absolute start time) * Disk space available @@ -652,14 +659,14 @@ The following system metrics are provided: [[actuator.metrics.supported.logger]] ==== Logger Metrics Auto-configuration enables the event metrics for both Logback and Log4J2. -Details are published under the `log4j2.events.` or `logback.events.` meter names. +The details are published under the `log4j2.events.` or `logback.events.` meter names. [[actuator.metrics.supported.tasks]] ==== Task Execution and Scheduling Metrics Auto-configuration enables the instrumentation of all available `ThreadPoolTaskExecutor` and `ThreadPoolTaskScheduler` beans, as long as the underling `ThreadPoolExecutor` is available. -Metrics are tagged by the name of the executor that is derived from the bean name. +Metrics are tagged by the name of the executor, which is derived from the bean name. @@ -667,10 +674,10 @@ Metrics are tagged by the name of the executor that is derived from the bean nam ==== Spring MVC Metrics Auto-configuration enables the instrumentation of all requests handled by Spring MVC controllers and functional handlers. By default, metrics are generated with the name, `http.server.requests`. -The name can be customized by setting the configprop:management.metrics.web.server.request.metric-name[] property. +You can customized the name by setting the configprop:management.metrics.web.server.request.metric-name[] property. `@Timed` annotations are supported on `@Controller` classes and `@RequestMapping` methods (see <> for details). -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. +If you do not 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. By default, Spring MVC related metrics are tagged with the following information: @@ -678,27 +685,27 @@ By default, Spring MVC related metrics are tagged with the following information | Tag | Description | `exception` -| Simple class name of any exception that was thrown while handling the request. +| The simple class name of any exception that was thrown while handling the request. | `method` -| Request's method (for example, `GET` or `POST`) +| The request's method (for example, `GET` or `POST`) | `outcome` -| Request's outcome based on the status code of the response. - 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR` +| The request's outcome, based on the status code of the response. + 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx is `CLIENT_ERROR`, and 5xx is `SERVER_ERROR` | `status` -| Response's HTTP status code (for example, `200` or `500`) +| The response's HTTP status code (for example, `200` or `500`) | `uri` -| Request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) +| The request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) |=== To add to the default tags, provide one or more ``@Bean``s that implement `WebMvcTagsContributor`. To replace the default tags, provide a `@Bean` that implements `WebMvcTagsProvider`. -TIP: In some cases, exceptions handled in Web controllers are not recorded as request metrics tags. -Applications can opt-in and record exceptions by <>. +TIP: In some cases, exceptions handled in web controllers are not recorded as request metrics tags. +Applications can opt in and record exceptions by <>. @@ -706,10 +713,10 @@ Applications can opt-in and record exceptions by <> for details). -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. +If you do not 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. By default, WebFlux related metrics are tagged with the following information: @@ -717,27 +724,27 @@ By default, WebFlux related metrics are tagged with the following information: | Tag | Description | `exception` -| Simple class name of any exception that was thrown while handling the request. +| The simple class name of any exception that was thrown while handling the request. | `method` -| Request's method (for example, `GET` or `POST`) +| The request's method (for example, `GET` or `POST`) | `outcome` -| Request's outcome based on the status code of the response. - 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR` +| The request's outcome, based on the status code of the response. + 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx is `CLIENT_ERROR`, and 5xx is `SERVER_ERROR` | `status` -| Response's HTTP status code (for example, `200` or `500`) +| The response's HTTP status code (for example, `200` or `500`) | `uri` -| Request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) +| The request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) |=== -To add to the default tags, provide one or more ``@Bean``s that implement `WebFluxTagsContributor`. -To replace the default tags, provide a `@Bean` that implements `WebFluxTagsProvider`. +To add to the default tags, provide one or more beans that implement `WebFluxTagsContributor`. +To replace the default tags, provide a bean that implements `WebFluxTagsProvider`. TIP: In some cases, exceptions handled in controllers and handler functions are not recorded as request metrics tags. -Applications can opt-in and record exceptions by <>. +Applications can opt in and record exceptions by <>. @@ -745,10 +752,10 @@ Applications can opt-in and record exceptions by <> for details). -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. +If you do not 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. By default, Jersey server metrics are tagged with the following information: @@ -756,20 +763,20 @@ By default, Jersey server metrics are tagged with the following information: | Tag | Description | `exception` -| Simple class name of any exception that was thrown while handling the request. +| The simple class name of any exception that was thrown while handling the request. | `method` -| Request's method (for example, `GET` or `POST`) +| The request's method (for example, `GET` or `POST`) | `outcome` -| Request's outcome based on the status code of the response. - 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR` +| The request's outcome, based on the status code of the response. + 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx is `CLIENT_ERROR`, and 5xx is `SERVER_ERROR` | `status` -| Response's HTTP status code (for example, `200` or `500`) +| The response's HTTP status code (for example, `200` or `500`) | `uri` -| Request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) +| The request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) |=== To customize the tags, provide a `@Bean` that implements `JerseyTagsProvider`. @@ -784,10 +791,10 @@ For that, you have to inject the auto-configured builder and use it to create in * `RestTemplateBuilder` for `RestTemplate` * `WebClient.Builder` for `WebClient` -It is also possible to apply manually the customizers responsible for this instrumentation, namely `MetricsRestTemplateCustomizer` and `MetricsWebClientCustomizer`. +You can also manually apply the customizers responsible for this instrumentation, namely `MetricsRestTemplateCustomizer` and `MetricsWebClientCustomizer`. By default, metrics are generated with the name, `http.client.requests`. -The name can be customized by setting the configprop:management.metrics.web.client.request.metric-name[] property. +You can customize the name by setting the configprop:management.metrics.web.client.request.metric-name[] property. By default, metrics generated by an instrumented client are tagged with the following information: @@ -795,20 +802,20 @@ By default, metrics generated by an instrumented client are tagged with the foll | Tag | Description | `clientName` -| Host portion of the URI +| The host portion of the URI | `method` -| Request's method (for example, `GET` or `POST`) +| The request's method (for example, `GET` or `POST`) | `outcome` -| Request's outcome based on the status code of the response. - 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`, `UNKNOWN` otherwise +| The request's outcome, based on the status code of the response. + 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx is `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`. Otherwise, it is `UNKNOWN`. | `status` -| Response's HTTP status code if available (for example, `200` or `500`), or `IO_ERROR` in case of I/O issues, `CLIENT_ERROR` otherwise +| The response's HTTP status code if available (for example, `200` or `500`) or `IO_ERROR` in case of I/O issues. Otherwise, it is `CLIENT_ERROR`. | `uri` -| Request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) +| The request's URI template prior to variable substitution, if possible (for example, `/api/person/\{id}`) |=== To customize the tags, and depending on your choice of client, you can provide a `@Bean` that implements `RestTemplateExchangeTagsProvider` or `WebClientExchangeTagsProvider`. @@ -818,7 +825,7 @@ There are convenience static functions in `RestTemplateExchangeTags` and `WebCli [[actuator.metrics.supported.tomcat]] ==== Tomcat Metrics -Auto-configuration will enable the instrumentation of Tomcat only when an `MBeanRegistry` is enabled. +Auto-configuration enables the instrumentation of Tomcat only when an `MBeanRegistry` is enabled. By default, the `MBeanRegistry` is disabled, but you can enable it by setting configprop:server.tomcat.mbeanregistry.enabled[] to `true`. Tomcat metrics are published under the `tomcat.` meter name. @@ -827,7 +834,7 @@ Tomcat metrics are published under the `tomcat.` meter name. [[actuator.metrics.supported.cache]] ==== Cache Metrics -Auto-configuration enables the instrumentation of all available ``Cache``s on startup with metrics prefixed with `cache`. +Auto-configuration enables the instrumentation of all available `Cache` instances on startup, with metrics prefixed with `cache`. Cache instrumentation is standardized for a basic set of metrics. Additional, cache-specific metrics are also available. @@ -839,10 +846,10 @@ The following cache libraries are supported: * Any compliant JCache (JSR-107) implementation * Redis -Metrics are tagged by the name of the cache and by the name of the `CacheManager` that is derived from the bean name. +Metrics are tagged by the name of the cache and by the name of the `CacheManager`, which is derived from the bean name. NOTE: Only caches that are configured on startup are bound to the registry. -For caches not defined in the cache’s configuration, e.g. caches created on-the-fly or programmatically after the startup phase, an explicit registration is required. +For caches not defined in the cache’s configuration, such as caches created on the fly or programmatically after the startup phase, an explicit registration is required. A `CacheMetricsRegistrar` bean is made available to make that process easier. @@ -850,15 +857,16 @@ A `CacheMetricsRegistrar` bean is made available to make that process easier. [[actuator.metrics.supported.jdbc]] ==== DataSource Metrics Auto-configuration enables the instrumentation of all available `DataSource` objects with metrics prefixed with `jdbc.connections`. -Data source instrumentation results in gauges representing the currently active, idle, maximum allowed, and minimum allowed connections in the pool. +Data source instrumentation results in gauges that represent the currently active, idle, maximum allowed, and minimum allowed connections in the pool. Metrics are also tagged by the name of the `DataSource` computed based on the bean name. -TIP: By default, Spring Boot provides metadata for all supported data sources; you can add additional `DataSourcePoolMetadataProvider` beans if your favorite data source isn't supported out of the box. +TIP: By default, Spring Boot provides metadata for all supported data sources. +You can add additional `DataSourcePoolMetadataProvider` beans if your favorite data source is not supported. See `DataSourcePoolMetadataProvidersConfiguration` for examples. Also, Hikari-specific metrics are exposed with a `hikaricp` prefix. -Each metric is tagged by the name of the Pool (can be controlled with `spring.datasource.name`). +Each metric is tagged by the name of the pool (you can control it with `spring.datasource.name`). @@ -866,10 +874,10 @@ Each metric is tagged by the name of the Pool (can be controlled with `spring.da ==== Hibernate Metrics If `org.hibernate:hibernate-micrometer` is on the classpath, all available Hibernate `EntityManagerFactory` instances that have statistics enabled are instrumented with a metric named `hibernate`. -Metrics are also tagged by the name of the `EntityManagerFactory` that is derived from the bean name. +Metrics are also tagged by the name of the `EntityManagerFactory`, which is derived from the bean name. To enable statistics, the standard JPA property `hibernate.generate_statistics` must be set to `true`. -You can enable that on the auto-configured `EntityManagerFactory` as shown in the following example: +You can enable that on the auto-configured `EntityManagerFactory`: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -885,10 +893,10 @@ You can enable that on the auto-configured `EntityManagerFactory` as shown in th ==== Spring Data Repository Metrics Auto-configuration enables the instrumentation of all Spring Data `Repository` method invocations. By default, metrics are generated with the name, `spring.data.repository.invocations`. -The name can be customized by setting the configprop:management.metrics.data.repository.metric-name[] property. +You can customize the name by setting the configprop:management.metrics.data.repository.metric-name[] property. `@Timed` annotations are supported on `Repository` classes and methods (see <> for details). -If you don't want to record metrics for all `Repository` invocations, you can set configprop:management.metrics.data.repository.autotime.enabled[] to `false` and exclusively use `@Timed` annotations instead. +If you do not want to record metrics for all `Repository` invocations, you can set configprop:management.metrics.data.repository.autotime.enabled[] to `false` and exclusively use `@Timed` annotations instead. By default, repository invocation related metrics are tagged with the following information: @@ -896,16 +904,16 @@ By default, repository invocation related metrics are tagged with the following | Tag | Description | `repository` -| Simple class name of the source `Repository`. +| The simple class name of the source `Repository`. | `method` | The name of the `Repository` method that was invoked. | `state` -| The result state (`SUCCESS`, `ERROR`, `CANCELED` or `RUNNING`). +| The result state (`SUCCESS`, `ERROR`, `CANCELED`, or `RUNNING`). | `exception` -| Simple class name of any exception that was thrown from the invocation. +| The simple class name of any exception that was thrown from the invocation. |=== To replace the default tags, provide a `@Bean` that implements `RepositoryTagsProvider`. @@ -914,53 +922,54 @@ To replace the default tags, provide a `@Bean` that implements `RepositoryTagsPr [[actuator.metrics.supported.rabbitmq]] ==== RabbitMQ Metrics -Auto-configuration will enable the instrumentation of all available RabbitMQ connection factories with a metric named `rabbitmq`. +Auto-configuration enables the instrumentation of all available RabbitMQ connection factories with a metric named `rabbitmq`. [[actuator.metrics.supported.spring-integration]] ==== Spring Integration Metrics -Spring Integration provides {spring-integration-docs}system-management.html#micrometer-integration[Micrometer support] automatically whenever a `MeterRegistry` bean is available. +Spring Integration automatically provides {spring-integration-docs}system-management.html#micrometer-integration[Micrometer support] whenever a `MeterRegistry` bean is available. Metrics are published under the `spring.integration.` meter name. [[actuator.metrics.supported.kafka]] ==== Kafka Metrics -Auto-configuration will register a `MicrometerConsumerListener` and `MicrometerProducerListener` for the auto-configured consumer factory and producer factory respectively. -It will also register a `KafkaStreamsMicrometerListener` for `StreamsBuilderFactoryBean`. -For more details refer to {spring-kafka-docs}#micrometer-native[Micrometer Native Metrics] section of the Spring Kafka documentation. +Auto-configuration registers a `MicrometerConsumerListener` and `MicrometerProducerListener` for the auto-configured consumer factory and producer factory, respectively. +It alsos registers a `KafkaStreamsMicrometerListener` for `StreamsBuilderFactoryBean`. +For more detail, see the {spring-kafka-docs}#micrometer-native[Micrometer Native Metrics] section of the Spring Kafka documentation. [[actuator.metrics.supported.mongodb]] ==== MongoDB Metrics +This section briefly describes the available metrics for MongoDB. [[actuator.metrics.supported.mongodb.command]] -===== Command Metrics -Auto-configuration will register a `MongoMetricsCommandListener` with the auto-configured `MongoClient`. +===== MongoDB Command Metrics +Auto-configuration registers a `MongoMetricsCommandListener` with the auto-configured `MongoClient`. -A timer metric with the name `mongodb.driver.commands` is created for each command issued to the underlying MongoDB driver. +A timer metric named `mongodb.driver.commands` is created for each command issued to the underlying MongoDB driver. Each metric is tagged with the following information by default: |=== | Tag | Description | `command` -| Name of the command issued +| The name of the command issued. | `cluster.id` -| Identifier of the cluster the command was sent to +| The identifier of the cluster to which the command was sent. | `server.address` -| Address of the server the command was sent to +| The address of the server to which the command was sent. | `status` -| Outcome of the command - one of (`SUCCESS`, `FAILED`) +| The outcome of the command (`SUCCESS` or `FAILED`). |=== -To replace the default metric tags, define a `MongoCommandTagsProvider` bean, as shown in the following example: +To replace the default metric tags, define a `MongoCommandTagsProvider` bean, as the following example shows: [source,java,indent=0,subs="verbatim"] ---- @@ -981,27 +990,27 @@ To disable the auto-configured command metrics, set the following property: [[actuator.metrics.supported.mongodb.connection-pool]] -===== Connection Pool Metrics -Auto-configuration will register a `MongoMetricsConnectionPoolListener` with the auto-configured `MongoClient`. +===== MongoDB Connection Pool Metrics +Auto-configuration registers a `MongoMetricsConnectionPoolListener` with the auto-configured `MongoClient`. The following gauge metrics are created for the connection pool: -* `mongodb.driver.pool.size` that reports the current size of the connection pool, including idle and and in-use members -* `mongodb.driver.pool.checkedout` that reports the count of connections that are currently in use -* `mongodb.driver.pool.waitqueuesize` that reports the current size of the wait queue for a connection from the pool +* `mongodb.driver.pool.size` reports the current size of the connection pool, including idle and and in-use members. +* `mongodb.driver.pool.checkedout` reports the count of connections that are currently in use. +* `mongodb.driver.pool.waitqueuesize` reports the current size of the wait queue for a connection from the pool. Each metric is tagged with the following information by default: |=== | Tag | Description | `cluster.id` -| Identifier of the cluster the connection pool corresponds to +| The identifier of the cluster to which the connection pool corresponds. | `server.address` -| Address of the server the connection pool corresponds to +| The address of the server to which the connection pool corresponds. |=== -To replace the default metric tags, define a `MongoConnectionPoolTagsProvider` bean, as shown in the following example: +To replace the default metric tags, define a `MongoConnectionPoolTagsProvider` bean: [source,java,indent=0,subs="verbatim"] ---- @@ -1023,52 +1032,52 @@ To disable the auto-configured connection pool metrics, set the following proper [[actuator.metrics.supported.jetty]] ==== Jetty Metrics -Auto-configuration will bind metrics for Jetty's `ThreadPool` using Micrometer's `JettyServerThreadPoolMetrics`. -Metrics for Jetty's ``Connector``s are bound using Micrometer's `JettyConnectionMetrics` and, in addition when configprop:server.ssl.enabled[] is set to `true`, Micrometer's `JettySslHandshakeMetrics`. +Auto-configuration binds metrics for Jetty's `ThreadPool` by using Micrometer's `JettyServerThreadPoolMetrics`. +Metrics for Jetty's `Connector` instances are bound by using Micrometer's `JettyConnectionMetrics` and, when configprop:server.ssl.enabled[] is set to `true`, Micrometer's `JettySslHandshakeMetrics`. [[actuator.metrics.supported.timed-annotation]] ==== @Timed Annotation Support -The `@Timed` annotation from the `io.micrometer.core.annotation` package can be used with several of the supported technologies listed above. -If supported, the annotation can be used either at the class-level or the method-level. +You can use the `@Timed` annotation from the `io.micrometer.core.annotation` package with several of the supported technologies described earlier. +If supported, you can use the annotation at either the class level or the method level. -For example, the following code shows how the annotation can be used to instrument all request mappings in a `@RestController`: +For example, the following code shows how you can use the annotation to instrument all request mappings in a `@RestController`: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/metrics/supported/timedannotation/all/MyController.java[] ---- -If you only want to instrument a single mapping, you can use the annotation on the method instead of the class: +If you want only to instrument a single mapping, you can use the annotation on the method instead of the class: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/metrics/supported/timedannotation/single/MyController.java[] ---- -You can also combine class-level and method-level annotations if you want to change timing details for a specific method: +You can also combine class-level and method-level annotations if you want to change the timing details for a specific method: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/metrics/supported/timedannotation/change/MyController.java[] ---- -NOTE: A `@Timed` annotation with `longTask = true` will enable a long task timer for the method. -Long task timers require a separate metric name, and can be stacked with a short task timer. +NOTE: A `@Timed` annotation with `longTask = true` enables a long task timer for the method. +Long task timers require a separate metric name and can be stacked with a short task timer. [[actuator.metrics.registering-custom]] === Registering Custom Metrics -To register custom metrics, inject `MeterRegistry` into your component, as shown in the following example: +To register custom metrics, inject `MeterRegistry` into your component: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/actuator/metrics/registeringcustom/MyBean.java[] ---- -If your metrics depend on other beans, it is recommended that you use a `MeterBinder` to register them, as shown in the following example: +If your metrics depend on other beans, we recommend that you use a `MeterBinder` to register them: [source,java,indent=0,subs="verbatim"] ---- @@ -1078,13 +1087,13 @@ include::{docs-java}/actuator/metrics/registeringcustom/MyMeterBinderConfigurati Using a `MeterBinder` ensures that the correct dependency relationships are set up and that the bean is available when the metric's value is retrieved. A `MeterBinder` implementation can also be useful if you find that you repeatedly instrument a suite of metrics across components or applications. -NOTE: By default, metrics from all `MeterBinder` beans will be automatically bound to the Spring-managed `MeterRegistry`. +NOTE: By default, metrics from all `MeterBinder` beans are automatically bound to the Spring-managed `MeterRegistry`. [[actuator.metrics.customizing]] === Customizing Individual Metrics -If you need to apply customizations to specific `Meter` instances you can use the `io.micrometer.core.instrument.config.MeterFilter` interface. +If you need to apply customizations to specific `Meter` instances, you can use the `io.micrometer.core.instrument.config.MeterFilter` interface. For example, if you want to rename the `mytag.region` tag to `mytag.area` for all meter IDs beginning with `com.example`, you can do the following: @@ -1093,16 +1102,16 @@ For example, if you want to rename the `mytag.region` tag to `mytag.area` for al include::{docs-java}/actuator/metrics/customizing/MyMetricsFilterConfiguration.java[] ---- -NOTE: By default, all `MeterFilter` beans will be automatically bound to the Spring-managed `MeterRegistry`. -Make sure to register your metrics using the Spring-managed `MeterRegistry` and not any of the static methods on `Metrics`. +NOTE: By default, all `MeterFilter` beans are automatically bound to the Spring-managed `MeterRegistry`. +Make sure to register your metrics by using the Spring-managed `MeterRegistry` and not any of the static methods on `Metrics`. These use the global registry that is not Spring-managed. [[actuator.metrics.customizing.common-tags]] ==== Common Tags -Common tags are generally used for dimensional drill-down on the operating environment like host, instance, region, stack, etc. -Commons tags are applied to all meters and can be configured as shown in the following example: +Common tags are generally used for dimensional drill-down on the operating environment, such as host, instance, region, stack, and others. +Commons tags are applied to all meters and can be configured, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -1113,18 +1122,18 @@ Commons tags are applied to all meters and can be configured as shown in the fol stack: "prod" ---- -The example above adds `region` and `stack` tags to all meters with a value of `us-east-1` and `prod` respectively. +The preceding example adds `region` and `stack` tags to all meters with a value of `us-east-1` and `prod`, respectively. -NOTE: The order of common tags is important if you are using Graphite. -As the order of common tags cannot be guaranteed using this approach, Graphite users are advised to define a custom `MeterFilter` instead. +NOTE: The order of common tags is important if you use Graphite. +As the order of common tags cannot be guaranteed by using this approach, Graphite users are advised to define a custom `MeterFilter` instead. [[actuator.metrics.customizing.per-meter-properties]] ==== Per-meter Properties -In addition to `MeterFilter` beans, it's also possible to apply a limited set of customization on a per-meter basis using properties. -Per-meter customizations apply to any all meter IDs that start with the given name. -For example, the following will disable any meters that have an ID starting with `example.remote` +In addition to `MeterFilter` beans, you can apply a limited set of customization on a per-meter basis by using properties. +Per-meter customizations apply to any meter IDs that start with the given name. +The following example disables any meters that have an ID starting with `example.remote` [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -1142,13 +1151,13 @@ The following properties allow per-meter customization: | Property | Description | configprop:management.metrics.enable[] -| Whether to deny meters from emitting any metrics. +| Whether to prevent meters from emitting any metrics. | configprop:management.metrics.distribution.percentiles-histogram[] | Whether to publish a histogram suitable for computing aggregable (across dimension) percentile approximations. | configprop:management.metrics.distribution.minimum-expected-value[], configprop:management.metrics.distribution.maximum-expected-value[] -| Publish less histogram buckets by clamping the range of expected values. +| Publish fewer histogram buckets by clamping the range of expected values. | configprop:management.metrics.distribution.percentiles[] | Publish percentile values computed in your application @@ -1161,29 +1170,29 @@ configurable buffer length. | Publish a cumulative histogram with buckets defined by your service-level objectives. |=== -For more details on concepts behind `percentiles-histogram`, `percentiles` and `slo` refer to the {micrometer-concepts-docs}#_histograms_and_percentiles["Histograms and percentiles" section] of the micrometer documentation. +For more details on the concepts behind `percentiles-histogram`, `percentiles`, and `slo`, see the {micrometer-concepts-docs}#_histograms_and_percentiles["`Histograms and percentiles`" section] of the Micrometer documentation. [[actuator.metrics.endpoint]] === Metrics Endpoint -Spring Boot provides a `metrics` endpoint that can be used diagnostically to examine the metrics collected by an application. -The endpoint is not available by default and must be exposed, see <> for more details. +Spring Boot provides a `metrics` endpoint that you can use diagnostically to examine the metrics collected by an application. +The endpoint is not available by default and must be exposed. See <> for more details. Navigating to `/actuator/metrics` displays a list of available meter names. -You can drill down to view information about a particular meter by providing its name as a selector, e.g. `/actuator/metrics/jvm.memory.max`. +You can drill down to view information about a particular meter by providing its name as a selector -- for example, `/actuator/metrics/jvm.memory.max`. [TIP] ==== -The name you use here should match the name used in the code, not the name after it has been naming-convention normalized for a monitoring system it is shipped to. +The name you use here should match the name used in the code, not the name after it has been naming-convention normalized for a monitoring system to which it is shipped. In other words, if `jvm.memory.max` appears as `jvm_memory_max` in Prometheus because of its snake case naming convention, you should still use `jvm.memory.max` as the selector when inspecting the meter in the `metrics` endpoint. ==== -You can also add any number of `tag=KEY:VALUE` query parameters to the end of the URL to dimensionally drill down on a meter, e.g. `/actuator/metrics/jvm.memory.max?tag=area:nonheap`. +You can also add any number of `tag=KEY:VALUE` query parameters to the end of the URL to dimensionally drill down on a meter -- for example, `/actuator/metrics/jvm.memory.max?tag=area:nonheap`. [TIP] ==== -The reported measurements are the _sum_ of the statistics of all meters matching the meter name and any tags that have been applied. -So in the example above, the returned "Value" statistic is the sum of the maximum memory footprints of "Code Cache", "Compressed Class Space", and "Metaspace" areas of the heap. -If you only wanted to see the maximum size for the "Metaspace", you could add an additional `tag=id:Metaspace`, i.e. `/actuator/metrics/jvm.memory.max?tag=area:nonheap&tag=id:Metaspace`. +The reported measurements are the _sum_ of the statistics of all meters that match the meter name and any tags that have been applied. +In the preceding example, the returned `Value` statistic is the sum of the maximum memory footprints of the "`Code Cache`", "`Compressed Class Space`", and "`Metaspace`" areas of the heap. +If you wanted to see only the maximum size for the "`Metaspace`", you could add an additional `tag=id:Metaspace` -- that is, `/actuator/metrics/jvm.memory.max?tag=area:nonheap&tag=id:Metaspace`. ==== diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/monitoring.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/monitoring.adoc index 3e1e5c4824..e58179cadc 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/monitoring.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/monitoring.adoc @@ -5,7 +5,7 @@ The default convention is to use the `id` of the endpoint with a prefix of `/act For example, `health` is exposed as `/actuator/health`. TIP: Actuator is supported natively with Spring MVC, Spring WebFlux, and Jersey. -If both Jersey and Spring MVC are available, Spring MVC will be used. +If both Jersey and Spring MVC are available, Spring MVC is used. NOTE: Jackson is a required dependency in order to get the correct JSON responses as documented in the API documentation ({spring-boot-actuator-restapi-docs}[HTML] or {spring-boot-actuator-restapi-pdfdocs}[PDF]). @@ -15,7 +15,7 @@ NOTE: Jackson is a required dependency in order to get the correct JSON response === Customizing the Management Endpoint Paths Sometimes, it is useful to customize the prefix for the management endpoints. For example, your application might already use `/actuator` for another purpose. -You can use the configprop:management.endpoints.web.base-path[] property to change the prefix for your management endpoint, as shown in the following example: +You can use the configprop:management.endpoints.web.base-path[] property to change the prefix for your management endpoint, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -27,7 +27,7 @@ You can use the configprop:management.endpoints.web.base-path[] property to chan The preceding `application.properties` example changes the endpoint from `/actuator/\{id}` to `/manage/\{id}` (for example, `/manage/info`). -NOTE: Unless the management port has been configured to <>, `management.endpoints.web.base-path` is relative to `server.servlet.context-path` (Servlet web applications) or `spring.webflux.base-path` (reactive web applications). +NOTE: Unless the management port has been configured to <>, `management.endpoints.web.base-path` is relative to `server.servlet.context-path` (for servlet web applications) or `spring.webflux.base-path` (for reactive web applications). If `management.server.port` is configured, `management.endpoints.web.base-path` is relative to `management.server.base-path`. If you want to map endpoints to a different path, you can use the configprop:management.endpoints.web.path-mapping[] property. @@ -51,7 +51,7 @@ The following example remaps `/actuator/health` to `/healthcheck`: Exposing management endpoints by using the default HTTP port is a sensible choice for cloud-based deployments. If, however, your application runs inside your own data center, you may prefer to expose endpoints by using a different HTTP port. -You can set the configprop:management.server.port[] property to change the HTTP port, as shown in the following example: +You can set the configprop:management.server.port[] property to change the HTTP port, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -60,15 +60,15 @@ You can set the configprop:management.server.port[] property to change the HTTP port: 8081 ---- -NOTE: On Cloud Foundry, applications only receive requests on port 8080 for both HTTP and TCP routing, by default. -If you want to use a custom management port on Cloud Foundry, you will need to explicitly set up the application's routes to forward traffic to the custom port. +NOTE: On Cloud Foundry, by default, applications receive requests only on port 8080 for both HTTP and TCP routing. +If you want to use a custom management port on Cloud Foundry, you need to explicitly set up the application's routes to forward traffic to the custom port. [[actuator.monitoring.management-specific-ssl]] === Configuring Management-specific SSL -When configured to use a custom port, the management server can also be configured with its own SSL by using the various `management.server.ssl.*` properties. -For example, doing so lets a management server be available over HTTP while the main application uses HTTPS, as shown in the following property settings: +When configured to use a custom port, you can also configure the management server with its own SSL by using the various `management.server.ssl.*` properties. +For example, doing so lets a management server be available over HTTP while the main application uses HTTPS, as the following property settings show: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -108,7 +108,7 @@ Alternatively, both the main server and the management server can use SSL but wi [[actuator.monitoring.customizing-management-server-address]] === Customizing the Management Server Address -You can customize the address that the management endpoints are available on by setting the configprop:management.server.address[] property. +You can customize the address on which the management endpoints are available by setting the configprop:management.server.address[] property. Doing so can be useful if you want to listen only on an internal or ops-facing network or to listen only for connections from `localhost`. NOTE: You can listen on a different address only when the port differs from the main server port. @@ -127,7 +127,7 @@ The following example `application.properties` does not allow remote management [[actuator.monitoring.disabling-http-endpoints]] === Disabling HTTP Endpoints -If you do not want to expose endpoints over HTTP, you can set the management port to `-1`, as shown in the following example: +If you do not want to expose endpoints over HTTP, you can set the management port to `-1`, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- @@ -136,7 +136,7 @@ If you do not want to expose endpoints over HTTP, you can set the management por port: -1 ---- -This can be achieved using the configprop:management.endpoints.web.exposure.exclude[] property as well, as shown in the following example: +You can also achieve this by using the configprop:management.endpoints.web.exposure.exclude[] property, as the following example shows: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/process-monitoring.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/process-monitoring.adoc index 365d3c1853..5b877bd10a 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/process-monitoring.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/process-monitoring.adoc @@ -2,10 +2,10 @@ == Process Monitoring In the `spring-boot` module, you can find two classes to create files that are often useful for process monitoring: -* `ApplicationPidFileWriter` creates a file containing the application PID (by default, in the application directory with a file name of `application.pid`). -* `WebServerPortFileWriter` creates a file (or files) containing the ports of the running web server (by default, in the application directory with a file name of `application.port`). +* `ApplicationPidFileWriter` creates a file that contains the application PID (by default, in the application directory with a file name of `application.pid`). +* `WebServerPortFileWriter` creates a file (or files) that contain the ports of the running web server (by default, in the application directory with a file name of `application.port`). -By default, these writers are not activated, but you can enable: +By default, these writers are not activated, but you can enable them: * <> * <> @@ -14,7 +14,7 @@ By default, these writers are not activated, but you can enable: [[actuator.process-monitoring.configuration]] === Extending Configuration -In the `META-INF/spring.factories` file, you can activate the listener(s) that writes a PID file, as shown in the following example: +In the `META-INF/spring.factories` file, you can activate the listener (or listeners) that writes a PID file: [indent=0] ---- @@ -26,6 +26,6 @@ In the `META-INF/spring.factories` file, you can activate the listener(s) that w [[actuator.process-monitoring.programmatically]] -=== Programmatically +=== Programmatically Enabling Process Monitoring You can also activate a listener by invoking the `SpringApplication.addListeners(...)` method and passing the appropriate `Writer` object. This method also lets you customize the file name and path in the `Writer` constructor. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc index df0adbbdd9..b3d16f6c33 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc @@ -1,12 +1,12 @@ [[actuator.tracing]] == HTTP Tracing -HTTP Tracing can be enabled by providing a bean of type `HttpTraceRepository` in your application's configuration. -For convenience, Spring Boot offers an `InMemoryHttpTraceRepository` that stores traces for the last 100 request-response exchanges, by default. -`InMemoryHttpTraceRepository` is limited compared to other tracing solutions and we recommend using it only for development environments. -For production environments, use of a production-ready tracing or observability solution, such as Zipkin or Spring Cloud Sleuth, is recommended. -Alternatively, create your own `HttpTraceRepository` that meets your needs. +You can enable HTTP Tracing by providing a bean of type `HttpTraceRepository` in your application's configuration. +For convenience, Spring Boot offers `InMemoryHttpTraceRepository`, which stores traces for the last 100 (the default) request-response exchanges. +`InMemoryHttpTraceRepository` is limited compared to other tracing solutions, and we recommend using it only for development environments. +For production environments, we recommend using a production-ready tracing or observability solution, such as Zipkin or Spring Cloud Sleuth. +Alternatively, you can create your own `HttpTraceRepository`. -The `httptrace` endpoint can be used to obtain information about the request-response exchanges that are stored in the `HttpTraceRepository`. +You can use the `httptrace` endpoint to obtain information about the request-response exchanges that are stored in the `HttpTraceRepository`. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/whats-next.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/whats-next.adoc index 652c0d147a..42e0ed3cbd 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/whats-next.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/whats-next.adoc @@ -2,4 +2,4 @@ == What to Read Next You might want to read about graphing tools such as https://graphiteapp.org[Graphite]. -Otherwise, you can continue on, to read about <> or jump ahead for some in-depth information about Spring Boot's _<>_. +Otherwise, you can continue on to read about <> or jump ahead for some in-depth information about Spring Boot's <>.