feat(serviceevents): resolve aws.local.environment for SE/DI in the SDK to align with CloudWatch agent - #1417
Draft
jj22ee wants to merge 2 commits into
Draft
feat(serviceevents): resolve aws.local.environment for SE/DI in the SDK to align with CloudWatch agent#1417jj22ee wants to merge 2 commits into
jj22ee wants to merge 2 commits into
Conversation
…n with CloudWatch agent ServiceEvents and Dynamic Instrumentation need aws.local.environment, which today only the CloudWatch agent sets. This adds an SDK-side resolver that computes the same value the agent's awsapplicationsignals resolver would, from the OTel Resource, with no dependency on the agent process: - EnvironmentResolver: mirror the agent's precedence — explicit deployment.environment[.name] -> eks/k8s:<cluster>/<namespace> -> ecs:<cluster> -> ec2:<asg>/ec2:default -> generic:default (never empty, matching the agent's generic resolver off-platform). - Ec2AutoScalingGroupFetcher: read the ASG name from IMDS instance tags (the stock OTel EC2 detector omits it), invoked lazily only on the EC2 branch and memoized process-wide. - DI: resolve aws.local.environment for the instrumentation-config lookup key from the autoconfigured resource. Unit tests included for the resolver, ASG fetcher, and DI config.
jj22ee
force-pushed
the
sdk-deployment-env-pr
branch
from
July 8, 2026 23:20
1efdb82 to
4b0bbfc
Compare
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1417 +/- ##
=============================================
- Coverage 85.71% 58.90% -26.82%
- Complexity 19 1654 +1635
=============================================
Files 3 140 +137
Lines 49 9803 +9754
Branches 5 1412 +1407
=============================================
+ Hits 42 5774 +5732
- Misses 3 3488 +3485
- Partials 4 541 +537 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…s own behavior The resolveLocalEnvironment javadoc said it returns "" on a non-AWS / undetected host, but the method returns generic:default (matching the CloudWatch agent's generic resolver, which never leaves Environment empty). Stale text from before the non-AWS fix; the class-level javadoc was already correct. Doc-only change.
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.
ServiceEvents and Dynamic Instrumentation need aws.local.environment, which today only the CloudWatch agent sets. This adds an SDK-side resolver that computes the same value the agent's awsapplicationsignals resolver would, from the OTel Resource, with no dependency on the agent process:
Unit tests included for the resolver, ASG fetcher, and DI config.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.