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

Discover service.version attribute from Spring Boot's build-info.properties file #9457

Closed
philsttr opened this issue Sep 13, 2023 · 2 comments · Fixed by #9480
Closed

Discover service.version attribute from Spring Boot's build-info.properties file #9457

philsttr opened this issue Sep 13, 2023 · 2 comments · Fixed by #9480
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request

Comments

@philsttr
Copy link
Contributor

philsttr commented Sep 13, 2023

Is your feature request related to a problem? Please describe.

Not really a "problem", but just a minor annoyance that I have to find some alternative way to specify the service.version attribute, even though the metadata is available in the application's jar.

Describe the solution you'd like

The Spring Boot maven/gradle plugins provide a way to generate a build information for Spring Boot applications. The plugins generate a file named META-INF/build-info.properties. For example, the generated file might look like the following:

build.artifact=example-app
build.group=com.example
build.name=example-app
build.time=2023-08-24T12\:04\:36.605Z
build.version=1.0.0

Notice the build.version property.

It would be great if the spring-boot-resources instrumentation defined a ResourceProvider that would set the service.version resource attribute from the build.version property found in the META-INF/build-info.properties file.

This would make version discovery automatic for Spring Boot applications that already include build info.

Describe alternatives you've considered

alternative 1:
Manually set the service.version resource attribute.

alternative 2:
A more-generic ResourceProvider could be created that takes the name of a class as input, and then retrieves its version information via clazz.getPackage().getImplementationVersion(), which pulls info from its jar's META-INF/MANIFEST.MF.

This alternative is not as "automatic" as using the Spring Boot build-info.properties file, since it requires additional input. But it would support any Java application (assuming the metadata is in its manifest). Not just Spring Boot apps.

Additional context

No response

@philsttr philsttr added enhancement New feature or request needs triage New issue that requires triage labels Sep 13, 2023
@mateuszrzeszutek mateuszrzeszutek added contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome and removed needs triage New issue that requires triage labels Sep 13, 2023
@mateuszrzeszutek
Copy link
Member

It would be great if the spring-boot-resources instrumentation defined a ResourceProvider that would set the service.version resource attribute from the build.version property found in the META-INF/build-info.properties file.

That's a great idea 👍
We would welcome a contribution that implements that.

@Hayanesh
Copy link
Contributor

Hi @mateuszrzeszutek, Please find the Pull Request for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request
Projects
None yet
3 participants