Skip to content

Improve concurrency safety description of LogRecordProcessor.OnEmit#4578

Merged
carlosalberto merged 14 commits intoopen-telemetry:mainfrom
pellared:refine-logrecordprocessor-conurrency
Jul 28, 2025
Merged

Improve concurrency safety description of LogRecordProcessor.OnEmit#4578
carlosalberto merged 14 commits intoopen-telemetry:mainfrom
pellared:refine-logrecordprocessor-conurrency

Conversation

@pellared
Copy link
Copy Markdown
Member

@pellared pellared commented Jul 4, 2025

Fixes #4141

Why

I do not think it is possible to disallow modifications of logRecord after LogRecordProcessor.OnEmit. It is a "requirement" that is left for the user.

What

Instead of it I think we should explain the problem and also describe ways how race conditions can be mitigated/solved.

This is how we implemented it in OTel Go:

PS: Sorry it took me so long to create this PR (almost a year 😅). It actually took me more than an hour just to figure out how to propose these changes in a hopefully good way. Thank you for your patience!

@pellared pellared changed the title Clarify concurrency safety of LogRecordProcessor.OnEmit Improve concurrency safety description of LogRecordProcessor.OnEmit Jul 4, 2025
@pellared pellared marked this pull request as ready for review July 4, 2025 12:18
@pellared pellared requested review from a team July 4, 2025 12:18
@pellared
Copy link
Copy Markdown
Member Author

pellared commented Jul 4, 2025

@cijothomas, @jack-berg, are you able to review?

@pellared pellared added this to Logs SIG Jul 4, 2025
@pellared pellared moved this to In progress in Logs SIG Jul 4, 2025
@pellared pellared self-assigned this Jul 4, 2025
Comment thread specification/logs/sdk.md Outdated
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Comment thread specification/logs/sdk.md Outdated
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Copy link
Copy Markdown
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

The spirit of the concurrent phrasing was to discourage users from holding on to references to logRecord and updating them after OnEmit returns. This is reflected subtly in "If logRecord is needed after OnEmit returns (i.e. for
asynchronous processing) only reads are permitted." which notably does not use any normative language.

Still, its too subtle what guidance is for SDK maintainers and what is for end users, so I support clarifying.

Comment thread specification/logs/sdk.md Outdated
Comment thread specification/logs/sdk.md Outdated
@pellared pellared requested a review from jack-berg July 10, 2025 20:26
@carlosalberto
Copy link
Copy Markdown
Contributor

We will merge this one after July's release, so we will hold on for a bit.

@carlosalberto carlosalberto added this pull request to the merge queue Jul 28, 2025
Merged via the queue into open-telemetry:main with commit c69a623 Jul 28, 2025
6 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Logs SIG Jul 28, 2025
@pellared pellared deleted the refine-logrecordprocessor-conurrency branch July 30, 2025 11:49
@carlosalberto carlosalberto mentioned this pull request Aug 11, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Aug 13, 2025
August 2025 release.

### Logs

- Improve concurrency safety description of `LogRecordProcessor.OnEmit`.

([#4578](#4578))
- Clarify that `SeverityNumber` values are used when comparing
severities.

([#4552](#4552))

### Entities

- Mention entity references in the stability guarantees.

([#4593](#4593))

### OpenTelemetry Protocol

- Clarify protocol defaults on specification.

([#4585](#4585))

### Compatibility

- Flexibilie escaping of characters that are discouraged by Prometheus
Conventions
  in Prometheus exporters.

([#4533](#4533))
- Flexibilize addition of unit/type related suffixes in Prometheus
exporters.

([#4533](#4533))
- Define the configuration option "Translation Strategies" for
Prometheus exporters.

([#4533](#4533))
- Define conversion of Prometheus native histograms to OpenTelemetry
exponential histograms.

([#4561](#4561))
- Clarify what to do when scope attribute conflicts with name, version
and schema URL.

([#4599](#4599))

### SDK Configuration

- Enum values provided via environment variables SHOULD be interpreted
in a case-insensitive manner.

([#4576](#4576))

Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Refine only logs reads are permitted section

7 participants