Add OTLP logs pipeline for application signals - #2082
Closed
jj22ee wants to merge 1 commit into
Closed
Conversation
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.
Description of the issue
Application Signals currently supports traces and metrics pipelines, but has no built-in support for forwarding OTLP logs to CloudWatch. ADOT-instrumented applications (Java, Node.js, Python) may emit telemetry as OTLP log records to the CWAgent's existing OTLP receiver (ports 4315/4316), but without a logs pipeline these records are silently dropped.
Customers must manually configure an
otelConfigwithotlphttpexporter,sigv4auth, and header injection to route OTLP logs to the CloudWatch Logs OTLP endpoint — a complex setup that should be handled natively by the Application Signals pipeline.Description of changes
Adds a built-in
logs/application_signalspipeline that receives OTLP logs on the existing Application Signals OTLP receiver (4315/4316) and forwards them to the CloudWatch Logs OTLP endpoint viaotlphttpexporter with SigV4 authentication.Activation: Customers add
application_signalsunderlogs.logs_collectedin the CWAgent JSON config:{ "logs": { "logs_collected": { "application_signals": { "log_group_name": "/test/telemetry", "log_stream_name": "default" } } } }Changes:
translator/translate/otel/translate_otel.go— Registersapplicationsignals.NewTranslator(pipeline.SignalLogs)alongside existing traces/metrics translators.translator/translate/otel/pipeline/applicationsignals/translator.go— Adds SignalLogs branch that creates a logs pipeline that reuses existing AppSignals OTLP receivers (4315/4316), and uses otlphttp/application_signals (new Exporter) with sigv4auth & agenthealth Extensions. No processors.translator/translate/otel/exporter/otlphttp/translator.go— New translator that creates an otlphttp exporter config pointing tohttps://logs.<region>.amazonaws.comwith sigv4auth authentication.translator/cmdutil/translatorutil.go— Adds injectAppSignalsLogsHeaders() workaround to restore x-aws-log-group and x-aws-log-stream headers after mapstructure marshal. These headers are nil'd during serialization because configopaque.String treats all header values as secrets, but log group/stream names are not sensitive and must survive the YAML round-trip.translator/config/schema.json— Adds application_signals (and app_signals fallback) under logs_collected with log_group_name and log_stream_name properties.translator/translate/otel/common/common.go— Adds AppSignalsLogs and AppSignalsLogsFallback config key constants, and registers pipeline.SignalLogs in AppSignalsConfigKeys.translator/translate/otel/pipeline/applicationsignals/translator_test.go— Adds TestTranslatorLogs with test cases for: missing config key, enabled logs pipeline, and enabled with debug exporter.License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Deployed Java sample application on EKS with CW Observability add-on, patched add-on to use custom image for CWAgent containing my changes
Configured logs.logs_collected.application_signals with /test/telemetry log group and default stream
/test/telemetrylog group with correctdefault logstreamAlso added
TestTranslatorLogsintranslator_test.gocovering cases where (1) application_signals is not configured under logs_collected, (2) create pipeline with expected receivers, extensions, and exporter (which includes otlphttp/application_signals), and (3) includes debug/application_signals exporter when agent debug mode is enabledRequirements
Before commiting your code, please do the following steps.
make fmtandmake fmt-shmake lintIntegration Tests
To run integration tests against this PR, add the
ready for testinglabel.