-
Notifications
You must be signed in to change notification settings - Fork 11
Fix deferred export by properly formatting OTLP headers for curl #2820
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
Conversation
Co-authored-by: plengauer <100447901+plengauer@users.noreply.github.com>
Co-authored-by: plengauer <100447901+plengauer@users.noreply.github.com>
plengauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot that cant be it. they are already exported from the start, so unless you can show me a specific place where they are unexported, they are available. re-analyze and find the real issue
Co-authored-by: plengauer <100447901+plengauer@users.noreply.github.com>
You're absolutely right - the variables were already exported. The real issue was in the header formatting. The OTLP headers are comma-separated Fixed in commit 41df900 by applying the same header transformation used in the job-level instrumentation: echo "$OTEL_EXPORTER_OTLP_HEADERS" | tr ',' '\n' | grep -v '^$' | sed 's/=/: /g' >> "$headers"This splits by comma, filters empty lines, and converts |
Co-authored-by: plengauer <100447901+plengauer@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the deferred export mechanism in workflow instrumentation by properly formatting OTLP headers for curl. The issue was that headers were provided as comma-separated key=value pairs but curl requires key: value format with each header on a separate line.
Changes:
- Transform OTLP headers from comma-separated format to curl-compatible format with proper
key: valuesyntax - Combine signal-specific headers with general headers before transformation
- Remove the redundant separate echo of
OTEL_EXPORTER_OTLP_HEADERS
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
The deferred export mechanism in workflow instrumentation was broken because OTLP headers weren't properly formatted when forwarding telemetry data to the actual endpoint.
Root Cause
OTLP headers are provided as comma-separated
key=valuepairs (e.g.,Authorization=Bearer token,X-Custom=value), but curl's-H @filesyntax expects each header on a separate line inkey: valueformat. The workflow instrumentation was writing the raw comma-separated string to the headers file, which curl couldn't parse correctly.Changes
actions/instrument/workflow/main.sh- Transform headers to proper format before passing to curl:The transformation:
OTEL_EXPORTER_OTLP_HEADERS) and signal-specific headers (e.g.,OTEL_EXPORTER_OTLP_LOGS_HEADERS)tr ',' '\n')grep -v '^$')key=valuetokey: valueformat (sed 's/=/: /g')This matches the exact pattern used in the job-level instrumentation for the collector configuration, ensuring consistency across the codebase.
Impact
When
export_deferred_signal_fileforwards deferred telemetry data via curl, it now correctly passes headers in the format curl expects, allowing the data to be successfully sent to the OTLP endpoint with proper authentication and configuration.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.