diff --git a/CHANGELOG.md b/CHANGELOG.md index 7733888cdf7..355dc9281f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ release. ### Logs +- Improve concurrency safety description of `LogRecordProcessor.OnEmit`. + ([#4578](https://github.com/open-telemetry/opentelemetry-specification/pull/4578)) - Clarify that `SeverityNumber` values are used when comparing severities. ([#4552](https://github.com/open-telemetry/opentelemetry-specification/pull/4552)) diff --git a/specification/logs/sdk.md b/specification/logs/sdk.md index 5a3d0506b85..3daad25cf6a 100644 --- a/specification/logs/sdk.md +++ b/specification/logs/sdk.md @@ -258,7 +258,7 @@ the following information added to the [LogRecord](data-model.md#log-and-event-r The SDK MAY provide an operation that makes a deep clone of a `ReadWriteLogRecord`. The operation can be used by asynchronous processors (e.g. [Batching processor](#batching-processor)) to avoid race conditions on the log record that is not required to be -concurrent safe. +concurrent-safe. ## LogRecord Limits @@ -350,9 +350,12 @@ therefore it SHOULD NOT block or throw exceptions. For a `LogRecordProcessor` registered directly on SDK `LoggerProvider`, the `logRecord` mutations MUST be visible in next registered processors. -A `LogRecordProcessor` may freely modify `logRecord` for the duration of -the `OnEmit` call. If `logRecord` is needed after `OnEmit` returns (i.e. for -asynchronous processing) only reads are permitted. +A `LogRecordProcessor` may freely modify the `logRecord` for the duration of +the `OnEmit` call. However, it is OPTIONAL for `ReadWriteLogRecord` to be +concurrent-safe. Therefore, any concurrent modifications and reads of `logRecord` +may result in race conditions. To avoid such race conditions, +implementations SHOULD recommended to users that a clone of `logRecord` be used +for any concurrent processing, such as in a [batching processor](#batching-processor). #### Enabled