OpenTelemetryPartialSuccess Class

Collects the records rejected while handling an OTLP export request, so they can be reported back to the client through the OTLP partial_success response field.

public sealed class OpenTelemetryPartialSuccess

Remarks

Samplers and handlers can call OpenTelemetryPartialSuccess.Reject to report that some records could not be accepted. Rejected records are aggregated across all samplers and handlers of a single request.

Calls made after the response has been sent are ignored. This happens when a trace is dispatched by OpenTelemetryTailSampler because the spans are buffered and dispatched after the originating request completed.

Constructors

NameDescription
OpenTelemetryPartialSuccess()Initializes an instance that collects rejected records. Handlers receive one from the receiver; this constructor exists so they can be unit tested.

OpenTelemetryPartialSuccess()

OpenTelemetryPartialSuccess.cs

Initializes an instance that collects rejected records. Handlers receive one from the receiver; this constructor exists so they can be unit tested.

public OpenTelemetryPartialSuccess()

Properties

NameDescription
ErrorMessageGets the aggregated error message describing why records were rejected, or null when no message was reported.
RejectedCountGets the number of records rejected so far.

Gets the aggregated error message describing why records were rejected, or null when no message was reported.

public string? ErrorMessage { get; }

Property value

string?

Gets the number of records rejected so far.

public long RejectedCount { get; }

Property value

long

Methods

NameDescription
Reject(long, string?)Reports that count records were rejected.

Reject(long, string?)

OpenTelemetryPartialSuccess.cs

Reports that count records were rejected.

public void Reject(long count, string? errorMessage = null)

Parameters

count long
The number of rejected records. Can be 0 to report a warning without rejecting any record.
errorMessage string?
An optional human-readable message describing why the records were rejected.

Exceptions

ArgumentOutOfRangeException
count is negative.