-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Expose Spring Integration graph using an actuator #12331
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
Expose Spring Integration graph using an actuator #12331
Conversation
…e with the injected application context
*/ | ||
@Configuration | ||
@ConditionalOnClass(IntegrationGraphServer.class) | ||
public class IntegrationGraphEndpointAutoConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to add this to spring.factories
as well, see /spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/spring.factories
.
This mechanism facilitates the fact that the autoconfiguration classes can be looked up instead are discovered via a package scan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! For some reason it didn't get committed & pushed, but I do remember making the change 🤔
Anyway, will do that right away! Thanks!
@garyrussell @artembilan what do you think please? |
Fine with me; SI currently only supports MVC and WebFlux. Thanks Tim! My only question is whether we should auto configure a This seems to be dependent on the presence of a bean; there is little overhead if it's never referenced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, we need to auto-configure an IntegrationGraphServer
bean. And I think there is just enough to add one conditional into the IntegrationAutoConfiguration.IntegrationConfiguration
.
@wilkinsona , I'd be glad to see your comments regarding code style.
Thanks
=== Response Structure | ||
|
||
The response contains all Spring Integration components used within the application, as well as the links between them. | ||
More info about the structure can be found in the https://docs.spring.io/spring-integration/reference/htmlsingle/#integration-graph[subchapter] for the integration graph in the reference documentation of Spring Integration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't use htmlsingle
here as a cross-link. Consider to switch to this one: https://docs.spring.io/spring-integration/reference/html/system-management-chapter.html#integration-graph.
Also I don't think that info
is formal word. The information
doesn't pull any questions from me 😄
@@ -0,0 +1,49 @@ | |||
/* | |||
* Copyright 2012-2018 the original author or authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
import org.springframework.integration.support.management.graph.IntegrationGraphServer; | ||
|
||
/** | ||
* {@link EnableAutoConfiguration Auto-configuration} for the {@link IntegrationGraphEndpoint}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it's good idea to use imports only for JavaDocs.
Not sure how it is for Spring Boot, but in SI we disallow such a code via particular Checkstyle rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a similar restriction, but now I'm wondering if we should. It's fine for now.
@@ -0,0 +1,20 @@ | |||
/* | |||
* Copyright 2012-2018 the original author or authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really OK to have Copyright in the package-info.java
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please, that's consistent with the others that we have.
/** | ||
* Tests for generating documentation describing the {@link IntegrationGraphEndpoint}. | ||
* | ||
* @author Tim Ysewyn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @since 2.1.0
is applied to test classes as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we don't @since
tests.
@@ -0,0 +1,49 @@ | |||
/* | |||
* Copyright 2012-2018 the original author or authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
@garyrussell @artembilan I was thinking the same. Should I just put following under
And is this PR the right one to do this? I would assume that you would like to backport this to 1.x if possible? |
IMO that's the right place to do that. |
…there isn’t one yet
@artembilan @garyrussell last addition has been pushed. |
@TYsewyn we'll review and assign a milestone to this one in due course. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I took an extensive look at this one and polished in my own fork. I didn't like the fact an I've tried to make it conditional to the fact that the endpoint is not enabled but there is no easy way to do that as Also I didn't get why the endpoint is disabled by default. Is that really what we want? |
I had the same thought originally, Stephane. Right, the If that is still a concern, let's consider to instantiate it from some actuator auto-configuration then! +1 do not make the endpoint disabled by default. Missed that part somehow during review... Thanks |
Thanks for the feedback.
I am not sure I agree with that. There is an event listener that will build the graph once the context has refreshed. I see no reason to have that running if you don't use the actuator. If you need this feature, you can define the bean (as you'd probably do now).
That's fine but IMO there is a difference between providing this (that only the endpoint would be using) and providing this when the endpoint is required. My preference is for the latter but unfortunately, that's not easy to implement.
I've already changed that in my polish commit |
Stephane, I think we're good to go with your polishing: you have addressed all the concerns! 👍 |
I disabled the endpoint because there wasn't an |
@@ -105,6 +105,10 @@ exchanges). | |||
|Displays arbitrary application info. | |||
|Yes | |||
|
|||
|`integrationgraph` | |||
|Exposes the Spring Integration graph. | |||
|No |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snicoll Can you update this in your polishing commit to indicate that it will be enabled by default? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, thanks for the ping.
I did not I think. I wish that the @artembilan how can I know that SI is enabled on a project? Is there a typical bean I could look for? |
@snicoll , I think you can create Hope that helps. |
Thanks for the feedback @artembilan
Actually I can't at the moment, so we'll have to change the condition if you want to make that happen. |
I've created #12945 to improve the condition. If this is merged, I can prevent |
@TYsewyn that's now merged in |
…raph * pr/12331: Polish "Add actuator endpoint for exposing the Spring Integration graph" Add actuator endpoint for exposing the Spring Integration graph
Thanks everyone for the valuable feedback! |
Based on the idea of @michael-simons (read this post), this PR will add the functionality of exposing the Spring Integration graph via JMX, Jersey, Spring MVC & WebFlux.
NB: Currently says
@since 2.1.0
in the Javadoc.