Skip to content

Commit 6504828

Browse files
Clarify that Trace/Meter are associated with Instrumentation Scope
This is a slightly different take on open-telemetry#2203 Instead of renaming instrumentation library to instrumentation scope everywhere this PR suggests targetted editing of wording of the Trace/Meter obtaining API to allow not just instrumentation library but other instrumentation scopes to be used as a parameter. This change does not force renaming of API parameters and is not a breaking change. We consider it a clarification of usage to match the intent that we had for the "name" field. If this PR is accepted there will be a follow up PR that will suggest to rename InstrumentationLibrary* messages in OTLP proto to InstrumentationScope* message. Such a change will not be a breaking change for the OTLP wire format and is acceptable. If this PR is accepted we will also close open-telemetry#1236 since it will be no longer necessary. The logger name will be recorded as the instrumentation scope. This clarification will be a follow up PR that clarifies the behavior in https://github.com/open-telemetry/oteps/blob/main/text/logs/0150-logging-library-sdk.md
1 parent 28d8fed commit 6504828

4 files changed

Lines changed: 47 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ release.
1717
- Add support for probability sampling in the OpenTelemetry `tracestate` entry and
1818
add optional specification for consistent probability sampling.
1919
([#2047](https://github.com/open-telemetry/opentelemetry-specification/pull/2047))
20+
- Clarify that Tracer is associated with Instrumentation Scope
21+
([#2276](https://github.com/open-telemetry/opentelemetry-specification/pull/2276)).
2022

2123
### Metrics
2224

@@ -41,6 +43,8 @@ release.
4143
[#2032](https://github.com/open-telemetry/opentelemetry-specification/pull/2061)
4244
- Changed default Prometheus Exporter host from `0.0.0.0` to `localhost`.
4345
([#2282](https://github.com/open-telemetry/opentelemetry-specification/pull/2282))
46+
- Clarify that Meter is associated with Instrumentation Scope
47+
([#2276](https://github.com/open-telemetry/opentelemetry-specification/pull/2276)).
4448

4549
### Logs
4650

specification/glossary.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Some other fundamental terms are documented in the [overview document](overview.
2727
* [Exporter Library](#exporter-library)
2828
* [Instrumented Library](#instrumented-library)
2929
* [Instrumentation Library](#instrumentation-library)
30+
* [Instrumentation Scope](#instrumentation-scope)
3031
* [Tracer Name / Meter Name](#tracer-name--meter-name)
3132
* [Execution Unit](#execution-unit)
3233
- [Logs](#logs)
@@ -151,11 +152,31 @@ Example: `io.opentelemetry.contrib.mongodb`.
151152

152153
Synonyms: *Instrumenting Library*.
153154

155+
### Instrumentation Scope
156+
157+
A logical unit of the application code with which the emitted telemetry can be
158+
associated with. It is typically the developer's choice to decide what denotes a
159+
reasonable instrumentation scope. The most common approach is to use the
160+
[instrumentation library](#instrumentation-library) as the scope, however other
161+
scopes are also common, e.g. a module, a package, or a class can be chosen as
162+
the instrumentation scope.
163+
164+
If the unit of code has a version then the instrumentation scope is defined by
165+
the (name,version) pair otherwise the version is omitted and only the name is
166+
used.
167+
168+
The instrumentation scope is used to obtain a
169+
[Tracer or Meter](#tracer-name--meter-name).
170+
154171
### Tracer Name / Meter Name
155172

156173
This refers to the `name` and (optional) `version` arguments specified when
157-
creating a new `Tracer` or `Meter` (see [Obtaining a Tracer](trace/api.md#tracerprovider)/[Obtaining a Meter](metrics/api.md#meterprovider)).
158-
The name/version pair identifies the [Instrumentation Library](#instrumentation-library).
174+
creating a new `Tracer` or `Meter` (see
175+
[Obtaining a Tracer](trace/api.md#tracerprovider)/[Obtaining a Meter](metrics/api.md#meterprovider)).
176+
The name/version pair identifies the
177+
[Instrumentation Scope](#instrumentation-scope), for example the
178+
[Instrumentation Library](#instrumentation-library) or another unit of
179+
application in the scope of which the telemetry is emitted.
159180

160181
### Execution Unit
161182

specification/metrics/api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ The `MeterProvider` MUST provide the following functions:
108108
This API MUST accept the following parameters:
109109

110110
* `name` (required): This name must identify the [instrumentation
111-
library](../overview.md#instrumentation-libraries) (e.g.
112-
`io.opentelemetry.contrib.mongodb`). If an application or library has built-in
111+
scope](../glossary.md#instrumentation-scope) (e.g.
112+
`io.opentelemetry.contrib.mongodb`), such as the instrumentation library,
113+
package, module or class name. If an application or library has built-in
113114
OpenTelemetry instrumentation, both [Instrumented
114115
library](../glossary.md#instrumented-library) and [Instrumentation
115116
library](../glossary.md#instrumentation-library) may refer to the same

specification/trace/api.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,24 @@ The `TracerProvider` MUST provide the following functions:
106106

107107
This API MUST accept the following parameters:
108108

109-
- `name` (required): This name must identify the [instrumentation library](../overview.md#instrumentation-libraries)
110-
(e.g. `io.opentelemetry.contrib.mongodb`).
111-
If an application or library has built-in OpenTelemetry instrumentation, both
109+
- `name` (required): This name must identify the [instrumentation
110+
scope](../glossary.md#instrumentation-scope) (e.g.
111+
`io.opentelemetry.contrib.mongodb`), such as the instrumentation library,
112+
package, module or class name. If an application or library has built-in
113+
OpenTelemetry instrumentation, both
112114
[Instrumented library](../glossary.md#instrumented-library) and
113-
[Instrumentation library](../glossary.md#instrumentation-library) may refer to the same library.
114-
In that scenario, the `name` denotes a module name or component name within that library
115-
or application.
116-
In case an invalid name (null or empty string) is specified, a working
117-
Tracer implementation MUST be returned as a fallback rather than returning
118-
null or throwing an exception, its `name` property SHOULD be set to an **empty** string,
119-
and a message reporting that the specified value is invalid SHOULD be logged.
120-
A library, implementing the OpenTelemetry API *may* also ignore this name and
121-
return a default instance for all calls, if it does not support "named"
122-
functionality (e.g. an implementation which is not even observability-related).
123-
A TracerProvider could also return a no-op Tracer here if application owners configure
124-
the SDK to suppress telemetry produced by this library.
115+
[Instrumentation library](../glossary.md#instrumentation-library) may refer to
116+
the same library. In that scenario, the `name` denotes a module name or
117+
component name within that library or application. In case an invalid name
118+
(null or empty string) is specified, a working Tracer implementation MUST be
119+
returned as a fallback rather than returning null or throwing an exception,
120+
its `name` property SHOULD be set to an **empty** string, and a message
121+
reporting that the specified value is invalid SHOULD be logged. A library,
122+
implementing the OpenTelemetry API *may* also ignore this name and return a
123+
default instance for all calls, if it does not support "named" functionality
124+
(e.g. an implementation which is not even observability-related). A
125+
TracerProvider could also return a no-op Tracer here if application owners
126+
configure the SDK to suppress telemetry produced by this library.
125127
- `version` (optional): Specifies the version of the instrumentation library (e.g. `1.0.0`).
126128
- [since 1.4.0] `schema_url` (optional): Specifies the Schema URL that should be
127129
recorded in the emitted telemetry.

0 commit comments

Comments
 (0)