spring-boot-actuator

Spring Boot Actuator/Micrometer Metrics Disable Some

一世执手 提交于 2019-12-06 02:02:07
Is there a way to turn off some of the returned metric values in Actuator/Micrometer? Looking at them now I'm seeing around 1000 and would like to whittle them down to a select few say 100 to actually be sent to our registry. Meter filters can help in 3 ways that have been discussed with the Micrometer slack channel: Disabling metrics Combining dimensions High cardinality capping filter Micrometer comes with the first type of meter filter built in. It also support hierarchical enabling/disabling similar to how logging works (As in if have meter like my.request.total and my.request.latency you

Spring boot reset datasource on the fly

泪湿孤枕 提交于 2019-12-06 00:06:00
问题 I am trying to update datasource in Spring Boot when the DB property like DB name, password or hostname changes in the spring configuration file or custom DB property file. When the property changes the application has to update by its own by listening changes to property. I was using Spring actuator to /restart beans once the DB configuration is changed. But user has to explicitly make a post request to restart. This step has to be avoided by listening to the changes and update datasource.

Swagger2 > Document a SpringBoot MvcEndpoint

人盡茶涼 提交于 2019-12-05 20:33:24
I'm currently in the process of trying out Swagger2 on my SpringBoot project (it works great), however, it only picks up my @RestController classes. I was wondering: Can it be used to pick up a Spring-Actuator MvcEndpoint ? Can the Swagger2 components (e.g. /swagger-ui.html , /v2/api-docs ) be hosted under the management port (e.g. http://${management.address}:${management.port} ) , instead of server.port ? Application.java @EnableSwagger2 @SpringBootApplication public class Application { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis

after upgrade to Spring Boot 2, how to expose cache metrics to prometheus?

…衆ロ難τιáo~ 提交于 2019-12-05 11:31:08
I recently upgraded a spring boot application from 1.5 to 2.0.1. I also migrated the prometheus integration to the new actuator approach using micrometer. Most things work now - including some custom counters and gauges. I noted the new prometheus endpoint /actuator/prometheus does no longer publish the spring cache metrics (size and hit ratio). The only thing I could find was this issue and its related commit . Still I can't get cache metrics on the prometheus export. I tried settings some properties: management.metrics.cache.instrument-cache=true spring.cache.cache-names=cache1Name

Spring Boot Actuator - Cannot disable /info endpoint

a 夏天 提交于 2019-12-05 09:45:06
I tried disabling all actuator endpoints for production environment in application.yml configuration file: endpoints.enabled: false It works for all endpoints except for /info. How can I turn off all endpoints for given environment? UPDATE: Project I am working on is also acting as Eureka client. In documentation for Spring Cloud Netflix in section Status Page and Health Indicator ( http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html ) it says that "Eureka instance default to "/info" and "/health" respectively". Is there any solution to disable those endpoints? I was able to

custom path for prometheus actuator

人盡茶涼 提交于 2019-12-05 09:00:21
I am currently trying to migrate our prometheus lib to spring boot 2.0.3.RELEASE. We use a custom path for prometheus and so far we use a work around to ensure this. As there is the possibility for a custom path for the info- and health-endpoint, uses management.endpoint.<health/info>.path . I tried to specify management.endpoint.prometheus.path , but it was still just accessible under /actuator/prometheus . How can I use a custom path or prometheus? We enable prometheus using the following libs (snippet of our build.gradle) compile "org.springframework.boot:spring-boot-starter-actuator:2.0.3

Enable logging in spring boot actuator health check API

只谈情不闲聊 提交于 2019-12-05 08:36:25
I am using Spring boot Actuator API for the having a health check endpoint, and enabled it by : management.endpoints.web.base-path=/ management.endpoints.web.path-mapping.health=healthcheck Mentioned here Now I want to enable log in my application log file when ever the status of this above /healthcheck fails and print the entire response from this end point. What is the correct way to achieve this? Best way is to extend the actuator endpoint with @EndpointWebExtension . You can do the following; @Component @EndpointWebExtension(endpoint = HealthEndpoint.class) public class

Spring Boot 2.0 Prometheus Backward Compatibility

大兔子大兔子 提交于 2019-12-05 08:09:06
I am migrating to Spring Boot 2.0 and I am having issues with my Prometheus Metrics. I know that MicroMeter is the new way of doing stuff, which is not as crisp as the Prometheus libs but OK. My issue is that If I do not want to change my metrics now I cannot upgrade to Spring Boot 2.0. Am I right? I tried the following: Trial no 1 Keep my implementations "as is" add the new dependency io.micrometer:micrometer-registry-prometheus:1.0.2 to my app (actuator is already in there) change stuff in application.properties to get access to the endpoint actuator/prometheus => My Counters and Gauges from

Spring Boot Actuator 'http.server.requests' metric MAX time

萝らか妹 提交于 2019-12-05 05:35:10
I have a Spring Boot application and I am using Spring Boot Actuator and Micrometer in order to track metrics about my application. I am specifically concerned about the 'http.server.requests' metric and the MAX statistic: { "name": "http.server.requests", "measurements": [ { "statistic": "COUNT", "value": 2 }, { "statistic": "TOTAL_TIME", "value": 0.079653001 }, { "statistic": "MAX", "value": 0.032696019 } ], "availableTags": [ { "tag": "exception", "values": [ "None" ] }, { "tag": "method", "values": [ "GET" ] }, { "tag": "status", "values": [ "200", "400" ] } ] } I suppose the MAX statistic

How do I generate build-info.properties in the IntelliJ “out” directory on debug/run for a Spring Boot project?

为君一笑 提交于 2019-12-05 03:03:46
In my build.gradle, I have added spring build info: springBoot { mainClass = "${springBootMainClass}" buildInfo() { additionalProperties = [ name: "${appName}", version: "${version}-${buildNumber}", time: buildTime() ] } } def buildTime() { final dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ") dateFormat.timeZone = TimeZone.getTimeZone('GMT') dateFormat.format(new Date()) } When I run from the command line, this correctly adds the /META-INF/build-info.properties file into /build/resources/main so that the "/info" endpoint shows the build information in JSON. When I run from