-
Notifications
You must be signed in to change notification settings - Fork 626
feat(telemetry): add custom headers for OTLP exports (metrics, tracing, access logs) #7674
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
63fd03f to
04c7b52
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7674 +/- ##
==========================================
+ Coverage 72.77% 72.81% +0.03%
==========================================
Files 235 236 +1
Lines 35165 35190 +25
==========================================
+ Hits 25592 25623 +31
+ Misses 7756 7750 -6
Partials 1817 1817 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c58e24a to
5f69a4f
Compare
2483048 to
36f5bee
Compare
|
ok made a revision also to PR desc to hopefully answer questions in comments. I will revisit this again monday if there is more feedback. |
36f5bee to
1a16872
Compare
|
pulling into draft while I remove the port dodging things for things we can't control yet. |
1a16872 to
47998d6
Compare
|
also I just realized we never added this for tracing either, so will add that to the PR |
a5b5a19 to
c7e3ecf
Compare
| spec: | ||
| telemetry: | ||
| metrics: | ||
| # TODO: Some backends like otel-tui and Elastic require delta temporality |
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.
These problems are too much to do in this PR, and I can over time try to clean these up also
607296e to
5bff38d
Compare
| log := collector.TakeLog() | ||
| require.NotNil(t, log) | ||
| require.Contains(t, log.Body.GetStringValue(), `HTTP/1.1" 200`) | ||
| require.Equal(t, "Bearer test-api-key", testotel.GetAttributeString(log.Attributes, "grpc.metadata.authorization")) |
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.
@mathetake @anuraaga you might like this sneaky trick to verify the headers/metadata received by otel. propagate them into fake span attrs
412773b to
ea11614
Compare
|
ok I updated this as I noticed the same thing was missing everywhere, in logs metrics and tracing. fixed so that the tests are coherent and we don't need to go back and clean this up multiple times. There's been a history of fragmentation and not following up later, so doing otel holistically for one thing is a good thing. |
1448361 to
207b78d
Compare
|
this is pending merge of #7720 which has been stalled several days without any known reason. If anyone wants this stuff to land, please encourage maintainers to click merge and I'll rebase this after |
|
if this lasts until 2026 I will close it as unplanned/unwanted. I won't be attending to perpetual rebasing. I want to make things better, but this has been a low-light. Not only were things left half-finished, but finishing them has been beyond arduous |
207b78d to
f99c543
Compare
|
re ran soup to nuts and the example works fine |
|
/retest |
|
does anyone have access to merge this considering there are 2 approvals? |
c9c13b9 to
b46e22a
Compare
arkodg
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.
LGTM thanks
Adds a Headers field to the OpenTelemetry configuration for access logging, tracing, and metrics. This allows configuring gRPC initial metadata (e.g., Authorization headers) for authenticated OTLP export to collectors like Elastic, Datadog, or cloud providers. Also adds MinItems=1 validation for OTLP headers. Signed-off-by: Adrian Cole <[email protected]>
…consistency Signed-off-by: Adrian Cole <[email protected]>
b46e22a to
c3d6f0a
Compare
What type of PR is this?
feat(telemetry): add new feature
What this PR does / why we need it:
Adds support for custom headers on all OTLP/gRPC exports (metrics, tracing, and access logs), enabling authentication with collectors like Elastic Cloud, Datadog, or cloud providers that require API keys or bearer tokens.
This uses Envoy's
GrpcService.initial_metadatato send headers as gRPC metadata.Release Notes: Yes
Notes:
This PR includes an example showing authenticated OTLP exports for all three signals. The example uses otel-tui, but could use anything else.
Changes
Headersfield toProxyOpenTelemetrySinkintelemetry.metrics.sinks[].openTelemetryHeadersfield toTracingProviderintelemetry.tracing.providerHeadersfield toOpenTelemetryAccessLogintelemetry.accessLog.settings[].sinks[].openTelemetryAll three use the same pattern: a list of
HTTPHeaderobjects withnameandvaluefields.FAQ
Why not use SecretObjectReference for sensitive headers?
For EnvoyProxy config that supports file-based standalone mode, Kubernetes secrets are not available. Plain text headers are needed regardless.
For example, Honeycomb requires non-secret headers like
x-honeycomb-dataset. Secret support can be added in a follow-up for Kubernetes mode.