-
Notifications
You must be signed in to change notification settings - Fork 871
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
spring boot starter: add service.version detection, improve service.name detection #10457
spring boot starter: add service.version detection, improve service.name detection #10457
Conversation
664d560
to
a2c210a
Compare
@jeanbisutti in this PR, where the test uses graalvm native, the following is needed to read the version: springBoot {
buildInfo()
} In Does this make sense? |
FYI, the
I guess you are refering to this code change in #10515: This code is related to a smoke test for which a Spring Boot application is package as a JAR and included in a Docker image. So, without With |
6da560f
to
248cfb1
Compare
248cfb1
to
e08bdda
Compare
…ect based on build-info.properties
removed the jar detector, because the manifest detector will always find a name and version for spring boot. |
* | ||
* <p>Note: should not be used inside a spring application, where the spring.application.name is | ||
* already available. |
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 didn't understand this note?
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.
In spring, there's a resource provider that uses the always correct, pre-computed value from the spring environment.
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.
sorry, still not following
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.
the spring boot starter uses SpringResourceProvider, which doesn't need to parse any application.yaml, etc. file, because when you run inside a sprig application, you can just ask the environment.
In this case, the lookup is here:
Line 45 in d8aa0f5
String value = environment.getProperty(name, String.class); |
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.
so SpringBootServiceNameDetector should only be used by the Java agent?
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, exactly.
The provider will actually notice if a name found using shouldApply
- so it's just a note about the intended usage.
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.
could SpringBootServiceNameDetector
be moved to a (new) spring-boot-resources/javaagent
to make this extra clear?
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've done this move in #10621 - because this
PR moves SystemHelper
to the common resource project (for other reasons).
Hope this makes sense.
Don't use the spring resource detector library, because that inspects a spring application from the outside - inside a spring app it's much easier.
service.name is detected in the following order (highest priority first)
Fixes #10368