New - Enable upstream resource detectors for Azure and AWS#541
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR shifts AWS/Azure resource attribute detection from SolarWinds’ custom HostIdResourceUtil implementation to upstream OpenTelemetry resource detectors, and adjusts detector ordering so upstream cloud attributes win under last-writer-wins resource merge semantics. It also fixes an initialization issue in declarative-config resource accumulation and updates build/dependency hygiene and logging to support the change.
Changes:
- Enable upstream AWS/Azure resource detectors via default OTel properties and remove AWS/Azure attribute population from
HostIdResourceUtil. - Reorder declarative-config resource detectors (and set
HostIdResourceProvider.order()) so SWO detectors run before upstream detectors. - Fix
ResourceComponentProviderbaseline initialization and adjust merge behavior; add dependency excludes and a small debug-log enhancement.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/shared/build.gradle.kts | Excludes guava/protobuf transitives from opentelemetry-cel-sampler to avoid dependency conflicts. |
| custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/HostIdResourceUtilTest.java | Updates unit test expectations after removing PID/host attribute assertions from HostIdResourceUtil. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsPropertiesSupplier.java | Adds default properties to enable upstream AWS/Azure resource detectors. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/HostIdResourceProvider.java | Forces SWO host-id resource provider to sort earliest via order(). |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/ResourceComponentProvider.java | Initializes accumulated resource safely and merges into it instead of replacing. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/CustomConfigCustomizerProvider.java | Changes declarative-config detector list construction to append upstream detectors after SWO detectors. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/HttpSettingsReader.java | Adds serviceName and hostname to debug logging for settings fetch correlation. |
| custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/HostIdResourceUtil.java | Removes AWS/Azure-specific attribute writes; keeps MAC/Heroku/UAMS/K8s/hostname attributes. |
| build.gradle.kts | Bumps agent version from 3.2.0 to 3.2.1. |
| .gitignore | Ignores buildSrc/.kotlin/ artifacts. |
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
Removes custom AWS and Azure metadata collection from
HostIdResourceUtiland delegates that work to the upstream OpenTelemetry resource detectors instead. Upstream detectors are explicitly enabled via configuration properties and are ordered after SWO detectors so their cloud attributes win under last-writer-wins merge semantics. Also fixes a subtle null-initialization bug inResourceComponentProviderthat could cause a NPE whenmergeis called with the detectors are reordered.What changed and why
Delegating AWS/Azure detection to upstream OTel
The agent was manually querying AWS EC2 and Azure VM metadata endpoints inside
HostIdResourceUtiland mapping the results to OTel semantic-convention attributes (cloud.*,host.*, etc.). The upstream OTel Java agent already ships resource detectors that do exactly this. Maintaining a parallel implementation creates a divergence risk as the OTel semconv evolves.The detectors are now enabled unconditionally via two properties added to
SolarwindsPropertiesSupplier:All AWS- and Azure-specific attribute writes were removed from
HostIdResourceUtil. What remains are attributes the upstream detectors don't cover: MAC addresses, Heroku dyno ID, and UAMS client ID.Detector ordering and merge semantics
OTel resource merging is last-writer-wins. To let upstream cloud attributes (from the now-enabled AWS/Azure detectors) override any overlapping host-id attributes from SWO, SWO detectors must run before upstream ones.
CustomConfigCustomizerProviderpreviously built the detector list asnew ArrayList<>(detectors)(upstream first) and then prepended SWO entries — meaning SWO attributes won the merge. The list construction is now inverted: SWO detectors are inserted first, thendetectors(the upstream list) is appended. Upstream cloud attributes now overwrite SWO's when there is a conflict.HostIdResourceProvider.order()returnsInteger.MIN_VALUEso that, in the non-declarative config path, the SWO provider is also sorted to run earliest.ResourceComponentProvidernull-safetyThe static
resourcefield was initialized tonull.create()calledresource.merge(...), which would NPE on first invocation. Changed the initializer toResource.getDefault()so the merge chain starts from a safe baseline.Dependency exclusions
Excluded
guavaandprotobuffrom theopentelemetry-cel-samplertransitive graph to prevent version conflicts with dependencies already provided by the agent.Debug logging
HttpSettingsReadernow includesserviceNameandhostnamealongside fetched settings in the debug log, making it easier to correlate settings fetches with the reporting identity during troubleshooting.Test services data