-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug fixes] Lambda - duplicate lambda spans + appsignals from unsampl…
…ed spans (#1000) ### Issue 1 - Duplicate lambda root spans The instrumentation produces 2 lambda root spans upon each invocation of the function. This is a known issue in OTel: open-telemetry/opentelemetry-java-instrumentation#7808 #### Fix - Otel has fixed it in [this PR](open-telemetry/opentelemetry-java-instrumentation#10736) but the change wasn't ported to the 1.x versions. So I took the diff from the upstream commit and made it into a patch that we apply when building the ADOT Java Lambda Layer for v1.33.x. ### Issue 2 - Unsampled spans do not produce Application Signals metrics On lambda environment, we export 100% of the spans to X-Ray to ensure we are able to provide 100% Application Signals metrics. However, currently only the sampled spans show up on the "Services" page and the unsampled spans do not. #### Fix - Upon comparing the sampled vs unsampled spans, I noticed that the unsampled spans are missing the attributes like `aws.local.service` and `aws.local.operation` which are required to generate Application Signals metrics. - The fix is to wrap the `OtlpUdpSpanExporter` instance for unsampled spans with the `AwsMetricAttributesSpanExporter` so that the exported spans have the desired attributes. #### Testing - After creating a layer with the fix, I set the `OTEL_TRACES_SAMPLER` to `always_off`. Then I invoked the function once. - The metrics appeared on the Application Signals console. - See the following screenshots <img width="1722" alt="image" src="https://github.com/user-attachments/assets/fa10e09f-ae24-4ab3-989f-838aacfb7e50" /> <img width="1722" alt="image" src="https://github.com/user-attachments/assets/d777304f-2cd9-4348-8e29-74f4a8b6b917" /> *Description of changes:* By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
2 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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