Skip to content

BatchSpanProcessor / BatchLogRecordProcessor: add opt-in blocking mode when queue is full #5178

Description

@cijothomas

Problem

Both BatchSpanProcessor (sdk.md#batching-processor) and BatchLogRecordProcessor (logs/sdk.md#batching-processor) drop items when maxQueueSize is reached. This is intentional — telemetry must not affect application behavior by default.

Item loss is observable via the SDK self-observability metrics defined in semantic conventions (experimental status), though only a subset of SDKs currently implement them.

However, there are workloads where drop is not the right trade-off:

  • Batch / offline jobs — a data pipeline that runs and exits has no latency-sensitive path. Dropping spans because the exporter lagged is incorrect behavior; accepting backpressure is acceptable.
  • Compliance / audit workloads — some environments require complete telemetry records and cannot tolerate loss.

Proposal

Add an opt-in onQueueFull parameter to both processors:

  • DROP — current behavior, remains the default. No breaking change.
  • BLOCK — the calling thread blocks until queue space is available, or until blockOnQueueFullTimeoutMillis elapses, after which the item is dropped.

A dedicated blockOnQueueFullTimeoutMillis parameter (only meaningful when onQueueFull = BLOCK) would be introduced alongside.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:sdkRelated to the SDKenhancementNew feature or requestmaintainer-requestEscalated by SIG maintainersspec:logsRelated to the specification/logs directorytriage:deciding:community-feedbackOpen to community discussion. If the community can provide sufficient reasoning, it may be accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions