Skip to content
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ internal/tools/bin
node_modules/
package-lock.json

# Python virtual environment
venv/

# Visual Studio Code
.vscode

Expand Down
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 optional Ergonomic API.
([#4741](https://github.com/open-telemetry/opentelemetry-specification/pull/4741))

### Baggage

### Profiles
Expand Down
1 change: 1 addition & 0 deletions spec-compliance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Disclaimer: this list of features is still a work in progress, please refer to t
| Logger.Emit(LogRecord) | | + | + | + | + | + | | + | | + | - | |
| LogRecord.Set EventName | | + | | | | | | | + | + | | |
| Logger.Enabled | X | + | | | | | | + | + | + | | |
| Ergonomic API | X | | | | | | | | | | | |
| SimpleLogRecordProcessor | | + | + | + | + | + | | + | | + | | |
| BatchLogRecordProcessor | | + | + | + | + | + | | + | | + | | |
| Can plug custom LogRecordProcessor | | + | + | + | + | + | | + | | + | | |
Expand Down
2 changes: 2 additions & 0 deletions spec-compliance-matrix/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ sections:
- name: LogRecord.Set EventName
- name: Logger.Enabled
optional: true
- name: Ergonomic API
optional: true
- name: SimpleLogRecordProcessor
- name: BatchLogRecordProcessor
- name: Can plug custom LogRecordProcessor
Expand Down
20 changes: 18 additions & 2 deletions specification/logs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aliases: [bridge-api]

# Logs API

**Status**: [Stable](../document-status.md)
**Status**: [Stable](../document-status.md), except where otherwise specified

<details>
<summary>Table of Contents</summary>
Expand All @@ -23,6 +23,7 @@ aliases: [bridge-api]
* [Enabled](#enabled)
- [Optional and required parameters](#optional-and-required-parameters)
- [Concurrency requirements](#concurrency-requirements)
- [Ergonomic API](#ergonomic-api)
- [References](#references)

<!-- tocstop -->
Expand All @@ -35,7 +36,8 @@ which use this API to bridge between existing logging libraries and the
OpenTelemetry log data model.

The Logs API can also be directly called by instrumentation libraries
as well as instrumented libraries or applications.
as well as instrumented libraries or applications. However, languages are also
free to provide a more [ergonomic API](#ergonomic-api) for direct usage.

The Logs API consist of these main components:

Expand Down Expand Up @@ -167,6 +169,20 @@ specific guarantees and safeties.

**Logger** - all methods are safe to be called concurrently.

## Ergonomic API
Copy link
Member

Choose a reason for hiding this comment

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

we probably don't need a new section just to document something obvious (IMHO) to each language implementations. Languages were always free to offer extra helpers for all sort of things, and I think that is not prohibited in the spec.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to highlight a few points:

  1. Issue Confusing purpose for logging API #4661 demonstrates real confusion - The contradiction in the opening paragraphs confused contributors. This suggests the freedom isn't as "obvious" as we might think. Moreover, based on the discussions during the specification SIG meeting, others also shared concerns in the current way the specification is written.

  2. The section provides guidance, not just permission - It's not just saying "you can do this" (which may be implicit), but "here's what to focus on when you do this" (semconv compliance, idiomatic design).

  3. Precedent exists - The Configuration spec explicitly states languages should provide idiomatic mechanisms. This follows that pattern.

  4. Small documentation cost, significant clarity benefit - The section is brief (~5 lines) but resolves confusion that led to an issue being filed.

Would you prefer we:

  • A) Keep the section as-is
  • B) Move it to supplementary-guidelines.md instead
  • C) Reduce it to a single sentence in the opening
  • D) Something else?

I'm open to alternatives that achieve the clarity goal while addressing your concern about documenting the "obvious."

Copy link
Member

Choose a reason for hiding this comment

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

My preference is : C

Copy link
Member Author

Choose a reason for hiding this comment

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

I am fine with C. Let's see wait for more feedback.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also updated the README.md so that this PR will be self-sufficient for solving the issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

During today's Spec SIG meeting it seemed that the attendees preference was: A


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

Languages MAY additionally provide a more ergonomic and convenient logging API
that it is better suited for direct usage by instrumentation libraries,
instrumented libraries, and applications.
Comment on lines +176 to +178
Copy link
Member

Choose a reason for hiding this comment

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

nit: just more concise suggestion that avoid repeating all possible API callers

Suggested change
Languages MAY additionally provide a more ergonomic and convenient logging API
that it is better suited for direct usage by instrumentation libraries,
instrumented libraries, and applications.
Languages MAY additionally provide a more ergonomic and convenient logging API.


The ergonomic API SHOULD make it easier to emit logs and events following the
[log semantics](https://opentelemetry.io/docs/specs/semconv/general/logs/)
and the [event semantics](https://opentelemetry.io/docs/specs/semconv/general/events/).
Comment on lines +180 to +182
Copy link
Member

Choose a reason for hiding this comment

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

i'm not sure about all these places that mention log semantic conventions since we're only planning to define semantic conventions for events

is the idea that the ergonomic api is just for semantic conventions? or also for classical logging (e.g. templates, parameter substitution, etc), or limited to events + structured logging?


The design of the ergonomic API SHOULD be idiomatic for its language.

## References

- [OTEP0150 Logging Library SDK Prototype Specification](../../oteps/logs/0150-logging-library-sdk.md)
Loading