-
Notifications
You must be signed in to change notification settings - Fork 834
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
Add OTLP header supplier configuration option #6004
Add OTLP header supplier configuration option #6004
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6004 +/- ##
============================================
- Coverage 91.17% 91.06% -0.11%
+ Complexity 5709 5685 -24
============================================
Files 628 625 -3
Lines 16722 16702 -20
Branches 1650 1653 +3
============================================
- Hits 15246 15210 -36
- Misses 1021 1033 +12
- Partials 455 459 +4 ☔ View full report in Codecov by Sentry. |
any updates on this feature being available in release ? I can see it being pending for review and merge for a long time now |
exporters/common/src/main/java/io/opentelemetry/exporter/internal/grpc/GrpcExporterBuilder.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/internal/http/HttpExporterBuilder.java
Outdated
Show resolved
Hide resolved
Disclaimer: I'm ok with this the way it is, but I wanted to give the API some additional usability consideration. I also hate to drag this out, but let's consider.... While most users will probably just be fine with the constant headers, the dynamic case is certainly expected, especially for things like auth tokens as discussed elsewhere. The cases where a user has several dynamic header values, or the case where the user has a multi-valued dynamic header should be unusual. The So I took at swing at some of the Grpc classes to see what another surface might look like. It's not complete (I didn't touch some of the other builders), but it ends up looking like:
The 3rd one is only named differently because java can't resolve it when overloaded. I also think that it might be overkill and could probably just go away until someone asks for it. Another disclaimer: I didn't try and think too much about efficiency/optimization, and the supplier implementations might end up being a little allocation happy, but that's the nature of the dynamic headers. I have no sense of if it would be a real problem yet. Anyway, going to approve the current impl because I think it's fine...but wanted to share an alternative approach in case it stirs up some ideas. |
@breedx-splk per the conversation in the spec today, I reverted the So for a similar reason, we wouldn't want to add the But I think the suggestion of switching the to
Its a little bit better, but one think sticks out: The API isn't symmetric with Authentication, which expects to return a
I have a slight preference for the
|
…y-java into otlp-exporter-header-suppliers
Thanks for the response and taking the time to consider an alternate approach, I appreciate it. 👍🏻 |
Resolves #5959.
Currently, OTLP exporters allow you to specify headers, but the headers are static. There's also the experimental concept of an
Authenticator
, which mirrors the OkHttp concept of the same name.Authenticator
is able to respond to 401 response codes and supply headers to retry the request. ThisAuthenticator
concept is incomplete though, since it requires every request to first get a 401 response before invoking the supplier and allowing the headers to change. Gross. What we really want to do is something like I described in this comment:This PR extends all the OTLP exporter builders with a
setHeaders(Supplier<Map<String, String>>)
method, to provide more flexibility for authentication mechanisms which are more complex than a static header.