Skip to content

Commit 7d8f29d

Browse files
Liudmila Molkovajoaopgrassi
andauthored
Add system-specific naming guidance (#1708)
Co-authored-by: Joao Grassi <[email protected]>
1 parent 607a441 commit 7d8f29d

File tree

2 files changed

+170
-22
lines changed

2 files changed

+170
-22
lines changed

.chloggen/1708.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
change_type: enhancement
2+
component: docs
3+
note: Document system-specific naming conventions
4+
issues: [608, 1494, 1708]

docs/general/naming.md

Lines changed: 166 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,28 @@ aliases: [attribute-naming]
1212
<!-- toc -->
1313

1414
- [General naming considerations](#general-naming-considerations)
15-
- [Name Abbreviation Guidelines](#name-abbreviation-guidelines)
16-
- [Name Reuse Prohibition](#name-reuse-prohibition)
17-
- [Recommendations for OpenTelemetry Authors](#recommendations-for-opentelemetry-authors)
18-
- [Recommendations for Application Developers](#recommendations-for-application-developers)
15+
- [Name abbreviation guidelines](#name-abbreviation-guidelines)
16+
- [Name reuse prohibition](#name-reuse-prohibition)
17+
- [Recommendations for OpenTelemetry authors](#recommendations-for-opentelemetry-authors)
18+
- [Recommendations for application developers](#recommendations-for-application-developers)
1919
- [Attributes](#attributes)
20-
- [otel.\* Namespace](#otel-namespace)
21-
- [Attribute Name Pluralization Guidelines](#attribute-name-pluralization-guidelines)
22-
- [Signal-specific Attributes](#signal-specific-attributes)
20+
- [otel.\* namespace](#otel-namespace)
21+
- [Attribute name pluralization guidelines](#attribute-name-pluralization-guidelines)
22+
- [Signal-specific attributes](#signal-specific-attributes)
23+
- [System-specific attributes](#system-specific-attributes)
2324
- [Metrics](#metrics)
24-
- [Naming Rules for Counters and UpDownCounters](#naming-rules-for-counters-and-updowncounters)
25+
- [Naming rules for counters and UpDownCounters](#naming-rules-for-counters-and-updowncounters)
2526
- [Pluralization](#pluralization)
26-
- [Use `count` Instead of Pluralization for UpDownCounters](#use-count-instead-of-pluralization-for-updowncounters)
27-
- [Do Not Use `total`](#do-not-use-total)
28-
- [Instrument Naming](#instrument-naming)
27+
- [Use `count` instead of pluralization for UpDownCounters](#use-count-instead-of-pluralization-for-updowncounters)
28+
- [Do not use `total`](#do-not-use-total)
29+
- [Instrument naming](#instrument-naming)
30+
- [Client and server metrics](#client-and-server-metrics)
31+
- [System-specific naming](#system-specific-naming)
32+
- [System (project/product/provider) name attribute](#system-projectproductprovider-name-attribute)
33+
- [Choosing a system name](#choosing-a-system-name)
34+
- [System-specific attributes](#system-specific-attributes-1)
35+
- [System-specific metrics](#system-specific-metrics)
36+
- [Known exceptions](#known-exceptions)
2937

3038
<!-- tocstop -->
3139

@@ -84,7 +92,7 @@ Names SHOULD follow these rules:
8492
components or words in multi-word components when they are not necessary. For example,
8593
`vcs.change.id` describes pull request id as precisely as `vcs.repository.change.id` does.
8694

87-
## Name Abbreviation Guidelines
95+
## Name abbreviation guidelines
8896

8997
Abbreviations MAY be used when they are widely recognized and commonly used.
9098

@@ -100,7 +108,7 @@ or `container.oci.*` instead of `container.open_container_initiative.*`
100108
Abbreviations SHOULD be avoided if they are ambiguous, for example, when they apply
101109
to multiple products or concepts.
102110

103-
## Name Reuse Prohibition
111+
## Name reuse prohibition
104112

105113
Two attributes, two metrics, or two events MUST NOT share the same name.
106114
Different entities (attribute and metric, metric and event) MAY share the same name.
@@ -109,7 +117,7 @@ Attributes, metrics, and events SHOULD NOT be removed from semantic
109117
conventions regardless of their maturity level. When the convention is renamed or
110118
no longer recommended, it SHOULD be deprecated.
111119

112-
## Recommendations for OpenTelemetry Authors
120+
## Recommendations for OpenTelemetry authors
113121

114122
- When coming up with a new semantic convention make sure to check existing
115123
namespaces ([Semantic Conventions](/docs/README.md)) to see if a similar namespace
@@ -134,7 +142,7 @@ no longer recommended, it SHOULD be deprecated.
134142
> Names must start with a letter, end with an alphanumeric character, and must not
135143
> contain two or more consecutive delimiters (Underscore or Dot).
136144
137-
## Recommendations for Application Developers
145+
## Recommendations for application developers
138146

139147
As an application developer when you need to record an attribute, metric, event, or
140148
other signal first consult existing [semantic conventions](./README.md).
@@ -173,7 +181,7 @@ subset of Unicode code points).
173181

174182
## Attributes
175183

176-
### otel.\* Namespace
184+
### otel.\* namespace
177185

178186
Attribute names that start with `otel.` are reserved to be defined by
179187
OpenTelemetry specification. These are typically used to express OpenTelemetry
@@ -187,7 +195,7 @@ and protocols.
187195
Any additions to the `otel.*` namespace MUST be approved as part of
188196
OpenTelemetry specification.
189197

190-
### Attribute Name Pluralization Guidelines
198+
### Attribute name pluralization guidelines
191199

192200
- When an attribute represents a single entity, the attribute name SHOULD be
193201
singular. Examples: `host.name`, `container.id`.
@@ -200,7 +208,7 @@ OpenTelemetry specification.
200208
[Name Pluralization Guidelines](./naming.md#pluralization) SHOULD be
201209
followed for the attribute name.
202210

203-
### Signal-specific Attributes
211+
### Signal-specific attributes
204212

205213
**Status**: [Development][DocumentStatus]
206214

@@ -226,11 +234,37 @@ Examples:
226234
Metric `http.server.request.duration` uses attributes from the registry such as
227235
`server.port`, `error.type`.
228236

237+
### System-specific attributes
238+
239+
**Status**: [Development][DocumentStatus]
240+
241+
When an attribute is specific to a particular system (e.g., project, provider, product),
242+
the system name should be used in the attribute name, following the pattern:
243+
`{optional domain}.{system}.*.{property}` pattern.
244+
245+
Examples:
246+
247+
- `db.cassandra.consistency_level` - Describes the consistency level property
248+
specific to the Cassandra database.
249+
- `aws.s3.key` - Refers to the `key` property of the AWS S3 product.
250+
- `signalr.connection.status` – Indicates the connection status of the SignalR
251+
network protocol. In this case, no domain is included.
252+
253+
Semantic conventions for a specific domain are generally applicable to multiple systems.
254+
These conventions should define an attribute to represent the name of the system.
255+
For example, database conventions include the `db.system.name` attribute.
256+
257+
The name of the system used in the corresponding attribute should match the name
258+
used inside system-specific attributes.
259+
260+
For example, if the database name specified in `db.system.name` is `foo.bar`, system-specific
261+
attributes for this database should follow the `db.foo.bar.*` pattern.
262+
229263
## Metrics
230264

231265
**Status**: [Development][DocumentStatus]
232266

233-
### Naming Rules for Counters and UpDownCounters
267+
### Naming rules for counters and UpDownCounters
234268

235269
#### Pluralization
236270

@@ -249,7 +283,7 @@ should not be pluralized, even if many data points are recorded.
249283
* `system.paging.faults`, `system.disk.operations`, and `system.network.packets`
250284
should be pluralized, even if only a single data point is recorded.
251285

252-
#### Use `count` Instead of Pluralization for UpDownCounters
286+
#### Use `count` instead of pluralization for UpDownCounters
253287

254288
If the value being recorded represents the count of concepts signified
255289
by the namespace then the metric should be named `count` (within its namespace).
@@ -258,15 +292,15 @@ For example if we have a namespace `system.process` which contains all metrics r
258292
to the processes then to represent the count of the processes we can have a metric named
259293
`system.process.count`.
260294

261-
#### Do Not Use `total`
295+
#### Do not use `total`
262296

263297
UpDownCounters SHOULD NOT use `_total` because then they will look like
264298
monotonic sums.
265299

266300
Counters SHOULD NOT append `_total` either because then their meaning will
267301
be confusing in delta backends.
268302

269-
### Instrument Naming
303+
### Instrument naming
270304

271305
**Status**: [Development][DocumentStatus]
272306

@@ -313,4 +347,114 @@ freely. For example, `system.paging.faults` and `system.network.packets`.
313347
Units do not need to be specified in the names since they are included during
314348
instrument creation, but can be added if there is ambiguity.
315349

350+
### Client and server metrics
351+
352+
Metrics that measure some aspect of a physical or logical network call SHOULD include
353+
an indication of which side the metric is being recorded from.
354+
355+
Such metrics SHOULD follow the `{area}.{client|server}.{metric_name}`
356+
pattern if the communication side is ambiguous for a given `{area}` and `{metric_name}`.
357+
Otherwise, when the communication side can be inferred from the given `{area}` or
358+
`{metric_name}`, the `{area}.{metric_name}` pattern SHOULD be used.
359+
360+
Examples:
361+
362+
- `http.client.request.duration`
363+
- `gen_ai.server.request.duration`
364+
- `messaging.client.sent.messages`
365+
- `messaging.process.duration` - the term `process` clearly indicates that
366+
the metric is reported by the consumer.
367+
- `kestrel.connection.duration` - here, `kestrel` is the name of the web server,
368+
so no additional indication is necessary.
369+
370+
## System-specific naming
371+
372+
**Status**: [Development][DocumentStatus]
373+
374+
### System (project/product/provider) name attribute
375+
376+
Semantic conventions for a certain area are usually applicable to multiple systems
377+
(projects, providers, products).
378+
379+
For example, database semantic conventions can be used to describe telemetry for a
380+
broad range of database systems.
381+
382+
Such conventions SHOULD define an attribute to represent the system name following
383+
`{area}.system|provider|protocol.name` pattern.
384+
385+
For example, database conventions include the `db.system.name` attribute.
386+
387+
### Choosing a system name
388+
389+
When adding new a system to the semantic conventions, follow these principles in descending order of priority:
390+
391+
1. The system name SHOULD adhere to the general attribute naming guidelines outlined in this document,
392+
as it will be used as a namespace in [system-specific attribute names](#system-specific-attributes).
393+
394+
2. The system name SHOULD unambiguously identify this specific product or project.
395+
396+
For example, use `gcp.pubsub` or `oracle.db`. Avoid generic names like `pubsub`,
397+
which could refer to multiple messaging products, or `oracle` which could refer to
398+
multiple Oracle products.
399+
400+
3. The system name SHOULD match the corresponding project or product name in the following cases:
401+
402+
- Independent projects that do not belong to a specific company, such as Apache Foundation projects like
403+
`kafka` or `cassandra`.
404+
- Products with names similar to the owning company, such as `mongodb` or `elasticsearch`
405+
- Widely recognized products that are popular outside their company's ecosystem.
406+
These products often have trademarks without the company name and have
407+
their own top-level domain (e.g. `spring` or `mysql`).
408+
409+
4. In other cases, the system name SHOULD be prefixed with the company (organization,
410+
division, or group) name. For cloud services, the name SHOULD use the
411+
corresponding cloud provider name. For example, use `aws.dynamodb` or `azure.cosmosdb`.
412+
413+
The company (organization, division, or group) name SHOULD remain consistent
414+
across multiple product names in different semantic convention areas.
415+
416+
### System-specific attributes
417+
418+
When an attribute is specific to a particular system (project, provider, product),
419+
the corresponding attribute name SHOULD start with the system name following the
420+
`{system_name}.*.{property}` pattern.
421+
422+
Examples:
423+
424+
- `cassandra.consistency.level` - Describes the consistency level property
425+
specific to the Cassandra database.
426+
- `aws.s3.key` - Refers to the `key` property of the AWS S3 product.
427+
- `signalr.connection.status` – Indicates the connection status of the SignalR
428+
network protocol.
429+
430+
The value of the [`*.system.name`](#system-projectproductprovider-name-attribute) (or similar)
431+
attribute MUST match the root namespace used in the system specific attribute being defined.
432+
433+
For example, both `cassandra.consistency.level` attribute name and `db.system.name=cassandra`
434+
use the same system name (`cassandra`).
435+
436+
### System-specific metrics
437+
438+
When a metric is specific to a system (project, provider, product),
439+
the corresponding instrument name SHOULD start with the system name following the
440+
`{system_name}.*.{metric_name}` pattern.
441+
442+
For example, `azure.cosmosdb.client.operation.request_charge`
443+
444+
The value of the [`*.system.name`](#system-projectproductprovider-name-attribute) (or similar)
445+
attribute MUST match system specific metric namespace.
446+
447+
For example, both the `azure.cosmosdb.client.operation.request_charge` metric and the `db.system.name=azure.cosmosdb`
448+
attribute use the same system name (`azure.cosmosdb`).
449+
450+
### Known exceptions
451+
452+
- Operational system and process-related attributes and metrics [follow a
453+
pattern](/docs/system/system-metrics.md#systemos---os-specific-system-metrics)
454+
of `system.{os}` and `process.{os}`. <!-- TODO: document why-->
455+
456+
- [RPC](/docs/rpc/README.md), [messaging](/docs/messaging/README.md), and
457+
[GenAI](/docs/gen-ai/README.md) semantic conventions don't follow the
458+
system-specific naming guidance yet, and will be updated one-by-one.
459+
316460
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

0 commit comments

Comments
 (0)