Skip to content

Logs to reuse attribute.[Key]Value and remove log.[Key]Value types #7034

@pellared

Description

@pellared

Problem Statement

Right now, the Logs API has similar abstractions to ones in attribute package. For instance, log.KeyValue is almost an equivalent of attribute.KeyValue.

Because of the different types, Logs API provides log.KeyValueFromAttribute which also shows that the intention when the types are used is similar.

What is more with OTEP: Extending attributes to support complex values #4485 we have an agreement that attribute is going to be eventually extended with new types that are now available only in logs signals (ones the addition of new attributes types is stabilized in the specification). Prototype of the new attribute value types: #6809.

Proposed Solution

Remove log.KeyValue (and all related definitions) and use attribute package instead.

The bridges would marshal the values to JSON and use the attribute.String in places where log.MapValue, log.SliceValue and log.BytesValue are currently used: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/internal/shared/logutil/convert.go.tmpl.

Alternatives

Keep the log.[Key]Value types to allow usage of the additional value types that are not yet stable for places other than log record attributes and body. However, long-term this would cause unnecessary duplication of types and cause user-confusion why we have different types in the logs API. It would also increase the amount of code that we would have to maintain.

Additional Context

This issue and OTEP: Extending attributes to support complex values #4485 is the main reason why Logs API has not been stabilized yet.

The OTel Go SIG wants very much to simplify the design and prefer to remove the log.[Key]Value types.

We should also update: https://github.com/open-telemetry/opentelemetry-go/blob/main/log/DESIGN.md

Metadata

Metadata

Assignees

Labels

area:logsPart of OpenTelemetry logsblocked:specificationWaiting on clarification of the OpenTelemetry specification before progress can be madeenhancementNew feature or requestpkg:APIRelated to an API packagepkg:SDKRelated to an SDK package

Projects

Status

Blocked

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions