Skip to content

New - Enable upstream resource detectors for Azure and AWS and defer to upstream service name#540

Open
cleverchuk wants to merge 1 commit into
mainfrom
cc/NH-138965
Open

New - Enable upstream resource detectors for Azure and AWS and defer to upstream service name#540
cleverchuk wants to merge 1 commit into
mainfrom
cc/NH-138965

Conversation

@cleverchuk

Copy link
Copy Markdown
Contributor

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 upstream
OpenTelemetry 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 runs
during resource customization.

What changed

Enable upstream detectors. The Azure and AWS resource providers are turned on via
otel.resource.providers.azure.enabled and otel.resource.providers.aws.enabled.

Trim our own detector. HostIdResourceUtil no longer emits cloud/host attributes
that 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. HostIdResourceProvider is given Integer.MIN_VALUE order
to 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 removed
from 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_service default, and writes the resolved name back into both the resource and
the 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_NAME
on 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

  • New resource-customizer tests cover the service-name resolution paths: name present in
    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.
  • The host-id detector test was narrowed to reflect its reduced responsibility.
  • Smoke tests updated to set OTEL_SERVICE_NAME and drop the removed validation log
    assertion.

Notes

Note

  • Version bumped to 3.3.0 (minor) because the service-name resolution protocol
    changes observable behavior.
    Previously the service key was the source of truth:
    the name embedded in SW_APM_SERVICE_KEY was propagated to otel.service.name at
    config-load time. Now the resource's service.name — which can originate from
    OTEL_SERVICE_NAME, the OTel SDK, or upstream detectors — takes precedence, and the
    service key is rewritten to match it. The practical consequences:
    • Deployments that set OTEL_SERVICE_NAME will now have that value override the name
      in the service key, and the resolved name flows into the settings-fetch endpoint.
      This is why the smoke tests now set OTEL_SERVICE_NAME explicitly.
    • The service key sent to the collector can differ from what was configured if the
      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_NAME before upgrading.
  • Cloud resource attributes change with the switch to upstream detectors. Because
    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:
    • The upstream detectors follow current OTel semantic conventions, so attribute keys
      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, and os.version.
    • These agent-emitted keys are no longer present: azure.vm.name, azure.vm.size,
      azure.resourcegroup.name, azure.app.service.instance.id, and uuid.
    • Detection now depends on the upstream detectors' own environment checks and metadata
      endpoints, so which cloud attributes appear — and whether they appear at all — is
      governed by upstream behavior rather than our logic.
    • Consumers of these attributes (dashboards, alerts, queries that key off cloud/host
      attributes) should be reviewed against the upstream conventions before upgrading, as
      the attribute names and coverage will shift.

Copilot AI review requested due to automatic review settings July 17, 2026 17:25
@cleverchuk
cleverchuk requested review from a team as code owners July 17, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/azure resource providers and adjust detector/provider ordering so upstream cloud attributes win on merge.
  • Trim HostIdResourceUtil down 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants