Skip to content

Conversation

@jj22ee
Copy link
Contributor

@jj22ee jj22ee commented Sep 23, 2025

Issue #, if available:

AWS Lambda Environment may or may not have the getXrayTraceId method in Lambda Context (from Lambda Core dependency). This will cause OTel's Muzzle Check to disable the AWS Lambda Instrumentation in the event that it isn't present, causing no Lambda Function Handler Span to appear

Fix of previous PR: #1191

Description of changes:

  • Use @NoMuzzle annotation when accessing getXrayTraceId in Lambda Context Object, which avoids OTel's muzzle check. If NoSuchMethodError is caught, we do not try this logic again.
  • Add unit test for when getXrayTraceId throws NoSuchMethodError.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jj22ee jj22ee requested a review from a team as a code owner September 23, 2025 20:22
@jj22ee jj22ee added skip changelog doesn't need a CHANGELOG entry and removed skip changelog doesn't need a CHANGELOG entry labels Sep 23, 2025
@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.07%. Comparing base (09e6487) to head (d239f4c).
⚠️ Report is 509 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #1218       +/-   ##
=============================================
- Coverage     85.71%   67.07%   -18.64%     
- Complexity       19      525      +506     
=============================================
  Files             3       54       +51     
  Lines            49     2694     +2645     
  Branches          5      376      +371     
=============================================
+ Hits             42     1807     +1765     
- Misses            3      750      +747     
- Partials          4      137      +133     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jj22ee jj22ee changed the title Fix Trace Context extraction from Lambda Context object by using reflection for extraction instead Fix Trace Context extraction from Lambda Context object by bypassing Muzzle Check Sep 24, 2025
@jj22ee
Copy link
Contributor Author

jj22ee commented Sep 24, 2025

I changed my PR to avoid Muzzle Check instead of using reflection.

@jj22ee jj22ee enabled auto-merge (squash) September 24, 2025 17:58
@jj22ee jj22ee merged commit ba49eef into aws-observability:main Sep 24, 2025
11 of 14 checks passed
jj22ee added a commit that referenced this pull request Oct 24, 2025
…Muzzle Check (#1218)

*Issue #, if available:*
-
https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/17954879038/job/51066448865

AWS Lambda Environment may or may not have the `getXrayTraceId` method
in Lambda Context (from Lambda Core dependency). This will cause OTel's
Muzzle Check to disable the AWS Lambda Instrumentation in the event that
it isn't present, causing no Lambda Function Handler Span to appear

Fix of previous PR:
#1191

*Description of changes:*
- Use `@NoMuzzle` annotation when accessing `getXrayTraceId` in Lambda
Context Object, which avoids OTel's muzzle check. If `NoSuchMethodError`
is caught, we do not try this logic again.
- Add unit test for when `getXrayTraceId` throws `NoSuchMethodError`.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
jj22ee added a commit that referenced this pull request Oct 27, 2025
…Muzzle Check (#1218)

*Issue #, if available:*
-
https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/17954879038/job/51066448865

AWS Lambda Environment may or may not have the `getXrayTraceId` method
in Lambda Context (from Lambda Core dependency). This will cause OTel's
Muzzle Check to disable the AWS Lambda Instrumentation in the event that
it isn't present, causing no Lambda Function Handler Span to appear

Fix of previous PR:
#1191

*Description of changes:*
- Use `@NoMuzzle` annotation when accessing `getXrayTraceId` in Lambda
Context Object, which avoids OTel's muzzle check. If `NoSuchMethodError`
is caught, we do not try this logic again.
- Add unit test for when `getXrayTraceId` throws `NoSuchMethodError`.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants