Skip to content

Define how providers handle instrumentation scope attributes and identical creation calls #4160

@pellared

Description

@pellared

Towards open-telemetry/opentelemetry-go#3368

Most of the SDKs ignore instrumentation scope attributes (C++ and PHP are exceptions). This is a functional blocker for following issues:

The specification does not explicitly stay how the SDK should handle tracer/meter/logger creation when the user calls it with the same identifying parameters (name, version, scheme_url), but when other parameters are different (currently only attributes).

Because of this the Go SDK ignores instrument scope attributes (see: open-telemetry/opentelemetry-go#3368).
I think the same is true for Java SDK, .NET SDK, JS SDK.

C++ SDK creates only a single tracer for many "identical" creation calls (the instrumentation scope attributes value comes from the first "identical" tracer creation call). However, it is only for OPENTELEMETRY_ABI_VERSION_NO=2 which is experimental.

Python SDK, PHP SDK create always a new instance of a tracer for many "identical" creation calls (with potentially different instrumentation scope attributes).

Right now, the specification does not require the SDK to handle scope attributes. Currently, having them ignored is specification compliant.

It is also unclear why scope attributes are not taking part of being one of the "identifying fields" and why all fields cannot be used to identify an instrument. From my database experience adding a column to a primary key it is an acceptable change/migration. However, in order to include instrumentation scope attributes to the identifying fields we would need to define the equality of Attribute Collections. In my opinion, the order or attributes should not affect the equality of attribute ([k1: v1, k2: v2] should be equal to [k2: v2, k1: v1]), especially that some languages model the attributes as map/hashset.

"Identical" and "identifying fields" terms are (currently) relevant and used a lot in metrics' duplicate instrument registration section.

Prior discussions: #4146

Metadata

Metadata

Assignees

Labels

area:apiCross language API specification issuearea:sdkRelated to the SDKspec:logsRelated to the specification/logs directoryspec:metricsRelated to the specification/metrics directoryspec:traceRelated to the specification/trace directorytriage:accepted:ready-with-sponsorReady to be implemented and has a specification sponsor assigned

Type

No type

Projects

Status

Spec - Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions