spring-boot-actuator

SpringBoot Disable rabbitTemplate retry policy for rabbit health check

非 Y 不嫁゛ 提交于 2019-12-04 18:15:18
My SpringBoot configuration contains very strong retry policy for rabbitTemplate retries spring: rabbitmq: template: retry: enabled: true initial-interval: 500 max-attempts: 10 multiplier: 5 max-interval: 60000 The problem with this configuration is when health endpoint is called and rabbitMQ is down, the connections hangs for really long time. Adding properties like spring.rabbitmq.connection-timeout=500 or spring.rabbitmq.template.receive-timeout=500 or spring.rabbitmq.template.reply-timeout=500 or spring.rabbitmq.requested-heartbeat=1 does not help, since the retry.multiplier=5 , so it will

Spring Boot production monitoring

五迷三道 提交于 2019-12-04 10:52:11
Spring Boot Actuator exposes a lot of metrics and information of the deployed container. However, production operations guys probably don't want to stare at pure JSON objects on their browser :) What would be good "standard" tools for monitoring this in production? This would include graphs, triggers for alerts, etc. The spring-boot-admin project is also a great monitoring tool that your production support guys may be interested in. It doesn't process and graph the metrics at all like graphite+grafana, but it is a great simple tool to setup and use to see the state of all of your running

Micrometer - Prometheus Gauge displays NaN

北城余情 提交于 2019-12-04 09:59:57
I am trying to generate Prometheus metrics with using Micrometer.io with Spring Boot 2.0.0.RELEASE. When I am trying to expose the size of a List as Gauge, it keeps displaying NaN. In the documentation it says that; It is your responsibility to hold a strong reference to the state object that you are measuring with a Gauge. I have tried some different ways but I could not solve the problem. Here is my code with some trials. import io.micrometer.core.instrument.*; import io.swagger.backend.model.Product; import io.swagger.backend.service.ProductService; import org.springframework.beans.factory

Spring boot reset datasource on the fly

主宰稳场 提交于 2019-12-04 04:59:15
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. Can you tell me the best way to do this in Spring boot? vishnukumar Found a way to update datasource on

Unit testing of Spring Boot Actuator endpoints not working when specifying a port

…衆ロ難τιáo~ 提交于 2019-12-04 02:58:09
recently I changed my spring boot properties to define a management port. In doing so, my unit tests started to fail :( I wrote a unit test that tested the /metrics endpoint as follows: @RunWith (SpringRunner.class) @DirtiesContext @SpringBootTest public class MetricsTest { @Autowired private WebApplicationContext context; private MockMvc mvc; /** * Called before each test. */ @Before public void setUp() { this.context.getBean(MetricsEndpoint.class).setEnabled(true); this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); } /** * Test for home page. * * @throws Exception On

How to measure service methods using spring boot 2 and micrometer

泪湿孤枕 提交于 2019-12-03 16:10:47
问题 I started my first project on Spring Boot 2 (RC1). Thanks to the already good documentation this has not been to hard coming from Spring Boot 1.x. However now that I want to integrate metrics I'm stumbeling. As far as I was able to find currently there is only documentation for the metrics shipped by default. But I'd like to also measure service level execution time as well as the time used in dynamodb. EDIT I'm looking for a solution using Micrometer, the library used in the new actuator

Spring Boot Actuator Endpoints security doesn't work with custom Spring Security Configuration

吃可爱长大的小学妹 提交于 2019-12-03 06:14:12
This is my Spring Boot 1.5.1 Actuator application.properties : #Spring Boot Actuator management.contextPath: /actuator management.security.roles=R_0 This is my WebSecurityConfig : @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsService userDetailsService; @Value("${logout.success.url}") private String logoutSuccessUrl; @Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.addFilterBefore(new CorsFilter(), ChannelProcessingFilter.class); http .csrf()

Unable to access Spring Boot Actuator “/actuator” endpoint

非 Y 不嫁゛ 提交于 2019-12-03 05:44:09
问题 I am able to access endpoints like http://localhost:8081/health , /status , /env , /metrics , /shutdown but not /actuator or /loginfo endpoints. Getting below exception. {"timestamp":1455929182552,"status":404,"error":"Not Found","message":"No message available","path":"/actuator"} How to acccess http://localhost:8081/actuator endpoint? 回答1: As of spring boot version 2.0.1 using below property would work management.endpoints.web.exposure.include=<comma separated endpoints you wish to expose>

How to measure service methods using spring boot 2 and micrometer

与世无争的帅哥 提交于 2019-12-03 05:25:17
I started my first project on Spring Boot 2 (RC1). Thanks to the already good documentation this has not been to hard coming from Spring Boot 1.x. However now that I want to integrate metrics I'm stumbeling. As far as I was able to find currently there is only documentation for the metrics shipped by default. But I'd like to also measure service level execution time as well as the time used in dynamodb. EDIT I'm looking for a solution using Micrometer, the library used in the new actuator library shipped with spring-boot 2. Is there any guide on how this should be done? From this I read that

Call Spring actuator /restart endpoint from Spring boot using a java function

社会主义新天地 提交于 2019-12-02 13:20:16
问题 I'm looking to restart the spring boot app, so using Spring Actuator /restart endpoint is working using curl, but i'm looking to call the same function using java code from inside the app, i've tried this code, but it's not working: Thread thread = new Thread(new Runnable() { @Override public void run() { RestartEndpoint p = new RestartEndpoint(); p.invoke(); } }); thread.setDaemon(false); thread.start(); 回答1: You need to inject the RestartEndPoint: @Autowired private RestartEndpoint