Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs API to have functionality for reusing Standard Attributes #4373

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
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

- Logs API should have ergonomics for reusing Standard Attributes.
([#4373](https://github.com/open-telemetry/opentelemetry-specification/pull/4373))

### Baggage

### Resource
Expand Down
1 change: 1 addition & 0 deletions spec-compliance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Disclaimer: this list of features is still a work in progress, please refer to t
| LoggerProvider.ForceFlush | | | + | | + | | | + | | + | - | |
| Logger.Emit(LogRecord) | | | + | | + | | | + | | + | - | |
| Logger.EmitEvent(LogRecord) | | | | | | | | | | | | |
| Reuse Standard Attributes | X | + | | | | | | | | | | |
| Logger.Enabled | X | + | | | | | | | + | + | | |
| SimpleLogRecordProcessor | | | + | | + | | | + | | + | | |
| BatchLogRecordProcessor | | | + | | + | | | + | | + | | |
Expand Down
11 changes: 10 additions & 1 deletion specification/logs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,18 @@ The API MUST accept the following parameters:
- [Severity Number](./data-model.md#field-severitynumber) (optional)
- [Severity Text](./data-model.md#field-severitytext) (optional)
- [Body](./data-model.md#field-body) (optional)
- [Attributes](./data-model.md#field-attributes) (optional)
- [Attributes](./data-model.md#field-attributes) (optional) [1]
- **Status**: [Development](../document-status.md) - [Event Name](./data-model.md#field-eventname) (optional)

[1]: **Status**: [Development](../document-status.md) -
pellared marked this conversation as resolved.
Show resolved Hide resolved
The API SHOULD provide ergonomics so that the caller can use
pellared marked this conversation as resolved.
Show resolved Hide resolved
pellared marked this conversation as resolved.
Show resolved Hide resolved
[Standard Attributes](../common/README.md#standard-attribute)
along with [Log Attributes](./data-model.md#field-attributes)
of [type `map<string, any>`](./data-model.md#type-mapstring-any).
This allows the reuse of [Standard Attributes](../common/README.md#standard-attribute)
across signals.
This can be converting functions, method overloads, etc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ergonomics is the study of people's efficiency in their working environment. Can we be more explicit about what is being recommended here?

Suggested change
The API SHOULD provide ergonomics so that the caller can use
[Standard Attributes](../common/README.md#standard-attribute)
along with [Log Attributes](./data-model.md#field-attributes)
of [type `map<string, any>`](./data-model.md#type-mapstring-any).
This allows the reuse of [Standard Attributes](../common/README.md#standard-attribute)
across signals.
This can be converting functions, method overloads, etc.
The API SHOULD provide functionality for users to convert from
[Standard Attributes](../common/README.md#standard-attribute)
to [Log Attributes](./data-model.md#field-attributes)
of [type `map<string, any>`](./data-model.md#type-mapstring-any).
This allows the reuse of [Standard Attributes](../common/README.md#standard-attribute)
across signals.

Copy link
Member Author

@pellared pellared Jan 22, 2025

Choose a reason for hiding this comment

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

TIL 👍

What do you think of

Suggested change
The API SHOULD provide ergonomics so that the caller can use
[Standard Attributes](../common/README.md#standard-attribute)
along with [Log Attributes](./data-model.md#field-attributes)
of [type `map<string, any>`](./data-model.md#type-mapstring-any).
This allows the reuse of [Standard Attributes](../common/README.md#standard-attribute)
across signals.
This can be converting functions, method overloads, etc.
The API SHOULD provide functionality so that the caller can use
[Standard Attributes](../common/README.md#standard-attribute)
along with [Log Attributes](./data-model.md#field-attributes)
of [type `map<string, any>`](./data-model.md#type-mapstring-any).
This allows the reuse of [Standard Attributes](../common/README.md#standard-attribute)
across signals.
This can be converting functions, method overloads, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

The last sentence is redundant. "Functionality" is used throughout the specification to imply what that sentence is saying.

Also, we do not plan for users to use standard attributes along with log attributes. We plan for them to convert standard attributes into log attributes and use those.

Copy link
Member Author

@pellared pellared Jan 22, 2025

Choose a reason for hiding this comment

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

we do not plan for users to use standard attributes along with log attributes.

I think that some languages may want to do this. E.g. see:

Copy link
Contributor

@MrAlias MrAlias Jan 22, 2025

Choose a reason for hiding this comment

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

I don't follow how that is related to these changes. Do they plan to use this conversion functionally there?

Copy link
Member Author

Choose a reason for hiding this comment

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

They want to have a LogRecordBuilder that have one method that accepts Standard Attributes and another one that accepts Log Attributes. It is like of we would add AddStandardAttributes to Record in Go Logs API.


### Enabled

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