Skip to content

[Bug]: Improve context in BatchSpanProcessor/BatchLogProcessor error logs when otlp export fails #3331

@krisztianfekete

Description

@krisztianfekete

What happened?

Currently, when otlp export fails due to transport errors, e.g. misconfigured endpoint, the error level logs are not helpful finding the root cause of the problem.

Current Behavior

With a misconfigured endpoint (missing schema, e.g., localhost:4317 instead of http://localhost:4317):

Error-level log:

2026-01-29T12:12:15.755056Z error opentelemetry_sdk
  name="BatchSpanProcessor.ExportError"
  error="Operation failed: status: 'Unknown error', self: \"transport error\""

Debug-level log:

2026-01-29T12:33:01.335273Z debug tonic::transport::channel::service::reconnect
  reconnect::poll_ready: ConnectError(ConnectError("invalid URL, scheme is missing"))

Looks like we lose the context when the original error gets wrapped into OTelSdkError::InternalFailure and the processors log it as a generic error without the original context.

I propose preserving the original error in InternalFailure in error messages. What do you all think?

OpenTelemetry API Version (i.e version of opentelemetry crate)

main

OpenTelemetry SDK Version (i.e version of opentelemetry_sdk crate)

main

What Exporter(s) are you seeing the problem on?

OTLP

Relevant log output

See above.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage:todoNeeds to be traiged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions