Skip to content

Commit

Permalink
Fix Resource field type in Logs Data Model (#3826)
Browse files Browse the repository at this point in the history
## Changes

Change the type of `Resource` to reference the definition in the SDK so
that the resource's scheme URL is included in logs data model.

## Why

The Logs Data Model misses scheme URL of resource. All of the languages
reuse a common type representing resource.
- Java (stable logs): [reuses a common resource
type](https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/LogRecordData.java)
- .NET (stable logs): [reuses a common resource
type](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs)
- C++ (stable logs): [reuses a common resource
type](https://github.com/open-telemetry/opentelemetry-cpp/blob/main/sdk/src/logs/read_write_log_record.cc)
- Python (experimental logs): [reuses a common resource
type](https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py)

These changes can be seen as breaking. However, there is 100% precedence
of how log attributes and resource are currently handled in all
languages. I see the current description as a bug because we would miss
scheme URL of the resource. AFAIK the intention of the OTel Logs
Specification authors was to have only nested values for Body and
Attributes.

Related PRs:
-
#2888
- open-telemetry/opentelemetry-go#4809
  • Loading branch information
pellared committed Jan 18, 2024
1 parent 12cd1b1 commit 074466b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

- Fix `Resource` field type in Logs Data Model.
([#3826](https://github.com/open-telemetry/opentelemetry-specification/pull/3826))

### Resource

### OpenTelemetry Protocol
Expand Down
2 changes: 1 addition & 1 deletion specification/logs/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ source. This field is optional.

### Field: `Resource`

Type: `map<string, any>`.
Type: [Resource](../resource/sdk.md).

Description: Describes the source of the log, aka
[resource](../overview.md#resources). Multiple occurrences of events coming from
Expand Down

0 comments on commit 074466b

Please sign in to comment.