Repository navigation
Fix - Extract shared default properties and disable ServiceInstanceIdResourceProvider(lambda) - #680
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the change centralizing shared OpenTelemetry defaults.
No open issues 🎉
What changed in this PR
Centralizes shared OpenTelemetry defaults for the Java agent and Lambda extension. This extends #679’s provider-disable setting to Lambda, preventing competing providers from setting service.instance.id.
Changes:
- Extracts five common defaults into
SharedPropertiesSupplier. - Registers the shared supplier before each distribution-specific supplier and removes duplicated defaults.
- Adds tests for shared values and updates tests to verify supplier registration.
| File | Description |
|---|---|
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SharedPropertiesSupplierTest.java |
Verifies all five shared default values. |
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/SharedPropertiesSupplier.java |
Defines common defaults, including disabling the upstream instance-ID provider. |
libs/lambda/src/test/java/com/solarwinds/opentelemetry/extensions/DefaultAutoConfigurationCustomizerProviderTest.java |
Verifies registration of both Lambda suppliers. |
libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/PropertiesSupplier.java |
Removes defaults moved to the shared supplier. |
libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/DefaultAutoConfigurationCustomizerProvider.java |
Registers shared defaults before Lambda-specific defaults. |
custom/src/test/java/com/solarwinds/opentelemetry/extensions/provider/AutoConfigurationCustomizerProviderImplTest.java |
Verifies registration of both agent suppliers. |
custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java |
Removes defaults moved to the shared supplier. |
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/AutoConfigurationCustomizerProviderImpl.java |
Registers shared defaults before agent-specific defaults. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
The javaagent and the Lambda extension each set the same OTel default properties in their own supplier. This PR moves those defaults into one
SharedPropertiesSupplierthat both distributions register. As a result, Lambda now also disables the upstreamServiceInstanceIdResourceProvider, as the agent has done since #679, so both distributions getservice.instance.idfromApmResourceProvider.Motivation
#679 disabled
ServiceInstanceIdResourceProvideronly in the agent'sSolarwindsPropertiesSupplier. However,ApmResourceProvider, which now setsservice.instance.id, lives in the shared library and runs in Lambda too. In Lambda, both providers therefore setservice.instance.id, and the value that wins depends on the order the providers run in.Several other defaults were also copied into both suppliers, so the two could drift apart. Keeping one source of truth for the common defaults avoids that.
Changes
SharedPropertiesSupplier(shared library) with the common defaults:otel.java.experimental.span-stacktrace.filter→ SolarWinds span stacktrace filterotel.semconv-stability.opt-in=database/dupotel.exporter.otlp.metrics.temporality.preference=deltaotel.exporter.otlp.metrics.default.histogram.aggregation=base2_exponential_bucket_histogramotel.java.disabled.resource.providers=io.opentelemetry.sdk.autoconfigure.ServiceInstanceIdResourceProviderAutoConfigurationCustomizerProviderImpl) registersSharedPropertiesSupplierbeforeSolarwindsPropertiesSupplier. The shared keys were removed fromSolarwindsPropertiesSupplier.DefaultAutoConfigurationCustomizerProvider) registersSharedPropertiesSupplierbeforePropertiesSupplier. The shared keys were removed fromPropertiesSupplier.Behavior changes
ServiceInstanceIdResourceProvideris now disabled.service.instance.idcomes only fromApmResourceProvider(a random UUID per process).Testing
SharedPropertiesSupplierTestchecks each shared default value.AutoConfigurationCustomizerProviderImplTestandDefaultAutoConfigurationCustomizerProviderTestverify that both the shared supplier and the distribution's own supplier are registered.Test services data