New - Enable upstream resource detectors for Azure and AWS and defer to upstream service name#540
Open
cleverchuk wants to merge 1 commit into
Open
New - Enable upstream resource detectors for Azure and AWS and defer to upstream service name#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. |
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 agent previously hand-rolled all cloud and host resource attribute detection
(AWS EC2 metadata, Azure VM/App Service metadata, container id, pid, etc.) inside
HostIdResourceUtil. This change hands cloud detection over to the upstreamOpenTelemetry AWS and Azure resource detectors, trims our own detector down to the
attributes only we can provide, and consolidates the previously duplicated
otel.service.name/ service-key reconciliation logic into a single place that runsduring resource customization.
What changed
Enable upstream detectors. The Azure and AWS resource providers are turned on via
otel.resource.providers.azure.enabledandotel.resource.providers.aws.enabled.Trim our own detector.
HostIdResourceUtilno longer emits cloud/host attributesthat the upstream detectors now own (AWS EC2 host/cloud attributes, Azure VM and App
Service metadata, container id, process pid, uuid, service instance id, EC2
availability zone). It retains only what remains agent-specific: MAC addresses, Heroku
dyno id, UAMS client id, Kubernetes pod/namespace metadata, and hostname.
Detector ordering. Our SWO resource detector and host-id detector are placed first,
and the upstream detectors are appended so they run last. Combined with last-writer-wins
merge semantics, this lets upstream cloud attributes take precedence over our host-id
values where they overlap.
HostIdResourceProvideris givenInteger.MIN_VALUEorderto reinforce that it yields to other providers. A comment documents this ordering
contract so it isn't silently broken by a future reorder.
Service-name consolidation. The
otel.service.name/ service-key logic is removedfrom both the standard and Lambda configuration loaders and reimplemented in the resource
customizer. It resolves the service name from the resource, falling back to the name
embedded in the service key when the resource value is missing or the SDK's
unknown_servicedefault, and writes the resolved name back into both the resource andthe service key so downstream settings requests use a consistent name.
Resource accumulation. The shared resource component now seeds from the SDK default
resource and merges agent attributes into it, rather than starting from null, so the
customizer always has a valid base resource to build on.
Validation log removed. The debug log line previously emitted solely for smoke-test
validation is gone; the smoke tests now assert service naming by setting
OTEL_SERVICE_NAMEon the test containers directly, which is a more realistic path than matching a log string.
Dependency hygiene. Guava and protobuf are excluded from the CEL sampler dependency
since the agent already provides them.
Testing
the resource, fallback to the service key when the resource name is unknown or null, the
no-key case, and verification that the service key is updated with the resolved name.
OTEL_SERVICE_NAMEand drop the removed validation logassertion.
Notes
Note
changes observable behavior. Previously the service key was the source of truth:
the name embedded in
SW_APM_SERVICE_KEYwas propagated tootel.service.nameatconfig-load time. Now the resource's
service.name— which can originate fromOTEL_SERVICE_NAME, the OTel SDK, or upstream detectors — takes precedence, and theservice key is rewritten to match it. The practical consequences:
OTEL_SERVICE_NAMEwill now have that value override the namein the service key, and the resolved name flows into the settings-fetch endpoint.
This is why the smoke tests now set
OTEL_SERVICE_NAMEexplicitly.resource carries a different service name, so the reported service identity may
change for existing deployments after upgrade. Operators should set their confirmed
service name via
OTEL_SERVICE_NAMEbefore upgrading.AWS and Azure attributes are now produced by the upstream OTel detectors rather than
our own readers, the emitted attribute set will differ from prior releases:
and values may differ from what the agent previously emitted. The upstream Azure VM
detector provides
azure.vm.scaleset.name,azure.vm.sku,cloud.resource_id,cloud.region,host.id,host.name,host.type,os.type, andos.version.azure.vm.name,azure.vm.size,azure.resourcegroup.name,azure.app.service.instance.id, anduuid.endpoints, so which cloud attributes appear — and whether they appear at all — is
governed by upstream behavior rather than our logic.
attributes) should be reviewed against the upstream conventions before upgrading, as
the attribute names and coverage will shift.