Skip to content

Log Records passed to log processor OnEmit is non-mutable #5219

@MrAlias

Description

Blocked by:

Description

The specification requires that log processors be provided a LogRecordProcessor:

OnEmit

[...]

Parameters:

Our current implementation Defines the Processor interface as such:

type Processor interface {
	// OnEmit is called when a Record is emitted.
	//
	// OnEmit will be called independent of Enabled. Implementations need to
	// validate the arguments themselves before processing.
	//
	// Implementation should not interrupt the record processing
	// if the context is canceled.
	//
	// All retry logic must be contained in this function. The SDK does not
	// implement any retry logic. All errors returned by this function are
	// considered unrecoverable and will be reported to a configured error
	// Handler.
	//
	// Before modifying a Record, the implementation must use Record.Clone
	// to create a copy that shares no state with the original.
	OnEmit(ctx context.Context, record Record) error
/* ... */
}

Any modification made to the record passed to a processor's OnEmit method will not be applied to the subsequent processor. The record is not mutable, it does not comply with the specification requirement.

Metadata

Labels

area:logsPart of OpenTelemetry logsblocked:specificationWaiting on clarification of the OpenTelemetry specification before progress can be madebugSomething isn't workingpkg:SDKRelated to an SDK package

Type

No type

Projects

  • Status

    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions