-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
An attempt to implement merged context #12318
base: main
Are you sure you want to change the base?
An attempt to implement merged context #12318
Conversation
return mc | ||
} | ||
|
||
func (mc mergedContext) Deadline() (time.Time, bool) { |
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.
This may be called multiple times, so I think we should pre-calculate this.
func (mc mergedContext) Done() <-chan struct{} { | ||
return mc.ctx.Done() | ||
} |
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.
We don't need to propagate this.
func (mc mergedContext) Err() error { | ||
var mergedErr error | ||
for _, c := range mc.ctxArr { | ||
if err := c.Err(); err != nil { | ||
mergedErr = multierr.Append(mergedErr, c.Err()) | ||
} | ||
} | ||
return mergedErr | ||
} |
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.
Ditto.
"go.uber.org/multierr" | ||
) | ||
|
||
type mergedContext struct { |
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 scope is:
- Deadline is max of all.
- Keep a list of all SpanContext.
We just need these 2 things, not the whole contexts.
3ece739
to
dac5fd6
Compare
Description
Link to tracking issue
Fixes #
Testing
Documentation