Allow explicit context for OpenTelemetry logs - #350
christiand93 merged 1 commit into
Conversation
0a5274e to
08d07a0
Compare
|
@christiand93 This is a small follow-up to the OTel plugin on #316: it lets consumers provide the explicit OTel Context that |
edcf505 to
f884349
Compare
08d07a0 to
09f7251
Compare
|
@christiand93 Rebased onto the refreshed |
christiand93
left a comment
There was a problem hiding this comment.
Cool, thank you for contributing.
Looks good to me 🦘
Make sure to sign the CLA:
#350 (comment)
|
@christiand93 I investigated the pending CLA check against SAP OSPO guidance and CLA Assistant itself. |
|
Afaik, cla-assistant is managed centrally/by OSPO and I don't seem to have access to its configuration. I will reach out to OSPO to get some help. |
Summary
OpenTelemetryLogsOutputPlugincallers to provide either a fixed OpenTelemetryContextor a per-record context resolvercontext.active()Root cause
OpenTelemetryLogsOutputPlugin.writeRecord()currently callsLogger.emit()without acontext. The OpenTelemetry Logs SDK therefore snapshotscontext.active()at emit time. In framework integrations, that active context can contain a non-recording span whose span ID is never exported, even when the consumer already has the recording HTTP SERVER span context available. The resulting log record is correlated to a span that cannot be found in the trace backend.This change keeps the plugin framework-agnostic: consumers can supply the correct context directly or resolve it lazily for each log record. There is no xotel-specific behavior.
Validation
Rebased onto the refreshed
opentelemetry-v8branch (f884349).npm cinpm run buildnpx mocha src/test/unit-test/otel-output.test.js— 3 passingnpm run lintnpm test— 177 passinggit diff --check