New - Prefer detected service name to service key one in azure app service#540
Open
cleverchuk wants to merge 1 commit into
Open
New - Prefer detected service name to service key one in azure app service#540cleverchuk wants to merge 1 commit into
cleverchuk wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR shifts cloud/host resource detection to upstream OpenTelemetry AWS/Azure resource detectors, simplifies the agent’s own host-id resource attributes accordingly, and centralizes service.name / service-key reconciliation into the shared ResourceCustomizer so a single path controls the resolved service identity.
Changes:
- Enable upstream
aws/azureresource providers and adjust detector/provider ordering so upstream cloud attributes win on merge. - Trim
HostIdResourceUtildown to agent-specific attributes and seed resource accumulation from the OTel SDK default resource. - Move service-name reconciliation into
ResourceCustomizer, update tests/smoke-tests, and bump agent version to 3.3.0.
Reviewed changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| smoke-tests/src/test/java/com/solarwinds/SmokeTestV2.java | Removes validation-only log assertion for service name. |
| smoke-tests/src/test/java/com/solarwinds/SmokeTest.java | Removes validation-only log assertion for service name. |
| smoke-tests/src/test/java/com/solarwinds/containers/SpringBootWebMvcContainer.java | Sets OTEL_SERVICE_NAME explicitly for smoke-test container. |
| smoke-tests/src/test/java/com/solarwinds/containers/PetClinicRestContainer.java | Sets OTEL_SERVICE_NAME explicitly for smoke-test container. |
| libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/ResourceCustomizerTest.java | Adds service-name/service-key reconciliation test coverage and resets config between tests. |
| libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/ResourceCustomizer.java | Implements centralized service-name resolution and service-key rewrite during resource customization. |
| libs/shared/build.gradle.kts | Excludes Guava/Protobuf from CEL sampler dependency to avoid duplication. |
| libs/lambda/src/main/java/com/solarwinds/opentelemetry/extensions/LambdaConfigurationLoader.java | Removes duplicated service-name/service-key reconciliation logic. |
| custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/HostIdResourceUtilTest.java | Updates host-id test to reflect reduced attribute responsibility. |
| custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/ConfigurationLoaderTest.java | Removes service-name/service-key reconciliation tests (logic moved). |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java | Enables upstream AWS/Azure resource detectors by default (when agent enabled). |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/HostIdResourceProvider.java | Forces host-id resource provider to run early via order(). |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/ResourceComponentProvider.java | Seeds static accumulated resource from Resource.getDefault() and merges agent attrs into it. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/CustomConfigCustomizerProvider.java | Enforces detector ordering so upstream detectors run after SWO detectors. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/HttpSettingsReader.java | Extends debug logging context for fetched settings. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/HostIdResourceUtil.java | Removes AWS/Azure/container/pid/etc attributes now owned by upstream detectors. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/ConfigurationLoader.java | Removes duplicated service-name/service-key reconciliation logic. |
| build.gradle.kts | Bumps agent version to 3.3.0. |
| .gitignore | Ignores buildSrc/.kotlin/ output. |
cleverchuk
force-pushed
the
cc/NH-138965
branch
2 times, most recently
from
July 20, 2026 18:08
71881d3 to
60ace60
Compare
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.
Summary
Centralizes service name resolution into
ResourceCustomizerand introduces environment-aware precedence: on Azure App Service, the OTel-detected service name takes priority over the name embedded in the service key. For all other environments, the service key name continues to win. The service key is then updated to stay in sync with the resolved name.What changed and why
Service name resolution moved to
ResourceCustomizerThe service name synchronization logic was previously duplicated in both
ConfigurationLoaderandLambdaConfigurationLoader. It ran during config loading — before OTel resource detection — which meant it could not see Azure-injected resource attributes. Both copies have been removed, and the logic now lives entirely inResourceCustomizer.apply(), which runs after resource detection.Azure App Service gets detected name precedence
Azure App Service uses OTel resource detection to inject a meaningful
service.name(the app name). The old logic always overwrote this with the service key name.The new
getServiceNamemethod applies this rule:otel.service.name): service key name wins.cloud.platform = azure.app_service): detected name wins, unless it isnullor starts withunknown_(i.e., the OTel SDK fallback placeholder), in which case the service key name is used.otel.service.nameset: detected/config name wins in all environments.Service key kept in sync
After resolving the final service name,
updateServiceKey()rewrites the service key as{apiKey}:{resolvedName}. This ensures the collector receives a consistent key regardless of which name source won.Dependency exclusions for
opentelemetry-cel-samplerGuava and protobuf are now excluded from the
opentelemetry-cel-samplertransitive dependency tree. Both are already on the classpath via the agent and were causing version conflicts at runtime.Smoke test validation log removed
The old debug log line (
"This log line is used for validation only: service.name: ...") has been replaced with a properinfolog ("Resolved service name: ...") and the smoke test assertions referencing the old line have been removed.HttpSettingsReaderdebug log enrichedThe debug log now includes
serviceNameandhostnamealongside the fetched settings, making it easier to correlate settings fetches with the service identity at the time of the call.