spring-projects / spring-projects/spring-boot
Support for OpenTelemetry resource detectors
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
Context
Spring Boot today builds OpenTelemetry resource attributes only from static sources:
OTEL_RESOURCE_ATTRIBUTES/OTEL_SERVICE_NAMEenvironment variablesmanagement.opentelemetry.resource-attributes.* propertiesspring.application.* defaults
There is no extension point for detecting resource information from the runtime environment like host name, OS, process ID, container metadata, cloud provider, etc. — which the OpenTelemetry spec calls resource detectors..
Use case
The motivating use case is Micrometer's OTLP metrics export. Resource attributes are currently built independently at two call sites:
OpenTelemetrySdkAutoConfiguration→ io.opentelemetry.sdk.resources.Resourcebean (traces & logs)OtlpMetricsPropertiesConfigAdapter.resourceAttributes()→Map<String,String>for Micrometer'sOtlpMeterRegistry
Because Micrometer's OTLP registry is its own implementation (not the OTel SDK), it can't consume an OTel Resource directly. This means dynamically detected attributes need to flow into both consumers consistently, or signals will disagree on resource identity.
Question for the community
Is this something Spring Boot would want to support? If so, what would be the preferred approach? A few directions come to mind:
- A Spring-native callback interface (similar to how Boot exposes other extension points), collected as beans and merged into
OpenTelemetryResourceAttributes - Adopting the OTel ResourceProvider SPI (`opentelemetry-sdk-extension-autoconfigure) — brings ecosystem compatibility but adds a heavier dependency and requires a lossy bridge for the Micrometer Map path
- Something else entirely
Happy to put together a more detailed proposal or a proof of concept if the team thinks this is worth pursuing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading OpenTelemetrySdkAutoConfiguration and OtlpMetricsPropertiesConfigAdapter.resourceAttributes(), then compare how resource attributes reach the OTel Resource bean and Micrometer's OtlpMeterRegistry. Review the OpenTelemetry resource-detector specification and the issue's proposed extension points. Done means an agreed approach or a detailed proposal/POC that keeps detected attributes consistent across both consumers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100