Skip to content

Commit 9736aa2

Browse files
carlosalbertoLiudmila Molkovajade-guiton-ddpellaredsmith
authored
Have InstrumentationScope use normative language (#4488)
Fixes #4450 Moved the `InstrumentationScope` definition from glossary into common/instrumentation-scope.md, and massaged it using normative language, including some examples. Also removed the compile-time concept restriction (as clarified in the related issue, this limitation does not exist in a few SIGs). --------- Co-authored-by: Liudmila Molkova <limolkova@microsoft.com> Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com> Co-authored-by: Robert Pająk <pellared@hotmail.com> Co-authored-by: Nathan L Smith <nathan.smith@elastic.co> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
1 parent 0c730d9 commit 9736aa2

12 files changed

Lines changed: 70 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ release.
3838

3939
### Common
4040

41+
- Move Instrumentation Scope definition from glossary to a dedicated document and use normative language.
42+
([#4488](https://github.com/open-telemetry/opentelemetry-specification/pull/4488))
43+
4144
### Supplementary Guidelines
4245

4346
### OTEPs

specification/common/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ at this time, as discussed in
158158
## Attribute Collections
159159

160160
[Resources](../resource/sdk.md),
161-
[Instrumentation Scopes](../glossary.md#instrumentation-scope),
161+
[Instrumentation Scopes](instrumentation-scope.md),
162162
[Metric points](../metrics/data-model.md#metric-points),
163163
[Spans](../trace/api.md#set-attributes), Span
164164
[Events](../trace/api.md#add-events), Span
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!--- Hugo front matter used to generate the website version of this page:
2+
linkTitle: Instrumentation Scope
3+
--->
4+
5+
# Instrumentation Scope
6+
7+
**Status**: [Stable](../document-status.md)
8+
9+
A logical unit of software with which the emitted telemetry can be
10+
associated. It is typically the developer's choice to decide what denotes a
11+
reasonable instrumentation scope. The most common approach is to use
12+
the name and version of the [instrumentation library](../glossary.md#instrumentation-library),
13+
with any additional identifying information as part of the scope's attributes.
14+
Other software components can be used too to get name, version and additional attributes, e.g.
15+
a module, a package, a class or a plugin.
16+
17+
The instrumentation scope is defined by the
18+
(name,version,schema_url,attributes) tuple where version, schema_url, and
19+
attributes are optional. This tuple SHOULD uniquely identify the logical unit of
20+
software that emits the telemetry. A typical approach to ensure uniqueness is to
21+
use the fully qualified name of the emitting software unit (e.g. fully qualified library
22+
name or fully qualified class name).
23+
24+
The instrumentation scope is used to obtain a
25+
[Tracer, Meter, or Logger](../glossary.md#tracer-name--meter-name--logger-name).
26+
27+
The instrumentation scope's name SHOULD be specified to identify the `InstrumentationScope`
28+
name.
29+
30+
The instrumentation scope's optional Schema URL SHOULD identify the [Telemetry
31+
Schema](../schemas/README.md) that the instrumentation's emitted
32+
telemetry conforms to.
33+
34+
The instrumentation scope's optional attributes provide additional information about
35+
the scope. For example for a scope that specifies an
36+
instrumentation library an additional attribute may be recorded to denote the URL of the
37+
repository URL the library's source code is stored.
38+
39+
## Examples
40+
41+
Here is a non comprehensive list of usage scenarios:
42+
43+
* Generic instrumentation library with its name, version and attributes containing
44+
additional library information.
45+
* Database access instrumented with its own name and version (e.g. `db.system.name`).
46+
This can be leveraged by APIs abstracting access to different underlying databases,
47+
such as JDBC or SqlAlchemy.
48+
* Client consuming or producing information, using its name, version and `id` to set
49+
`InstrumentationScope`.
50+
* Internal application components emitting their own telemetry, relying on
51+
`InstrumentationScope` attributes to differentiate themselves in case multiple
52+
instances of the same type exist.

specification/glossary.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Some other fundamental terms are documented in the [overview document](overview.
2828
* [Exporter Library](#exporter-library)
2929
* [Instrumented Library](#instrumented-library)
3030
* [Instrumentation Library](#instrumentation-library)
31-
* [Instrumentation Scope](#instrumentation-scope)
3231
* [Tracer Name / Meter Name / Logger Name](#tracer-name--meter-name--logger-name)
3332
* [Execution Unit](#execution-unit)
3433
- [Logs](#logs)
@@ -163,42 +162,13 @@ Example: `io.opentelemetry.contrib.mongodb`.
163162

164163
Synonyms: *Instrumenting Library*.
165164

166-
### Instrumentation Scope
167-
168-
A logical unit of the application code with which the emitted telemetry can be
169-
associated. It is typically the developer's choice to decide what denotes a
170-
reasonable instrumentation scope. The most common approach is to use the
171-
[instrumentation library](#instrumentation-library) as the scope, however other
172-
scopes are also common, e.g. a module, a package, or a class can be chosen as
173-
the instrumentation scope.
174-
175-
The instrumentation scope is defined by the
176-
(name,version,schema_url,attributes) tuple where version, schema_url, and
177-
attributes are optional. This tuple uniquely identifies the logical unit of the
178-
code that emits the telemetry. A typical approach to ensure uniqueness is to
179-
use the fully qualified name of the emitting code (e.g. fully qualified library
180-
name or fully qualified class name).
181-
182-
The instrumentation scope is used to obtain a
183-
[Tracer, Meter, or Logger](#tracer-name--meter-name--logger-name).
184-
185-
The instrumentation scope's optional Schema URL identifies the [Telemetry
186-
Schema](schemas/README.md) that the instrumentation's emitted
187-
telemetry conforms to.
188-
189-
The instrumentation scope may have zero or more additional attributes that provide
190-
additional information about the scope. For example for a scope that specifies an
191-
instrumentation library an additional attribute may be recorded to denote the URL of the
192-
repository URL the library's source code is stored. Since the scope is a build-time
193-
concept the attributes of the scope cannot change at runtime.
194-
195165
### Tracer Name / Meter Name / Logger Name
196166

197167
This refers to the `name` and (optional) `version` arguments specified when
198168
creating a new `Tracer` or `Meter` (see
199169
[Obtaining a Tracer](trace/api.md#tracerprovider)/[Obtaining a Meter](metrics/api.md#meterprovider))/[Obtaining a Logger](logs/api.md#loggerprovider).
200170
The name/version pair identifies the
201-
[Instrumentation Scope](#instrumentation-scope), for example the
171+
[Instrumentation Scope](common/instrumentation-scope.md), for example the
202172
[Instrumentation Library](#instrumentation-library) or another unit of
203173
application in the scope of which the telemetry is emitted.
204174

specification/logs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The `LoggerProvider` MUST provide the following functions:
6767
This API MUST accept the following [instrumentation scope](data-model.md#field-instrumentationscope)
6868
parameters:
6969

70-
* `name`: Specifies the name of the [instrumentation scope](../glossary.md#instrumentation-scope),
70+
* `name`: Specifies the name of the [instrumentation scope](../common/instrumentation-scope.md),
7171
such as the [instrumentation library](../glossary.md#instrumentation-library)
7272
(e.g. `io.opentelemetry.contrib.mongodb`), package, module or class name.
7373
If an application or library has built-in OpenTelemetry instrumentation, both

specification/logs/data-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,9 @@ This field is optional.
450450

451451
### Field: `InstrumentationScope`
452452

453-
Type: [Instrumentation Scope](../glossary.md#instrumentation-scope).
453+
Type: [Instrumentation Scope](../common/instrumentation-scope.md).
454454

455-
Description: the [instrumentation scope](../glossary.md#instrumentation-scope).
455+
Description: the [instrumentation scope](../common/instrumentation-scope.md).
456456
Multiple occurrences of events coming from the same scope can happen across time and
457457
they all have the same value of `InstrumentationScope`. This field is optional.
458458

specification/logs/sdk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ It SHOULD only be possible to create `Logger` instances through a `LoggerProvide
6666
The `LoggerProvider` MUST implement the [Get a Logger API](api.md#get-a-logger).
6767

6868
The input provided by the user MUST be used to create
69-
an [`InstrumentationScope`](../glossary.md#instrumentation-scope) instance which
69+
an [`InstrumentationScope`](../common/instrumentation-scope.md) instance which
7070
is stored on the created `Logger`.
7171

7272
In the case where an invalid `name` (null or empty string) is specified, a
@@ -104,7 +104,7 @@ the [LoggerConfig](#loggerconfig) for a [Logger](#logger).
104104
The function MUST accept the following parameter:
105105

106106
* `logger_scope`:
107-
The [`InstrumentationScope`](../glossary.md#instrumentation-scope) of
107+
The [`InstrumentationScope`](../common/instrumentation-scope.md) of
108108
the `Logger`.
109109

110110
The function MUST return the relevant `LoggerConfig`, or some signal indicating

specification/logs/supplementary-guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ popular logging library.
6666
### Logger Name
6767

6868
If the logging library has a concept that is similar to OpenTelemetry's
69-
definition of the [Instrumentation Scope's](../glossary.md#instrumentation-scope)
69+
definition of the [Instrumentation Scope's](../common/instrumentation-scope.md)
7070
name, then the appender's implementation should use that value as the
7171
name parameter when [obtaining the Logger](./api.md#get-a-logger).
7272

specification/metrics/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ The `MeterProvider` MUST provide the following functions:
121121
This API MUST accept the following parameters:
122122

123123
* `name`: Specifies the name of the [instrumentation
124-
scope](../glossary.md#instrumentation-scope), such as the
124+
scope](../common/instrumentation-scope.md), such as the
125125
[instrumentation library](../glossary.md#instrumentation-library) (e.g.
126126
`io.opentelemetry.contrib.mongodb`), package,
127127
module or class name. If an application or library has built-in OpenTelemetry

specification/metrics/sdk.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ It SHOULD only be possible to create `Meter` instances through a `MeterProvider`
122122
The `MeterProvider` MUST implement the [Get a Meter API](api.md#get-a-meter).
123123

124124
The input provided by the user MUST be used to create
125-
an [`InstrumentationScope`](../glossary.md#instrumentation-scope) instance which
125+
an [`InstrumentationScope`](../common/instrumentation-scope.md) instance which
126126
is stored on the created `Meter`.
127127

128128
In the case where an invalid `name` (null or empty string) is specified, a
@@ -161,7 +161,7 @@ the [MeterConfig](#meterconfig) for a [Meter](#meter).
161161
The function MUST accept the following parameter:
162162

163163
* `meter_scope`:
164-
The [`InstrumentationScope`](../glossary.md#instrumentation-scope) of
164+
The [`InstrumentationScope`](../common/instrumentation-scope.md) of
165165
the `Meter`.
166166

167167
The function MUST return the relevant `MeterConfig`, or some signal indicating
@@ -1717,7 +1717,7 @@ MAY return successfully collected results and a failed reasons list to the
17171717
caller.
17181718

17191719
If a batch of [Metric Points](./data-model.md#metric-points) can include
1720-
[`InstrumentationScope`](../glossary.md#instrumentation-scope) information,
1720+
[`InstrumentationScope`](../common/instrumentation-scope.md) information,
17211721
`Produce` SHOULD include a single InstrumentationScope which identifies the
17221722
`MetricProducer`.
17231723

0 commit comments

Comments
 (0)