-
Notifications
You must be signed in to change notification settings - Fork 867
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
Add Spring Boot service version finder / ResourceProvider #9480
Conversation
...java/io/opentelemetry/instrumentation/spring/resources/SpringBootServiceVersionDetector.java
Show resolved
Hide resolved
Could you also add a smoke test for this similarly to Lines 90 to 95 in 93444e4
Line 24 in 93444e4
20230920.6251727205 (if I didn't mess anything up that version should contain the build-info.properties )
|
InputStream openClasspathResource(String filename, String location) { | ||
String path = location + "/" + filename; | ||
return classLoader.getResourceAsStream(path); | ||
} |
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.
Now that the SystemHelper
is used in two classes, WDYT about making it a top-level class?
} | ||
|
||
// Exists for testing | ||
public SpringBootServiceVersionDetector(SystemHelper system) { |
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.
public SpringBootServiceVersionDetector(SystemHelper system) { | |
SpringBootServiceVersionDetector(SystemHelper system) { |
} | ||
|
||
private Optional<String> getServiceVersionFromBuildInfo() { | ||
try (InputStream in = system.openClasspathResource("build-info.properties", "META-INF")) { |
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 putting "META-INF"
first makes more sense, since it's a directory that contains the build info file
try (InputStream in = system.openClasspathResource("build-info.properties", "META-INF")) { | |
try (InputStream in = system.openClasspathResource("META-INF", "build-info.properties")) { |
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.
Thanks @Hayanesh !
No description provided.