Skip to content

Commit

Permalink
Clarify that Scope attributes are not part of its identity
Browse files Browse the repository at this point in the history
Resolves open-telemetry#2762

This change says that Scope attributes are NOT part of the Tracer/Meter/Logger identity.

The consequence of this change is the following:

- It is no longer possible to obtain a Logger with different sets of
  attributes from the same instrumentation library (using the same name,
  version,schema_url). It may be desirable to make this possible in the
  future, but right now it is impossible since the attributes are not
  part of the Scope's identity.

- Likewise, it is no longer possible to obtain a Tracer and Meter with
  different sets of attributes from the same instrumentation library (using the
  same name, version,schema_url). This is likely the only desirable way
  for Tracer and Meter.
  • Loading branch information
tigrannajaryan committed Sep 13, 2022
1 parent d0dc1f8 commit 79cb032
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions specification/logs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ SHOULD be true by default.
associate with emitted telemetry.

Implementations MUST return different `Logger` instances when called repeatedly
with different values of parameters. Note that always returning a new `Logger`
with different values of (name,version,schema_url) parameters. Note that always returning a new `Logger`
instance is a valid implementation. The only exception to this rule is the no-op
`Logger`: implementations MAY return the same instance regardless of parameter
values.

Implementations MUST NOT require users to repeatedly obtain a Logger again with
the same name+version+schema_url+event_domain+include_trace_context+attributes
the same (name,version,schema_url) parameters
to pick up configuration changes. This can be achieved either by allowing to
work with an outdated configuration or by ensuring that new configuration
applies also to previously returned Loggers.
Expand All @@ -115,7 +115,7 @@ Note: This could, for example, be implemented by storing any mutable
configuration in the `LoggerProvider` and having `Logger` implementation objects
have a reference to the `LoggerProvider` from which they were obtained.
If configuration must be stored per-Logger (such as disabling a certain `Logger`),
the `Logger` could, for example, do a look-up with its name+version+schema_url+event_domain+include_trace_context+attributes
the `Logger` could, for example, do a look-up with its (name,version,schema_url)
in a map in the `LoggerProvider`, or the `LoggerProvider` could maintain a registry
of all returned `Logger`s and actively update their configuration if it changes.

Expand Down
8 changes: 4 additions & 4 deletions specification/metrics/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ This API MUST accept the following parameters:
Meters are identified by all of these parameters.

Implementations MUST return different `Meter` instances when called repeatedly
with different values of parameters. Note that always returning a new `Meter` instance
with different values of (name,version,schema_url) parameters. Note that always returning a new `Meter` instance
is a valid implementation. The only exception to this rule is the no-op `Meter`:
implementations MAY return the same instance regardless of parameter values.

It is unspecified whether or under which conditions the same or different
`Meter` instances are returned from this function when the same
(name,version,schema_url,attributes) parameters are used.
(name,version,schema_url) parameters are used.

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.
(name,version,schema_url) are equal. The term *distinct* applied to Meters describes instances where at
least one of identifying fields (name,version,schema_url) has a different value.

Implementations MUST NOT require users to repeatedly obtain a `Meter` with
the same identity to pick up configuration changes. This can be
Expand Down
4 changes: 2 additions & 2 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ This API MUST accept the following parameters:
to associate with emitted telemetry.

Implementations MUST return different `Tracer` instances when called repeatedly
with different values of (name+version+schema_url) parameters. Note that always returning a new `Tracer` instance
with different values of (name,version,schema_url) parameters. Note that always returning a new `Tracer` instance
is a valid implementation. The only exception to this rule is the no-op `Tracer`:
implementations MAY return the same instance regardless of parameter values.

Implementations MUST NOT require users to repeatedly obtain a `Tracer` again
with the same (name+version+schema_url) to pick up configuration changes.
with the same (name,version,schema_url) parameters to pick up configuration changes.
This can be achieved either by allowing to work with an outdated configuration or
by ensuring that new configuration applies also to previously returned `Tracer`s.

Expand Down

0 comments on commit 79cb032

Please sign in to comment.