Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to integrate with Spring boot actuator? #123

Open
ortizman opened this issue Oct 8, 2021 · 4 comments
Open

How to integrate with Spring boot actuator? #123

ortizman opened this issue Oct 8, 2021 · 4 comments

Comments

@ortizman
Copy link

ortizman commented Oct 8, 2021

I am using this starter to expose JAX-RS resources.
Now I want to integrate Spring boot Actuator
Simply, I insert the dependency in my build.gradle

Dependency
implementation 'org.springframework.boot:spring-boot-starter-actuator'.

LOGS
INFO 1386771 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'.
But I can't access it.

Is there any alternative to access these endpoints without having to migrate to Jersey?

@liweinan
Copy link
Contributor

Hi @ortizman ,

I used the example in the project:

And added actuator into pom.xml according to the doc:

image

Then I started the sample-app:

image

Then I tried to access the endpoint provided by actuator:

➤ curl http://localhost:8080/actuator

From the output I can see the actuator output:

image

Does this solve your problem?

@jbaris
Copy link

jbaris commented Dec 2, 2021

As doc https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.monitoring

Actuator is supported natively with Spring MVC, Spring WebFlux, and Jersey.

The sample project you mentioned uses Spring MVC https://github.com/resteasy/resteasy-spring-boot/blob/main/sample-app/pom.xml#L38
that's why actuator is working.

I think @ortizman is asking for a native support for Resteasy (in the same way of the above technologies)

This native support should cover the http tracing features of actuator https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.tracing

@liweinan
Copy link
Contributor

liweinan commented Dec 2, 2021

@jbaris I created a Pull Request to verify the actuator behavior :

I deployed the sample into WildFly:

image


image

And I can see that webmvc is the core part that enable the actuator:

image

If I enable the above webmvc and then the actuator can work:

image

I need to check the detail implementation of spring-webmvc to see how it works to support actuator.

@jbaris
Copy link

jbaris commented Dec 3, 2021

Just for the record:
If you are using a JaxRS application like:
@ApplicationPath("") (note this app runs on the root path)

This application will conflict with the spring-mvc path for Actuator.
To solve this, just use:

management.server.port=8085
for open Actuator on another Tomcat instance

or:

spring.mvc.servlet.path=/actuator
to run spring the mvc endpoint at another path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants