opentelemetry-collector
opentelemetry-collector copied to clipboard
feat(processor): preserve auth in batch processor
Description
This PR preserves the authData in the client context after the batch processor. The idea is that the auth data can be used after the batch processor in subsequent processors and exporters.
Testing
- Current unit tests modified to include the context
- Need help with adding unit tests which choose auth is preserved.
@grandwizard28 Thanks for the PR! Are there any related issues to this?
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 91.78%. Comparing base (
4a58092) to head (45f83ea). Report is 118 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #10002 +/- ##
=======================================
Coverage 91.77% 91.78%
=======================================
Files 360 360
Lines 16641 16643 +2
=======================================
+ Hits 15273 15275 +2
Misses 1041 1041
Partials 327 327
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @mx-psi,
There are no current issues related to this. The background is while using any auth extension, we generally want to propagate some data (for example user_id) across processors and exporters but the batch processor is dropping the clientInfo.Auth struct.
I thought this would make a nice edition to the core since the batch processor is widely used.
Do let me know your thoughts on the above hypothesis :)
Hey @jpkrohling @mx-psi, Any thoughts here?
If you look at the exportCtx @jpkrohling, it looks like the following:
exportCtx := client.NewContext(context.Background(), client.Info{
Metadata: client.NewMetadata(md),
})
There is no AuthData preservation happening here at all. We are creating a new context altogether.
Do you want me to still create an issue?
No, the code you are looking for is here:
https://github.com/open-telemetry/opentelemetry-collector/blob/7855bf2ababecdddfea82e4b1a15fd81be2d2d66/processor/batchprocessor/batch_processor.go#L326
This will create a new shard based on the context for that is available in the consume function, which does have client metadata.
Hey @jpkrohling, Created an issue for this: https://github.com/open-telemetry/opentelemetry-collector/issues/10093
This PR was marked stale due to lack of activity. It will be closed in 14 days.
Closed as inactive. Feel free to reopen if this PR is still being worked on.