Skip to content

Commit

Permalink
Add isolating log record processor (#4062)
Browse files Browse the repository at this point in the history
## Why

Fixes #4010 (read the issue for more details)

The SDK SHOULD offer a way to make independent log processing. I find it
as a missing feature that should be covered by by the specification.

## What

This PR tries to achieve it in the following way:
- SDK SHOULD provide an isolating processor allowing independent log
processing pipelines. Source:
#4010 (comment)

This approach should be solving the issue at least for Java, .NET,
Python, JavaScript, Go. This proposal should not make any existing log
SDKs not compliant with the specification.

I think that the same approach could be also adopted in tracing for span
processors (but I have not yet investigated it in depth).

## Remarks

I created a separate issue for specifying whether (by default) a change
to a record made in a processor is propagated to next registered
processor. See
#4065
  • Loading branch information
pellared authored Jun 27, 2024
1 parent 9182f11 commit 3266af0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ release.

### Logs

- Add the in-development isolating log record processor.
([#4062](https://github.com/open-telemetry/opentelemetry-specification/pull/4062))

### Events

### Resource
Expand Down
24 changes: 23 additions & 1 deletion specification/logs/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* [Built-in processors](#built-in-processors)
+ [Simple processor](#simple-processor)
+ [Batching processor](#batching-processor)
+ [Isolating processor](#isolating-processor)
- [LogRecordExporter](#logrecordexporter)
* [LogRecordExporter operations](#logrecordexporter-operations)
+ [Export](#export)
Expand Down Expand Up @@ -372,7 +373,13 @@ make the flush timeout configurable.
### Built-in processors

The standard OpenTelemetry SDK MUST implement both simple and batch processors,
as described below. Other common processing scenarios SHOULD be first considered
as described below.

**Status**: [Development](../document-status.md) -
The standard OpenTelemetry SDK SHOULD implement an isolating processor,
as described below.

Other common processing scenarios SHOULD be first considered
for implementation out-of-process
in [OpenTelemetry Collector](../overview.md#collector).

Expand Down Expand Up @@ -405,6 +412,21 @@ representations to the configured `LogRecordExporter`.
* `maxExportBatchSize` - the maximum batch size of every export. It must be
smaller or equal to `maxQueueSize`. The default value is `512`.

#### Isolating processor

**Status**: [Development](../document-status.md)

This is an implementation of `LogRecordProcessor` ensuring the log record
passed to `OnEmit` of the configured `processor` does not share mutable data
with subsequent registered processors.
For example, the `OnEmit` implementation of the isolating processor can be
a decorator that makes a deep copy of the log record before passing it to
the configured `processor`.

**Configurable parameters:**

* `processor` - processor to be isolated.

## LogRecordExporter

`LogRecordExporter` defines the interface that protocol-specific exporters must
Expand Down

0 comments on commit 3266af0

Please sign in to comment.