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 ergonomics for reusing Standard Attributes #4373

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

pellared
Copy link
Member

@pellared pellared commented Jan 17, 2025

@pellared pellared self-assigned this Jan 17, 2025
@pellared pellared marked this pull request as ready for review January 20, 2025 11:44
@pellared pellared requested review from a team as code owners January 20, 2025 11:44
@carlosalberto carlosalberto changed the title Logs API to have ergonimics for reusing standard attributes Logs API to have ergonomics for reusing standard attributes Jan 20, 2025
specification/logs/api.md Outdated Show resolved Hide resolved
specification/logs/api.md Outdated Show resolved Hide resolved
@pellared pellared requested a review from lmolkova January 21, 2025 17:03
CHANGELOG.md Outdated Show resolved Hide resolved
specification/logs/api.md Outdated Show resolved Hide resolved
Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

LGTM. Left a nit comment/question, not a blocker.

pellared added a commit to open-telemetry/opentelemetry-go that referenced this pull request Jan 22, 2025
Fixes #6158

Related spec PR:
open-telemetry/opentelemetry-specification#4373

Benchmark results:

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkKeyValueFromAttribute/Empty-20              72029505                16.47 ns/op            0 B/op          0 allocs/op
BenchmarkKeyValueFromAttribute/Bool-20               68560222                16.99 ns/op            0 B/op          0 allocs/op
BenchmarkKeyValueFromAttribute/BoolSlice-20          14647401                76.21 ns/op           50 B/op          2 allocs/op
BenchmarkKeyValueFromAttribute/Int64-20              70737378                16.92 ns/op            0 B/op          0 allocs/op
BenchmarkKeyValueFromAttribute/Int64Slice-20         16780069                96.87 ns/op           64 B/op          2 allocs/op
BenchmarkKeyValueFromAttribute/Float64-20            59299638                16.93 ns/op            0 B/op          0 allocs/op
BenchmarkKeyValueFromAttribute/Float64Slice-20       12691222               106.2 ns/op            64 B/op          2 allocs/op
BenchmarkKeyValueFromAttribute/String-20             63837711                16.97 ns/op            0 B/op          0 allocs/op
BenchmarkKeyValueFromAttribute/StringSlice-20         9251001               114.7 ns/op            80 B/op          2 allocs/op
PASS
ok      go.opentelemetry.io/otel/log    14.776s
```
@pellared pellared changed the title Logs API to have ergonomics for reusing standard attributes Logs API to have ergonomics for reusing Standard Attributes Jan 22, 2025
Comment on lines +127 to +133
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.
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.

Comment on lines +126 to +127
[1]: **Status**: [Development](../document-status.md) -
The API SHOULD provide ergonomics so that the caller can use
Copy link
Contributor

Choose a reason for hiding this comment

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

Having a normative recommendation in a note makes this easy to miss. We should make it clear in its own paragraph.

Suggested change
[1]: **Status**: [Development](../document-status.md) -
The API SHOULD provide ergonomics so that the caller can use
[1]: **Status**: [Development](../document-status.md)
The API SHOULD provide ergonomics so that the caller can use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Status: In Review
Development

Successfully merging this pull request may close these issues.

Attributes "hell"
6 participants