-
Notifications
You must be signed in to change notification settings - Fork 512
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
Distributor: Don't use global logger in push handlers #6652
Conversation
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
892bbbb
to
342bda5
Compare
var decoderFunc func(buf []byte) (pmetricotlp.ExportRequest, error) | ||
|
||
logger := log.WithContext(ctx, log.Logger) |
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.
I think we can leave the log.WithContext, it adds traceid as part of logger, which spanlogger.NewWithLogger doesn't seems to do it.
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.
@ying-jeanne but handler
calls this function (as parser
) with a logger that's instantiated with request context. Do you agree that we no longer need the log.WithContext
call in this function (since it's already been done by handler
)?
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
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.
Looks good, thank you.
What this PR does
Modify the Distributor's push handlers to receive the API's logger instead of using the global one (we're supposed to migrate off the global logger). A practical benefit from this is that the OTLP push handler receives the
handler
function's logger, which includes source IPs.Which issue(s) this PR fixes or relates to
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]