Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

logging: OpenTelemetry spans are ignored as parents for LogRecords #1490

@cindy-peng

Description

@cindy-peng

Tracking the same issue as 9302 to propagate correct TraceId and SpanId for logging and tracing correlation.

Client

nodejs-logging

Context

In nodejs-logging libraries, the current implementation will always use a remote trace ID and span ID parsed from HTTP headers that originate from outside the application:

export function getOrInjectContext(

As a result, logs are associated with the parent span rather than the span of interest.

Expected behavior

If the user is using opentelemetry instrumentation, we want to use the traceID and spanID of the span that OpenTelemetry created. This way, when a user looks for logs associated with that span, the logs produced by this logging library will appear.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/nodejs-logging API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions