Hystrix's health endpoint not available - spring-boot

I'm trying to use the Circuit Breaker Pattern with Springboot and Netflix's Hystrix implementation and I'm struggling to access its health endpoint.
The documentation refers it should be available in /hystrix.stream but that's not happening. Also, I've noticed the following error upon theapplication initialisation: Endpoint ID 'hystrix.stream' contains invalid characters, please migrate to a valid format..
Does someone know how to solve this issue or how to change the endpoint name?
Versions:
Springboot 2.1.4.RELEASE
Spring Cloud Greenwich.SR1
Thanks in advance!

You should be able to see something like this in the logs when the server start:
INFO 14451 --- [ost-startStop-1] o.s.b.a.e.web.ServletEndpointRegistrar : Registered '/actuator/hystrix.stream' to hystrix.stream-actuator-endpoint
Try /actuator/hystrix.stream

For spring boot 2.1.x , default endpoint URL for hystrix is /actuator/hystrix.stream

Try to change spring cloud version to Hoxton.RELEASE in pom.xml:
<properties>
<java.version>11</java.version>
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
</properties>

Related

Spring boot actuator for commandline runner application

I want to enable actuator for health check in PCF for the non web or batch or commandLineRunner spring boot application.
Could some one please share some details to resolve this issue.
Please let me know if any other details required
I tried the below options
Adding actuator dependency
Adding http and jmx related properties
Since localhost:8081/actuator is not accessible could not view endpoints
How to enable url for non web app
add
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.properties
spring.jmx.enabled = true
management.endpoints.jmx.exposure.include=*
management.endpoints.jmx.domain=com.example.demomail
management.endpoints.jmx.unique-names=true
run jconsole find your application name then connect.
find Tab MBeans, find com.example.demomail in left tree.
As far as I understand you need to enable the Actuator endpoints.
You must add the Spring Boot Actuator dependency (as you have already done).
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Then in your application.properties file enable HTTP and JMX support (as you have already done).
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
management.endpoint.jmx.exposure.include=*
Now you will have to push your app to PCF and create a binding to a route to create access for the Actuator endpoint/s.
The URL to access the actuator endpoint will be something like this http://<route-url>/actuator/health
In the command line, I would use something like this to return a list of routes and the URL route of the application.
cf curl /v2/apps/<app-guid>/routes

Which is the best way for the routs uri in spring boot except zuul and spring cloud gateway

I am upgrading the spring boot 1.3.7.RELEASE to 2.5.12 and spring framework 5.3.18 in my spring boot microservice based project we have upgrade successfully with all service except gateway service when i am unabling t add zuul dependency because its maintenance mode that why we have implemented spring cloud gateway then i am getting below issue.
***************************
APPLICATION FAILED TO START
***************************
Description:
Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway.
Action:
Please set spring.main.web-application-type=reactive or remove spring-boot-starter-web dependency.
Wwhat we need to do implementation for best way?
We have fix the routing issue using the spring cloud gateway.
Please add dependency in the pom.xml
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> </dependency>
bootstrap.yml
spring:main:web-application-type:reactive
Thanks you guys for supporting.

How to produce metrics of URI correctly in spring boot 2 + webflux

I have a problem using spring boot 2.0.3 + spring webflux (functional endpoints) + metrics. According to the official doc:
The generated metrics of uri should be the request’s URI template prior to variable substitution
Which means instead of /api/person/123, the generated metrics of URI should be something like /api/person/{id}. However, when I query those metrics on my spring boot app with this link http://localhost:8080/actuator/metrics/http.server.requests, I got these URIs:
/api/person/2
/api/person/33
/api/person/12
To reproduce this issue, I put a sample code here: https://gitlab.com/itsleon/demo
Can someone please shed some light on this issue? Thanks in advance!
There's an open issue for that in Spring Boot.
Currently, Spring WebFlux fn doesn't provide the information about the URI pattern that matched for the current request, so there's no way to achieve that currently.
Your assessment is correct, currently the full request URIs are collected.

Accessing localhost:8080/actuator endpoint (with spring boot actuator)

In spring docs I have read about endpoint named "actuator" which is provided by actuator dependency, but I haven't managed to access it on my local testing app.
Question: Does someone know how to access that endpoint? of coarse if it is possible :)
Sub-question 1: If this endpoint exists, then why it is hidden?
Sub-question 2: If this endpoint doesn't exist, how can we notify spring.io to correct documentation page (open some kind of ticket) ?
Details:
I want to access exactly "actuator" endpoint, not other endpoints provided by spring boot actuator (localhost:8080/actuator)
Yes, I have tried to enable that endpoint manually in properties file (endpoints.enabled=true OR endpoints.actuator.enabled=true)
Yes, I have tried to enable/disable endpoints.sencitive property
Yes, other endpoints of actuator work just fine
No special reason why I need that, just want to try it out (just learning new stuff :) )
Please don't just answer "there is no such endpoint dude!", there should be some kind of reason why it is written in the docs
Please use spring boot version which I am using now before answering "it is working for me with these configs" (spring boot version: 1.5.4.RELEASE)
Thank you in advance :)
You must include the Spring Hateoas dependency in order for the /actuator endpoint to become available:
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
Per the docs:
Provides a hypermedia-based “discovery page” for the other endpoints.
Requires Spring HATEOAS to be on the classpath.

How to customize Spring Boot Actuator endpoints

I'm trying to implement Spring Boot Actuator on a non "Boot Application", is there a way to configure a pattern to endpoints like endpoint/health,endpoint/metrics? Then I'll create a second realm in my existing Spring Security configuration, I tried the documentation but I could not find a thing about.
Thanks.
Did you mean management.contextPath=/endpoint (docs here)?

Resources