Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure SDK when running in Lambda environment #950

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

srprash
Copy link
Contributor

@srprash srprash commented Nov 12, 2024

Description of changes:

The following behaviors are implemented when the ADOT Java SDK is running in a Lambda environment:

  • Replace the OTLP SpanExporters (either HTTP or GRPC ones) with OtlpUdpSpanExporter to export spans to Lambda agent over UDP.
  • Disable the other AWS resource providers via the otel.java.disabled.resource.providers configuration.
  • Set the BSP configuration otel.bsp.max.export.batch.size to 10 for the auto-configured BatchSpanProcessor that exports the sampled spans.
  • When Application Signals is enabled:
    • Export unsampled spans too via the AwsUnsampledOnlySpanProcessor. Also, setting the batch size for the AwsUnsampledOnlySpanProcessor to be 10.
    • Disable generating Application Signals metrics from the SDK.

Compare to the ADOT Python implementation: aws-observability/aws-otel-python-instrumentation#257

Testing

  • The unit tests for AwsApplicationSignalsCustomizerProvider does not exist and is high effort to add it with this PR.
  • Built the agent jar and tested with a simple application. Captured the debug logs from the ADOT Java agent.
    • The maxExportBatchSize is 10 for the default auto-configured BatchSpanProcessor

      spanProcessorsAll=[BatchSpanProcessor{spanExporter=software.amazon.opentelemetry.javaagent.providers.AwsMetricAttributesSpanExporter@193f604a, exportUnsampledSpans=false, scheduleDelayNanos=5000000000, maxExportBatchSize=10, exporterTimeoutNanos=30000000000}, io.opentelemetry.javaagent.tooling.AddThreadDetailsSpanProcessor@50ad3bc1, SimpleSpanProcessor{spanExporter=LoggingSpanExporter{}, exportUnsampledSpans=false}, software.amazon.opentelemetry.javaagent.providers.AttributePropagatingSpanProcessor@223aa2f7, software.amazon.opentelemetry.javaagent.providers.AwsUnsampledOnlySpanProcessor@6d3a388c]}}

    • When Application Signals is disabled, the configured exporter is still the OtlpUdpSpanExporter

      spanProcessorsAll=[BatchSpanProcessor{spanExporter=software.amazon.opentelemetry.javaagent.providers.OtlpUdpSpanExporter@394df057, exportUnsampledSpans=false, scheduleDelayNanos=5000000000, maxExportBatchSize=10, exporterTimeoutNanos=30000000000}, io.opentelemetry.javaagent.tooling.AddThreadDetailsSpanProcessor@71e9ddb4, SimpleSpanProcessor{spanExporter=LoggingSpanExporter{}, exportUnsampledSpans=false}]

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

@srprash srprash marked this pull request as ready for review November 12, 2024 22:31
@srprash srprash requested a review from a team as a code owner November 12, 2024 22:31
disabledResourceProviders.add("io.opentelemetry.contrib.aws.resource.EcsResourceProvider");
disabledResourceProviders.add("io.opentelemetry.contrib.aws.resource.EksResourceProvider");
propsOverride.put(
OTEL_DISABLED_RESOURCE_PROVIDERS_CONFIG, String.join(",", disabledResourceProviders));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a way to verify it? either manually or by unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it can be only verified manually that the functionality works. Unit test can likely only tell if the config was set properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do a manual check to verify this.

@srprash srprash merged commit b58b94f into aws-observability:main Nov 15, 2024
2 of 4 checks passed
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.

2 participants