Separate endpoint concerns
Update endpoint code to provide cleaner separation of concerns. Specifically, the top level endpoint package is no longer aware of the fact that JMX and HTTP are ultimately used to expose endpoints. Caching concerns have also been abstracted behind a general purpose `OperationMethodInvokerAdvisor` interface. Configuration properties have been refined to further enforce separation. The `management.endpoint.<name>` prefix provides configuration for a single endpoint (including enable and cache time-to-live). These properties are now technology agnostic (they don't include `web` or `jmx` sub properties). The `management.endpoints.<technology>` prefix provide exposure specific configuration. For example, `management.endpoints.web.path-mapping` allow endpoint URLs to be changed. Endpoint enabled/disabled logic has been simplified so that endpoints can't be disabled per exposure technology. Instead a filter based approach is used to allow refinement of what endpoints are exposed over a given technology. Fixes gh-10176
This commit is contained in:
@@ -1071,158 +1071,6 @@ content into your application; rather pick only the properties that you need.
|
||||
# ACTUATOR PROPERTIES
|
||||
# ----------------------------------------
|
||||
|
||||
# AUDIT EVENTS ENDPOINT ({sc-spring-boot-actuator}/audit/AuditEventsEndpoint.{sc-ext}[AuditEventsEndpoint])
|
||||
endpoints.auditevents.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.auditevents.enabled= # Enable the auditevents endpoint.
|
||||
endpoints.auditevents.jmx.enabled= # Expose the auditevents endpoint as a JMX MBean.
|
||||
endpoints.auditevents.web.enabled= # Expose the auditevents endpoint as a Web endpoint.
|
||||
endpoints.auditevents.web.path=auditevents # Path of the auditevents endpoint.
|
||||
|
||||
# BEANS ENDPOINT ({sc-spring-boot-actuator}/beans/BeansEndpoint.{sc-ext}[BeansEndpoint])
|
||||
endpoints.beans.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.beans.enabled= # Enable the beans endpoint.
|
||||
endpoints.beans.jmx.enabled= # Expose the beans endpoint as a JMX MBean.
|
||||
endpoints.beans.web.enabled= # Expose the beans endpoint as a Web endpoint.
|
||||
endpoints.beans.web.path=beans # Path of the beans endpoint.
|
||||
|
||||
# CONDITIONS REPORT ENDPOINT ({sc-spring-boot-actuator-autoconfigure}/condition/ConditionsReportEndpoint.{sc-ext}[ConditionsReportEndpoint])
|
||||
endpoints.conditions.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.conditions.enabled= # Enable the conditions endpoint.
|
||||
endpoints.conditions.jmx.enabled= # Expose the conditions endpoint as a JMX MBean.
|
||||
endpoints.conditions.web.enabled= # Expose the conditions endpoint as a Web endpoint.
|
||||
endpoints.conditions.web.path=conditions # Path of the conditions endpoint.
|
||||
|
||||
# CONFIGURATION PROPERTIES REPORT ENDPOINT ({sc-spring-boot-actuator}/context/properties/ConfigurationPropertiesReportEndpoint.{sc-ext}[ConfigurationPropertiesReportEndpoint])
|
||||
endpoints.configprops.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.configprops.enabled= # Enable the configprops endpoint.
|
||||
endpoints.configprops.jmx.enabled= # Expose the configprops endpoint as a JMX MBean.
|
||||
endpoints.configprops.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.
|
||||
endpoints.configprops.web.enabled= # Expose the configprops endpoint as a Web endpoint.
|
||||
endpoints.configprops.web.path=configprops # Path of the configprops endpoint.
|
||||
|
||||
# ENDPOINT DEFAULT SETTINGS
|
||||
endpoints.default.enabled=true # Enable all endpoints by default.
|
||||
endpoints.default.jmx.enabled=true # Enable all endpoints as JMX MBeans by default.
|
||||
endpoints.default.web.enabled=false # Enable all endpoints as Web endpoints by default.
|
||||
|
||||
# ENVIRONMENT ENDPOINT ({sc-spring-boot-actuator}/env/EnvironmentEndpoint.{sc-ext}[EnvironmentEndpoint])
|
||||
endpoints.env.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.env.enabled= # Enable the env endpoint.
|
||||
endpoints.env.jmx.enabled= # Expose the env endpoint as a JMX MBean.
|
||||
endpoints.env.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.
|
||||
endpoints.env.web.enabled= # Expose the env endpoint as a Web endpoint.
|
||||
endpoints.env.web.path=env # Path of the env endpoint.
|
||||
|
||||
# FLYWAY ENDPOINT ({sc-spring-boot-actuator}/flyway/FlywayEndpoint.{sc-ext}[FlywayEndpoint])
|
||||
endpoints.flyway.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.flyway.enabled= # Enable the flyway endpoint.
|
||||
endpoints.flyway.jmx.enabled= # Expose the flyway endpoint as a JMX MBean.
|
||||
endpoints.flyway.web.enabled= # Expose the flyway endpoint as a Web endpoint.
|
||||
endpoints.flyway.web.path=flyway # Path of the flyway endpoint.
|
||||
|
||||
# HEALTH ENDPOINT ({sc-spring-boot-actuator}/health/HealthEndpoint.{sc-ext}[HealthEndpoint])
|
||||
endpoints.health.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.health.enabled= # Enable the health endpoint.
|
||||
endpoints.health.jmx.enabled= # Expose the health endpoint as a JMX MBean.
|
||||
endpoints.health.web.enabled= # Expose the health endpoint as a Web endpoint.
|
||||
endpoints.health.web.path=health # Path of the health endpoint.
|
||||
|
||||
# HEAP DUMP ENDPOINT ({sc-spring-boot-actuator}/management/HeapDumpWebEndpoint.{sc-ext}[HeapDumpWebEndpoint])
|
||||
endpoints.heapdump.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.heapdump.enabled= # Enable the heapdump endpoint.
|
||||
endpoints.heapdump.web.enabled= # Expose the heapdump endpoint as a Web endpoint.
|
||||
endpoints.heapdump.web.path=heapdump # Path of the heapdump endpoint.
|
||||
|
||||
# INFO ENDPOINT ({sc-spring-boot-actuator}/info/InfoEndpoint.{sc-ext}[InfoEndpoint])
|
||||
endpoints.info.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.info.enabled=true # Enable the info endpoint.
|
||||
endpoints.info.jmx.enabled=true # Expose the info endpoint as a JMX MBean.
|
||||
endpoints.info.web.enabled=true # Expose the info endpoint as a Web endpoint.
|
||||
endpoints.info.web.path=info # Path of the info endpoint.
|
||||
|
||||
# LIQUIBASE ENDPOINT ({sc-spring-boot-actuator}/liquibase/LiquibaseEndpoint.{sc-ext}[LiquibaseEndpoint])
|
||||
endpoints.liquibase.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.liquibase.enabled= # Enable the liquibase endpoint.
|
||||
endpoints.liquibase.jmx.enabled= # Expose the liquibase endpoint as a JMX MBean.
|
||||
endpoints.liquibase.web.enabled= # Expose the liquibase endpoint as a Web endpoint.
|
||||
endpoints.liquibase.web.path=liquibase # Path of the liquibase endpoint.
|
||||
|
||||
# LOG FILE ENDPOINT ({sc-spring-boot-actuator}/logging/LogFileWebEndpoint.{sc-ext}[LogFileWebEndpoint])
|
||||
endpoints.logfile.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.logfile.enabled= # Enable the logfile endpoint.
|
||||
endpoints.logfile.external-file= # External Logfile to be accessed. Can be used if the logfile is written by output redirect and not by the logging system itself.
|
||||
endpoints.logfile.web.enabled= # Expose the logfile endpoint as a Web endpoint.
|
||||
endpoints.logfile.web.path=logfile # Path of the logfile endpoint.
|
||||
|
||||
# LOGGERS ENDPOINT ({sc-spring-boot-actuator}/logging/LoggersEndpoint.{sc-ext}[LoggersEndpoint])
|
||||
endpoints.loggers.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.loggers.enabled= # Enable the loggers endpoint.
|
||||
endpoints.loggers.jmx.enabled= # Expose the loggers endpoint as a JMX MBean.
|
||||
endpoints.loggers.web.enabled= # Expose the loggers endpoint as a Web endpoint.
|
||||
endpoints.loggers.web.path=loggers # Path of the loggers endpoint.
|
||||
|
||||
# REQUEST MAPPING ENDPOINT ({sc-spring-boot-actuator-autoconfigure}/web/servlet/RequestMappingEndpoint.{sc-ext}[RequestMappingEndpoint])
|
||||
endpoints.mappings.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.mappings.enabled= # Enable the mappings endpoint.
|
||||
endpoints.mappings.jmx.enabled= # Expose the mappings endpoint as a JMX MBean.
|
||||
endpoints.mappings.web.enabled= # Expose the mappings endpoint as a Web endpoint.
|
||||
endpoints.mappings.web.path=mappings # Path of the mappings endpoint.
|
||||
|
||||
# METRICS ENDPOINT ({sc-spring-boot-actuator}/metrics/MetricsEndpoint.{sc-ext}[MetricsEndpoint])
|
||||
endpoints.metrics.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.metrics.enabled= # Enable the metrics endpoint.
|
||||
endpoints.metrics.jmx.enabled= # Expose the metrics endpoint as a JMX MBean.
|
||||
endpoints.metrics.web.enabled= # Expose the metrics endpoint as a Web endpoint.
|
||||
endpoints.metrics.web.path=metrics # Path of the metrics endpoint.
|
||||
|
||||
# PROMETHEUS ENDPOINT ({sc-spring-boot-actuator}/metrics/export/prometheus/PrometheusScrapeEndpoint.{sc-ext}[PrometheusScrapeEndpoint])
|
||||
endpoints.prometheus.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.prometheus.enabled= # Enable the metrics endpoint.
|
||||
endpoints.prometheus.web.enabled= # Expose the metrics endpoint as a Web endpoint.
|
||||
endpoints.prometheus.web.path=prometheus # Path of the prometheus endpoint.
|
||||
|
||||
# SCHEDULED TASKS ENDPOINT ({sc-spring-boot-actuator}/scheduling/ScheduledTasksEndpoint.{sc-ext}[ScheduledTasksEndpoint])
|
||||
endpoints.scheduledtasks.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.scheduledtasks.enabled= # Enable the scheduled tasks endpoint.
|
||||
endpoints.scheduledtasks.jmx.enabled= # Expose the scheduled tasks endpoint as a JMX MBean.
|
||||
endpoints.scheduledtasks.web.enabled= # Expose the scheduled tasks endpoint as a Web endpoint.
|
||||
endpoints.scheduledtasks.web.path=sessions # Path of the scheduled tasks endpoint.
|
||||
|
||||
# SESSIONS ENDPOINT ({sc-spring-boot-actuator}/session/SessionsEndpoint.{sc-ext}[SessionsEndpoint])
|
||||
endpoints.sessions.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.sessions.enabled= # Enable the sessions endpoint.
|
||||
endpoints.sessions.jmx.enabled= # Expose the sessions endpoint as a JMX MBean.
|
||||
endpoints.sessions.web.enabled= # Expose the sessions endpoint as a Web endpoint.
|
||||
endpoints.sessions.web.path=sessions # Path of the sessions endpoint.
|
||||
|
||||
# SHUTDOWN ENDPOINT ({sc-spring-boot-actuator}/context/ShutdownEndpoint.{sc-ext}[ShutdownEndpoint])
|
||||
endpoints.shutdown.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.shutdown.enabled=false # Enable the shutdown endpoint.
|
||||
endpoints.shutdown.jmx.enabled=false # Expose the shutdown endpoint as a JMX MBean.
|
||||
endpoints.shutdown.web.enabled=false # Expose the shutdown endpoint as a Web endpoint.
|
||||
endpoints.shutdown.web.path=shutdown # Path of the shutdown endpoint.
|
||||
|
||||
# STATUS ENDPOINT ({sc-spring-boot-actuator}/health/StatusEndpoint.{sc-ext}[StatusEndpoint])
|
||||
endpoints.status.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.status.enabled=true # Enable the status endpoint.
|
||||
endpoints.status.jmx.enabled=true # Expose the status endpoint as a JMX MBean.
|
||||
endpoints.status.web.enabled=true # Expose the status endpoint as a Web endpoint.
|
||||
endpoints.status.web.path=status # Path of the status endpoint.
|
||||
|
||||
# THREAD DUMP ENDPOINT ({sc-spring-boot-actuator}/management/ThreadDumpEndpoint.{sc-ext}[ThreadDumpEndpoint])
|
||||
endpoints.threaddump.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.threaddump.enabled= # Enable the threaddump endpoint.
|
||||
endpoints.threaddump.jmx.enabled= # Expose the threaddump endpoint as a JMX MBean.
|
||||
endpoints.threaddump.web.enabled= # Expose the threaddump endpoint as a Web endpoint.
|
||||
endpoints.threaddump.web.path=threaddump # Path of the threaddump endpoint.
|
||||
|
||||
# TRACE ENDPOINT ({sc-spring-boot-actuator}/trace/TraceEndpoint.{sc-ext}[TraceEndpoint])
|
||||
endpoints.trace.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.trace.enabled= # Enable the trace endpoint.
|
||||
endpoints.trace.jmx.enabled= # Expose the trace endpoint as a JMX MBean.
|
||||
endpoints.trace.web.enabled= # Expose the trace endpoint as a Web endpoint.
|
||||
endpoints.trace.web.path=trace # Path of the trace endpoint.
|
||||
|
||||
# MANAGEMENT HTTP SERVER ({sc-spring-boot-actuator-autoconfigure}/web/server/ManagementServerProperties.{sc-ext}[ManagementServerProperties])
|
||||
management.server.add-application-context-header=false # Add the "X-Application-Context" HTTP header in each response. Requires a custom management.server.port.
|
||||
management.server.address= # Network address that the management endpoints should bind to. Requires a custom management.server.port.
|
||||
@@ -1248,22 +1096,119 @@ content into your application; rather pick only the properties that you need.
|
||||
management.cloudfoundry.enabled=true # Enable extended Cloud Foundry actuator endpoints.
|
||||
management.cloudfoundry.skip-ssl-validation=false # Skip SSL verification for Cloud Foundry actuator endpoint security calls.
|
||||
|
||||
# ENDPOINTS CORS CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/web/servlet/CorsEndpointProperties.{sc-ext}[CorsEndpointProperties])
|
||||
management.endpoints.cors.allow-credentials= # Set whether credentials are supported. When not set, credentials are not supported.
|
||||
management.endpoints.cors.allowed-headers= # Comma-separated list of headers to allow in a request. '*' allows all headers.
|
||||
management.endpoints.cors.allowed-methods= # Comma-separated list of methods to allow. '*' allows all methods. When not set, defaults to GET.
|
||||
management.endpoints.cors.allowed-origins= # Comma-separated list of origins to allow. '*' allows all origins. When not set, CORS support is disabled.
|
||||
management.endpoints.cors.exposed-headers= # Comma-separated list of headers to include in a response.
|
||||
management.endpoints.cors.max-age=1800 # How long, in seconds, the response from a pre-flight request can be cached by clients.
|
||||
|
||||
# ENDPOINTS WEB CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/web/WebEndpointProperties.{sc-ext}[WebEndpointProperties])
|
||||
management.endpoints.web.base-path=/application # Base path for Web endpoints. Relative to server.context-path or management.server.context-path if management.server.port is configured.
|
||||
|
||||
# ENDPOINTS JMX CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/jmx/JmxEndpointExporterProperties.{sc-ext}[JmxEndpointExporterProperties])
|
||||
management.endpoints.jmx.enabled= # Whether JMX endpoints are enabled
|
||||
management.endpoints.jmx.expose= The IDs of endpoints to expose or '*' for all (default is 'info', 'status')
|
||||
management.endpoints.jmx.exclude= The IDs of endpoints to exclude
|
||||
management.endpoints.jmx.domain=org.springframework.boot # Endpoints JMX domain name. Fallback to 'spring.jmx.default-domain' if set.
|
||||
management.endpoints.jmx.static-names=false # Additional static properties to append to all ObjectNames of MBeans representing Endpoints.
|
||||
management.endpoints.jmx.unique-names=false # Ensure that ObjectNames are modified in case of conflict.
|
||||
|
||||
# ENDPOINTS WEB CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/web/WebEndpointProperties.{sc-ext}[WebEndpointProperties])
|
||||
management.endpoints.web.enabled= # Whether web endpoints are enabled
|
||||
management.endpoints.web.expose= The IDs of endpoints to expose or '*' for all (default is '*')
|
||||
management.endpoints.web.exclude= The IDs of endpoints to exclude
|
||||
management.endpoints.web.base-path=/application # Base path for Web endpoints. Relative to server.context-path or management.server.context-path if management.server.port is configured.
|
||||
management.endpoints.web.path=mapping= Map of endpoint IDs to the path that should expose them
|
||||
|
||||
# ENDPOINTS CORS CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/web/servlet/CorsEndpointProperties.{sc-ext}[CorsEndpointProperties])
|
||||
management.endpoints.web.cors.allow-credentials= # Set whether credentials are supported. When not set, credentials are not supported.
|
||||
management.endpoints.web.cors.allowed-headers= # Comma-separated list of headers to allow in a request. '*' allows all headers.
|
||||
management.endpoints.web.cors.allowed-methods= # Comma-separated list of methods to allow. '*' allows all methods. When not set, defaults to GET.
|
||||
management.endpoints.web.cors.allowed-origins= # Comma-separated list of origins to allow. '*' allows all origins. When not set, CORS support is disabled.
|
||||
management.endpoints.web.cors.exposed-headers= # Comma-separated list of headers to include in a response.
|
||||
management.endpoints.web.cors.max-age=1800 # How long, in seconds, the response from a pre-flight request can be cached by clients.
|
||||
|
||||
# AUDIT EVENTS ENDPOINT ({sc-spring-boot-actuator}/audit/AuditEventsEndpoint.{sc-ext}[AuditEventsEndpoint])
|
||||
management.endpoint.auditevents.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.auditevents.enabled= # Enable the auditevents endpoint.
|
||||
|
||||
# BEANS ENDPOINT ({sc-spring-boot-actuator}/beans/BeansEndpoint.{sc-ext}[BeansEndpoint])
|
||||
management.endpoint.beans.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.beans.enabled= # Enable the beans endpoint.
|
||||
|
||||
# CONDITIONS REPORT ENDPOINT ({sc-spring-boot-actuator-autoconfigure}/condition/ConditionsReportEndpoint.{sc-ext}[ConditionsReportEndpoint])
|
||||
management.endpoint.conditions.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.conditions.enabled= # Enable the conditions endpoint.
|
||||
|
||||
# CONFIGURATION PROPERTIES REPORT ENDPOINT ({sc-spring-boot-actuator}/context/properties/ConfigurationPropertiesReportEndpoint.{sc-ext}[ConfigurationPropertiesReportEndpoint])
|
||||
management.endpoint.configprops.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.configprops.enabled= # Enable the configprops endpoint.
|
||||
management.endpoint.configprops.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.
|
||||
|
||||
# ENVIRONMENT ENDPOINT ({sc-spring-boot-actuator}/env/EnvironmentEndpoint.{sc-ext}[EnvironmentEndpoint])
|
||||
management.endpoint.env.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.env.enabled= # Enable the env endpoint.
|
||||
management.endpoint.env.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.
|
||||
|
||||
# FLYWAY ENDPOINT ({sc-spring-boot-actuator}/flyway/FlywayEndpoint.{sc-ext}[FlywayEndpoint])
|
||||
management.endpoint.flyway.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.flyway.enabled= # Enable the flyway endpoint.
|
||||
|
||||
# HEALTH ENDPOINT ({sc-spring-boot-actuator}/health/HealthEndpoint.{sc-ext}[HealthEndpoint])
|
||||
endpoints.health.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.health.enabled= # Enable the health endpoint.
|
||||
|
||||
# HEAP DUMP ENDPOINT ({sc-spring-boot-actuator}/management/HeapDumpWebEndpoint.{sc-ext}[HeapDumpWebEndpoint])
|
||||
management.endpoint.heapdump.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.heapdump.enabled= # Enable the heapdump endpoint.
|
||||
|
||||
# INFO ENDPOINT ({sc-spring-boot-actuator}/info/InfoEndpoint.{sc-ext}[InfoEndpoint])
|
||||
management.endpoint.info.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.info.enabled=true # Enable the info endpoint.
|
||||
|
||||
# LIQUIBASE ENDPOINT ({sc-spring-boot-actuator}/liquibase/LiquibaseEndpoint.{sc-ext}[LiquibaseEndpoint])
|
||||
management.endpoint.liquibase.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.liquibase.enabled= # Enable the liquibase endpoint.
|
||||
|
||||
# LOG FILE ENDPOINT ({sc-spring-boot-actuator}/logging/LogFileWebEndpoint.{sc-ext}[LogFileWebEndpoint])
|
||||
management.endpoint.logfile.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.logfile.enabled= # Enable the logfile endpoint.
|
||||
management.endpoint.logfile.external-file= # External Logfile to be accessed. Can be used if the logfile is written by output redirect and not by the logging system itself.
|
||||
|
||||
# LOGGERS ENDPOINT ({sc-spring-boot-actuator}/logging/LoggersEndpoint.{sc-ext}[LoggersEndpoint])
|
||||
management.endpoint.loggers.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.loggers.enabled= # Enable the loggers endpoint.
|
||||
|
||||
# REQUEST MAPPING ENDPOINT ({sc-spring-boot-actuator-autoconfigure}/web/servlet/RequestMappingEndpoint.{sc-ext}[RequestMappingEndpoint])
|
||||
management.endpoint.mappings.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.mappings.enabled= # Enable the mappings endpoint.
|
||||
|
||||
# METRICS ENDPOINT ({sc-spring-boot-actuator}/metrics/MetricsEndpoint.{sc-ext}[MetricsEndpoint])
|
||||
management.endpoint.metrics.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.metrics.enabled= # Enable the metrics endpoint.
|
||||
|
||||
# PROMETHEUS ENDPOINT ({sc-spring-boot-actuator}/metrics/export/prometheus/PrometheusScrapeEndpoint.{sc-ext}[PrometheusScrapeEndpoint])
|
||||
management.endpoint.prometheus.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.prometheus.enabled= # Enable the metrics endpoint.
|
||||
|
||||
# SCHEDULED TASKS ENDPOINT ({sc-spring-boot-actuator}/scheduling/ScheduledTasksEndpoint.{sc-ext}[ScheduledTasksEndpoint])
|
||||
endpoints.scheduledtasks.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
endpoints.scheduledtasks.enabled= # Enable the scheduled tasks endpoint.
|
||||
endpoints.scheduledtasks.jmx.enabled= # Expose the scheduled tasks endpoint as a JMX MBean.
|
||||
endpoints.scheduledtasks.web.enabled= # Expose the scheduled tasks endpoint as a Web endpoint.
|
||||
endpoints.scheduledtasks.web.path=sessions # Path of the scheduled tasks endpoint.
|
||||
|
||||
# SESSIONS ENDPOINT ({sc-spring-boot-actuator}/session/SessionsEndpoint.{sc-ext}[SessionsEndpoint])
|
||||
management.endpoint.sessions.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.sessions.enabled= # Enable the sessions endpoint.
|
||||
|
||||
# SHUTDOWN ENDPOINT ({sc-spring-boot-actuator}/context/ShutdownEndpoint.{sc-ext}[ShutdownEndpoint])
|
||||
management.endpoint.shutdown.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.shutdown.enabled=false # Enable the shutdown endpoint.
|
||||
|
||||
# STATUS ENDPOINT ({sc-spring-boot-actuator}/health/StatusEndpoint.{sc-ext}[StatusEndpoint])
|
||||
management.endpoint.status.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.status.enabled=true # Enable the status endpoint.
|
||||
|
||||
# THREAD DUMP ENDPOINT ({sc-spring-boot-actuator}/management/ThreadDumpEndpoint.{sc-ext}[ThreadDumpEndpoint])
|
||||
management.endpoint.threaddump.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.threaddump.enabled= # Enable the threaddump endpoint.
|
||||
|
||||
# TRACE ENDPOINT ({sc-spring-boot-actuator}/trace/TraceEndpoint.{sc-ext}[TraceEndpoint])
|
||||
management.endpoint.trace.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||
management.endpoint.trace.enabled= # Enable the trace endpoint.
|
||||
|
||||
# HEALTH INDICATORS
|
||||
management.health.db.enabled=true # Enable database health check.
|
||||
management.health.cassandra.enabled=true # Enable cassandra health check.
|
||||
|
||||
@@ -7,10 +7,6 @@ Spring Boot includes a number of additional features to help you monitor and man
|
||||
application when you push it to production. You can choose to manage and monitor your
|
||||
application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering
|
||||
can also be automatically applied to your application.
|
||||
|
||||
Actuator HTTP endpoints are only available with a Spring MVC-based application. In
|
||||
particular, it does not work with Jersey <<howto.adoc#howto-use-actuator-with-jersey,
|
||||
unless you enable Spring MVC as well.>>
|
||||
--
|
||||
|
||||
|
||||
@@ -146,89 +142,114 @@ content.
|
||||
|
||||
|===
|
||||
|
||||
[[production-ready-endpoints-security]]
|
||||
=== Securing Endpoints
|
||||
By default, all HTTP endpoints are secured such that only users that have an `ACTUATOR`
|
||||
role may access them. Security is enforced by using the standard
|
||||
`HttpServletRequest.isUserInRole` method.
|
||||
|
||||
TIP: If you want to use something other than `ACTUATOR` as the role, set the
|
||||
`management.security.roles` property to the value you want to use.
|
||||
|
||||
If you deploy applications behind a firewall, you may prefer that all your actuator
|
||||
endpoints can be accessed without requiring authentication. You can do so by changing the
|
||||
`management.security.enabled` property, as follows:
|
||||
[[production-ready-endpoints-exposing-endpoints]]
|
||||
=== Exposing Endpoints
|
||||
Since Endpoints may contain sensitive information, careful consideration should be given
|
||||
about when to expose them. Out of the box, Spring Boot will expose all enabled endpoints
|
||||
over JMX, but only the `health` and `info` endpoints over HTTP.
|
||||
|
||||
To change the endpoints that are exposed you can use the `expose` and `exclude` property
|
||||
for the technology. For example, to only expose the `health` over JMX you would use:
|
||||
|
||||
.application.properties
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.security.enabled=false
|
||||
management.endpoints.jmx.expose=health
|
||||
----
|
||||
|
||||
CAUTION: By default, actuator endpoints are exposed on the same port that serves regular
|
||||
HTTP traffic. Take care not to accidentally expose sensitive information if you change
|
||||
the `management.security.enabled` property.
|
||||
|
||||
If you deploy applications publicly, you may want to add '`Spring Security`' to handle
|
||||
user authentication. When '`Spring Security`' is added, by default, '`basic`'
|
||||
authentication is used. The username is`user` and the password is a random generated
|
||||
password (which is printed on the console when the application starts).
|
||||
|
||||
TIP: Generated passwords are logged as the application starts. To find the password in
|
||||
the console, search for '`Using default security password`'.
|
||||
|
||||
You can use Spring properties to change the username and password and to change the
|
||||
security role(s) required to access the endpoints. For example, you might set the
|
||||
following properties in your `application.properties`:
|
||||
The `*` character can be used to indicate all endpoints. For example, to expose everything
|
||||
over HTTP except the `env` endpoint you would use:
|
||||
|
||||
.application.properties
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
security.user.name=admin
|
||||
security.user.password=secret
|
||||
management.security.roles=SUPERUSER
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exclude=env
|
||||
----
|
||||
|
||||
If your application has custom security configuration and you want all your actuator
|
||||
endpoints to be accessible without authentication, you need to explicitly configure that
|
||||
in your security configuration. Also, you need to change the
|
||||
`management.security.enabled` property to `false`.
|
||||
NOTE: If your application is exposed publicly we strongly recommend that you also
|
||||
<<production-ready-endpoints-security, secure your endpoints>>.
|
||||
|
||||
If your custom security configuration secures your actuator endpoints, you also need to
|
||||
ensure that the authenticated user has the roles specified under
|
||||
`management.security.roles`.
|
||||
TIP: If you want to implement your own strategy for when endpoints are exposed you can
|
||||
register an `EndpointFilter` bean.
|
||||
|
||||
TIP: If you do not have a use case for exposing basic health information to
|
||||
unauthenticated users and you have secured the actuator endpoints with custom security,
|
||||
you can set `management.security.enabled` to `false`. This tells Spring Boot to skip the
|
||||
additional role check.
|
||||
|
||||
|
||||
[[production-ready-endpoints-security]]
|
||||
=== Securing HTTP Endpoints
|
||||
You should take care to secure HTTP endpoints in the same way that you would any other
|
||||
sensitive URL. Spring Boot will not apply any security on your behalf, however, it does
|
||||
provide some convenient `ReqestMatchers` that can be used in combination with Spring
|
||||
Security.
|
||||
|
||||
A typical Spring Security configuration could look something like this:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
public class ActuatorSecurity extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests()
|
||||
.anyRequest().hasRole("ENDPOINT_ADMIN")
|
||||
.and()
|
||||
.httpBasic();
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
The above uses `EndpointRequest.toAnyEndpoint()` to match a request to any endpoint, then
|
||||
ensure that thet all have the `ENDPOINT_ADMIN` role. Several other matcher methods are
|
||||
also available on `EndpointRequest` (see the API documentation for details).
|
||||
|
||||
If you deploy applications behind a firewall, you may prefer that all your actuator
|
||||
endpoints can be accessed without requiring authentication. You can do so by changing the
|
||||
`management.endpoints.web.expose` property, as follows:
|
||||
|
||||
.application.properties
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.web.expose=*
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[production-ready-customizing-endpoints]]
|
||||
=== Customizing Endpoints
|
||||
Endpoints can be customized by using Spring properties. You can change whether an
|
||||
endpoint is `enabled`.
|
||||
endpoint is `enabled` and the amount of time it will cache reponses.
|
||||
|
||||
For example, the following `application.properties` enables the `shutdown` endpoint:
|
||||
For example, the following `application.properties` changes the time-to-live of the
|
||||
`beans` endpoint and also enables `shutdown`:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
endpoints.shutdown.enabled=true
|
||||
management.endpoint.beans.cache.time-to-live=10
|
||||
management.endpoint.shutdown.enabled=true
|
||||
----
|
||||
|
||||
NOTE: The prefix ‟`endpoints` + `.` + `id`” is used to uniquely identify the endpoint
|
||||
that is being configured.
|
||||
NOTE: The prefix `management.endpoint.<name>` is used to uniquely identify the
|
||||
endpoint that is being configured.
|
||||
|
||||
By default, all endpoints except for `shutdown` are enabled. If you prefer to specifically
|
||||
"`opt-in`" endpoint enablement, you can use the `endpoints.default.enabled` property. For
|
||||
example, the following settings disables _all_ endpoints except for `info`:
|
||||
By default, all endpoints except for `shutdown` are enabled. If you prefer to
|
||||
specifically "`opt-in`" endpoint enablement, you can use the
|
||||
`management.endpoints.enabled-by-default` property. For example, the following settings
|
||||
disable _all_ endpoints except for `info`:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
endpoints.default.enabled=false
|
||||
endpoints.info.enabled=true
|
||||
management.endpoints.enabled-by-default=flase
|
||||
management.endpoint.info.enabled=true
|
||||
----
|
||||
|
||||
NOTE: Disabled endpoints are removed entirely from the `ApplicationContext`. If you only
|
||||
want to change the technologies over which an endpoint is exposed you can use the `expose`
|
||||
and `exclude` properties (see <<production-ready-endpoints-exposing-endpoints>>).
|
||||
|
||||
|
||||
|
||||
[[production-ready-endpoint-hypermedia]]
|
||||
@@ -244,6 +265,25 @@ disabled to prevent the possibility of a clash with other mappings.
|
||||
|
||||
|
||||
|
||||
[[production-ready-endpoint-custom-mapping]]
|
||||
=== Actuator Web Endpoint Paths
|
||||
By default, endpoints are exposed over HTTP under the `/application` path using ID of the
|
||||
endpoint. For example, the `beans` endpoint is exposed under `/application/beans`. If you
|
||||
want to map endpoints to a different path you can use the
|
||||
`management.endpoints.web.path-mapping` property. You can also use
|
||||
`management.endpoints.web.base-path` if you want change the base path.
|
||||
|
||||
Here's an example that remaps `/application/health` to `/healthcheck`:
|
||||
|
||||
.application.properties
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.web.base-path=/
|
||||
management.endpoints.path-mapping.health=healthcheck
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[production-ready-endpoint-cors]]
|
||||
=== CORS Support
|
||||
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing[Cross-origin resource sharing]
|
||||
@@ -252,13 +292,13 @@ flexible way what kind of cross domain requests are authorized. If you use Sprin
|
||||
Spring WebFlux, Actuator's web endpoints can be configured to support such scenarios.
|
||||
|
||||
CORS support is disabled by default and is only enabled once the
|
||||
`management.endpoints.cors.allowed-origins` property has been set. The following
|
||||
`management.endpoints.web.cors.allowed-origins` property has been set. The following
|
||||
configuration permits `GET` and `POST` calls from the `example.com` domain:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.cors.allowed-origins=http://example.com
|
||||
management.endpoints.cors.allowed-methods=GET,POST
|
||||
management.endpoints.web.cors.allowed-origins=http://example.com
|
||||
management.endpoints.web.cors.allowed-methods=GET,POST
|
||||
----
|
||||
|
||||
TIP: See {sc-spring-boot-actuator-autoconfigure}/endpoint/web/servlet/CorsEndpointProperties.{sc-ext}[CorsEndpointProperties] for a complete list of options.
|
||||
@@ -268,14 +308,22 @@ TIP: See {sc-spring-boot-actuator-autoconfigure}/endpoint/web/servlet/CorsEndpoi
|
||||
[[production-ready-customizing-endpoints-programmatically]]
|
||||
=== Adding Custom Endpoints
|
||||
If you add a `@Bean` annotated with `@Endpoint`, any methods annotated with
|
||||
`@ReadOperation` or `@WriteOperation` are automatically exposed over JMX and, in a web
|
||||
application, over HTTP as well.
|
||||
`@ReadOperation`, `@WriteOperation` or `@DeleteOperaion` are automatically exposed over
|
||||
JMX and, in a web application, over HTTP as well.
|
||||
|
||||
TIP: If you do this as a library feature, consider adding a configuration class annotated
|
||||
with `@ManagementContextConfiguration` to `/META-INF/spring.factories` under the key,
|
||||
`org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration`. If you
|
||||
do so and if your users ask for a separate management port or address, the endpoint moves
|
||||
to a child context with all the other web endpoints.
|
||||
You can also write technology specific endpoints by using `@JmxEndpoint` or
|
||||
`@WebEndpoint`. These endpoints are filtered to their respective technologies. For
|
||||
example, `@WebEndpoint` will be exposed only over HTTP and not over JMX.
|
||||
|
||||
Finally, it's possible to write technology specific extensions using
|
||||
`@EndpointWebExtension` and `@EndpointJmxExtension`. These annotations allow you to
|
||||
provide technology specific operations to augment an existing endpoint.
|
||||
|
||||
TIP: If you add endpoints as a library feature, consider adding a configuration class
|
||||
annotated with `@ManagementContextConfiguration` to `/META-INF/spring.factories` under the
|
||||
key, `org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration`. If
|
||||
you do so and if your users ask for a separate management port or address, the endpoint
|
||||
moves to a child context with all the other web endpoints.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user