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
feat(processor): preserve auth in batch processor #10002
base: main
Are you sure you want to change the base?
Conversation
@grandwizard28 Thanks for the PR! Are there any related issues to this? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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 ☔ View full report in Codecov by Sentry. |
Hey @mx-psi, 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, |
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.
@@ -129,7 +129,9 @@ func newBatchProcessor(set processor.CreateSettings, cfg *Config, batchFunc func | |||
metadataLimit: int(cfg.MetadataCardinalityLimit), | |||
} | |||
if len(bp.metadataKeys) == 0 { | |||
s := bp.newShard(nil) | |||
// Retrieve info from the context and preserve Auth | |||
info := client.FromContext(ctx) |
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.
The context at this level doesn't have auth data, as newBatchProcessor
isn't called in response to incoming data, but during the startup of the collector.
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.
Understood! The idea is to propogate the existing context
in all shards created.
The newShard
function is the same regardless of whether we want to start at startup with a single shard or start multiple shards as per the metadata. I figured we just need to amend the signature of newShard
to give it an existing (if present) AuthData.
Is my understanding fair?
If you look at the
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:
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, |
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