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

Define attributes equality and make all fields as identifying for Tracer, Meter, Logger, EventLogger #4161

Merged
merged 19 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 6 additions & 0 deletions specification/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ indices that are kept in sync (e.g., two attributes `header_keys` and `header_va
both containing an array of strings to represent a mapping
`header_keys[i] -> header_values[i]`).

Attributes are equal when their keys and values are equal.

See [Attribute Naming](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/attribute-naming.md) for naming guidelines.

See [Requirement Level](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/attribute-requirement-level.md) for requirement levels guidelines.
Expand Down Expand Up @@ -185,3 +187,7 @@ Some other implementations may use a streaming approach where every
that individual attribute value being exported using a streaming wire protocol.
In such cases the enforcement of uniqueness will likely be the responsibility of
the recipient of this data.

Collection of attributes are equal when they contain the same attributes,
irrespective of the order in which those elements appear
(unordered collection equality).
16 changes: 3 additions & 13 deletions specification/logs/bridge-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The `LoggerProvider` MUST provide the following functions:
This API MUST accept the following [instrumentation scope](data-model.md#field-instrumentationscope)
parameters:

* `name`: This name uniquely identifies the [instrumentation scope](../glossary.md#instrumentation-scope),
* `name`: Specifies the name of the [instrumentation scope](../glossary.md#instrumentation-scope),
such as the [instrumentation library](../glossary.md#instrumentation-library)
(e.g. `io.opentelemetry.contrib.mongodb`), package, module or class name.
If an application or library has built-in OpenTelemetry instrumentation, both
Expand All @@ -85,19 +85,9 @@ parameters:
associate with emitted telemetry. This API MUST be structured to accept a
variable number of attributes, including none.

`Logger`s are identified by `name`, `version`, and `schema_url` fields. When more
than one `Logger` of the same `name`, `version`, and `schema_url` is created, it
is unspecified whether or under which conditions the same or different `Logger`
instances are returned. It is a user error to create Loggers with different
`attributes` but the same identity.

The term *identical* applied to `Logger`s describes instances where all
identifying fields are equal. The term *distinct* applied to `Logger`s describes
instances where at least one identifying field has a different value.

The effect of associating a Schema URL with a `Logger` MUST be that the telemetry
emitted using the `Logger` will be associated with the Schema URL, provided that
the emitted data format is capable of representing such association.
parameters are equal. The term *distinct* applied to `Logger`s describes
instances where at least one parameter has a different value.

## Logger

Expand Down
14 changes: 4 additions & 10 deletions specification/logs/event-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The `EventLoggerProvider` MUST provide the following functions:

This API MUST accept the following parameters:

* `name`: This name uniquely identifies the [instrumentation scope](../glossary.md#instrumentation-scope),
* `name`: Specifies the name of the [instrumentation scope](../glossary.md#instrumentation-scope),
such as the [instrumentation library](../glossary.md#instrumentation-library)
(e.g. `io.opentelemetry.contrib.mongodb`), package, module or class name.
If an application or library has built-in OpenTelemetry instrumentation, both
Expand All @@ -117,15 +117,9 @@ This API MUST accept the following parameters:
associate with emitted telemetry. This API MUST be structured to accept a
variable number of attributes, including none.

`EventLogger`s are identified by `name`, `version`, and `schema_url` fields. When more
than one `EventLogger` of the same `name`, `version`, and `schema_url` is created, it
is unspecified whether or under which conditions the same or different `EventLogger`
instances are returned. It is a user error to create `EventLogger`s with different
`attributes` but the same identity.

The effect of associating a Schema URL with a `EventLogger` MUST be that the telemetry
emitted using the `EventLogger` will be associated with the Schema URL, provided that
the emitted data format is capable of representing such association.
The term *identical* applied to `EventLogger`s describes instances where all
parameters are equal. The term *distinct* applied to `EventLogger`s describes
instances where at least one parameter has a different value.

## EventLogger

Expand Down
4 changes: 4 additions & 0 deletions specification/logs/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ It SHOULD only be possible to create `Logger` instances through a `LoggerProvide

The `LoggerProvider` MUST implement the [Get a Logger API](bridge-api.md#get-a-logger).

The implementation MUST honor all passed parameters so that the telemetry
emitted using the `Logger` will contain the data passed via the parameters,
provided that the emitted data format is capable of representing such data.
pellared marked this conversation as resolved.
Show resolved Hide resolved

The input provided by the user MUST be used to create
an [`InstrumentationScope`](../glossary.md#instrumentation-scope) instance which
is stored on the created `Logger`.
Expand Down
14 changes: 4 additions & 10 deletions specification/metrics/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The `MeterProvider` MUST provide the following functions:

This API MUST accept the following parameters:

* `name`: This name uniquely identifies the [instrumentation
* `name`: Specifies the name of the [instrumentation
scope](../glossary.md#instrumentation-scope), such as the
[instrumentation library](../glossary.md#instrumentation-library) (e.g.
`io.opentelemetry.contrib.mongodb`), package,
Expand Down Expand Up @@ -149,15 +149,9 @@ This API MUST accept the following parameters:
it is up to their discretion. Therefore, this API MUST be structured to
accept a variable number of attributes, including none.

Meters are identified by `name`, `version`, and `schema_url` fields. When more
than one `Meter` of the same `name`, `version`, and `schema_url` is created, it
is unspecified whether or under which conditions the same or different `Meter`
instances are returned. It is a user error to create Meters with different
attributes but the same identity.

The term *identical* applied to Meters describes instances where all identifying
fields are equal. The term *distinct* applied to Meters describes instances where
at least one identifying field has a different value.
The term *identical* applied to Meters describes instances where all parameters
are equal. The term *distinct* applied to Meters describes instances where at
least one parameter has a different value.

## Meter

Expand Down
8 changes: 4 additions & 4 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ It SHOULD only be possible to create `Meter` instances through a `MeterProvider`

The `MeterProvider` MUST implement the [Get a Meter API](api.md#get-a-meter).

The implementation MUST honor all passed parameters so that the telemetry
emitted using the `Meter` will contain the data passed via the parameters,
provided that the emitted data format is capable of representing such data.

The input provided by the user MUST be used to create
an [`InstrumentationScope`](../glossary.md#instrumentation-scope) instance which
is stored on the created `Meter`.
Expand All @@ -128,10 +132,6 @@ working Meter MUST be returned as a fallback rather than returning null or
throwing an exception, its `name` SHOULD keep the original invalid value, and a
message reporting that the specified value is invalid SHOULD be logged.

When a Schema URL is passed as an argument when creating a `Meter` the emitted
telemetry for that `Meter` MUST be associated with the Schema URL, provided
that the emitted data format is capable of representing such association.

**Status**: [Development](../document-status.md) - The `MeterProvider` MUST
compute the relevant [MeterConfig](#meterconfig) using the
configured [MeterConfigurator](#meterconfigurator), and create
Expand Down
17 changes: 3 additions & 14 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,9 @@ This API MUST accept the following parameters:
- [since 1.13.0] `attributes` (optional): Specifies the instrumentation scope attributes
to associate with emitted telemetry.

Tracers are identified by `name`, `version`, and `schema_url` fields. When more
than one `Tracer` of the same `name`, `version`, and `schema_url` is created, it
is unspecified whether or under which conditions the same or different `Tracer`
instances are returned. It is a user error to create Tracers with different
attributes but the same identity.

The term *identical* applied to Tracers describes instances where all
identifying fields are equal. The term *distinct* applied to Tracers describes
instances where at least one identifying field has a different value.
The term *identical* applied to Tracers describes instances where all parameters
are equal. The term *distinct* applied to Tracers describes instances where at
least one parameter has a different value.

Implementations MUST NOT require users to repeatedly obtain a `Tracer` again
with the same identity to pick up configuration changes. This can be
Expand All @@ -161,11 +155,6 @@ the tracer could, for example, do a look-up with its identity in a map
in the `TracerProvider`, or the `TracerProvider` could maintain a registry of
all returned `Tracer`s and actively update their configuration if it changes.

The effect of associating a Schema URL with a `Tracer` MUST be that the
telemetry emitted using the `Tracer` will be associated with the Schema URL,
provided that the emitted data format is capable of representing such
association.

## Context Interaction

This section defines all operations within the Tracing API that interact with the
Expand Down
4 changes: 4 additions & 0 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ It SHOULD only be possible to create `Tracer` instances through a `TracerProvide

The `TracerProvider` MUST implement the [Get a Tracer API](api.md#get-a-tracer).

The implementation MUST honor all passed parameters so that the telemetry
emitted using the `Tracer` will contain the data passed via the parameters,
provided that the emitted data format is capable of representing such data.

The input provided by the user MUST be used to create
an [`InstrumentationScope`](../glossary.md#instrumentation-scope) instance which
is stored on the created `Tracer`.
Expand Down
Loading