Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions specification/logs/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ weight: 3
* [Built-in processors](#built-in-processors)
+ [Simple processor](#simple-processor)
+ [Batching processor](#batching-processor)
+ [Severity based processor](#severity-based-processor)
+ [Trace based processor](#trace-based-processor)
- [LogRecordExporter](#logrecordexporter)
* [LogRecordExporter operations](#logrecordexporter-operations)
+ [Export](#export)
Expand Down Expand Up @@ -456,6 +458,9 @@ make the flush timeout configurable.
The standard OpenTelemetry SDK MUST implement both simple and batch processors,
as described below.

**Status**: [Development](../document-status.md) - The SDK SHOULD implement
severity based and trace based processors, 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 @@ -495,6 +500,54 @@ to make sure that they are not invoked concurrently.
* `maxExportBatchSize` - the maximum batch size of every export. It must be
smaller or equal to `maxQueueSize`. The default value is `512`.

#### Severity based processor

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

This processor filters log records by minimum severity level.

**Required operations:**

* [`Enabled`](#enabled-1) - MUST return `false` if the provided
[Severity Number](./data-model.md#field-severitynumber) is below the
configured `minimumSeverity`. Otherwise, MUST forward to the delegate's
`Enabled` method if available and return `true` if not available.
* [`OnEmit`](#onemit) - If the log record's severity is below the configured
`minimumSeverity`, MUST NOT forward it to the delegate. Otherwise, MUST forward the
log record to the delegate.
* [`Shutdown`](#shutdown) - MUST forward to the delegate's `Shutdown` method.
* [`ForceFlush`](#forceflush-1) - MUST forward to the delegate's `ForceFlush` method.

**Configurable parameters:**

* `minimumSeverity` - the minimum severity level required for passing the
log record on to the delegate.
* `delegate` - the processor to delegate to for log records that are not
filtered out.

#### Trace based processor

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

This processor filters log records by span sampling status.

**Required operations:**

* [`Enabled`](#enabled-1) - MUST return `false` if the current
[Context](../context/README.md) contains a valid span context that is not
sampled. Otherwise, MUST forward to the delegate's `Enabled` method if available
and return `true` if not available.
* [`OnEmit`](#onemit) - If the log record is associated with a valid span
context that is not sampled, MUST NOT forward it to the delegate. Otherwise, MUST
forward the log record to the delegate.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could we update the desc of this to make it more obvious that if the log is emitted outside any active spans, then they are not subject to filtering?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrote, ptal

* [`Shutdown`](#shutdown) - MUST forward to the delegate's `Shutdown` method.
* [`ForceFlush`](#forceflush-1) - MUST forward to the delegate's `ForceFlush` method.

**Configurable parameters:**

* `delegate` - the processor to delegate to for log records that are not
filtered out.

## LogRecordExporter

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