-
Notifications
You must be signed in to change notification settings - Fork 49
Export getCurrentTraceFromAgent for correlation with traces #459
Copy link
Copy link
Closed
Labels
api: loggingIssues related to the googleapis/nodejs-logging-winston API.Issues related to the googleapis/nodejs-logging-winston API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Metadata
Metadata
Assignees
Labels
api: loggingIssues related to the googleapis/nodejs-logging-winston API.Issues related to the googleapis/nodejs-logging-winston API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
I'd like to correlate logs with traces. Your example in the README explains how to get the key (
LoggingWinston.LOGGING_TRACE_KEY), but not how to specify the correct value (your example:custom-trace-value). I checked the code for your middleware, and foundgetCurrentTraceFromAgent. I copied this, modified it a little to avoid the global variable, and it works perfectly.My modified version of
getCurrentTraceFromAgent+ implementation:Describe the solution you'd like
I would like this
getCurrentTraceFromAgentfunction to be exported as well, so I could do something like this: