Skip to content

Commit

Permalink
Prohibit usage of retired names in semantic conventions
Browse files Browse the repository at this point in the history
This change adds a prohibition clause that requires that no old
metric or attribute name is used for a new attribute.

This is important to ensure reversibility of schema transformation
(converting from a new version to an old version of schema).

Without this restriction the following is possible:

Schema version 1. Attribute A exists.
Schema version 2. Attribute A is renamed to B. Appropriate schema file is created.
Schema version 3. Attribute A is introduced (a completely different new attribute).

Now attempting to go from Version 3 to version 1 is impossible since it requires
renaming B to A (for the change in version 2), but a different attribute A already exists.
  • Loading branch information
tigrannajaryan committed Dec 3, 2021
1 parent a6cfbc9 commit 63c9e8f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions specification/common/attribute-naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<!-- toc -->

- [Name Pluralization guidelines](#name-pluralization-guidelines)
- [Name Reuse Prohibition](#name-reuse-prohibition)
- [Recommendations for OpenTelemetry Authors](#recommendations-for-opentelemetry-authors)
- [Recommendations for Application Developers](#recommendations-for-application-developers)
- [otel.* Namespace](#otel-namespace)
Expand Down Expand Up @@ -67,6 +68,16 @@ Names SHOULD follow these rules:
[Metric Name Pluralization Guidelines](../metrics/semantic_conventions/README.md#pluralization)
SHOULD be followed for the attribute name.

## Name Reuse Prohibition

It is prohibited to introduce a new attribute with a name that matches a name of
an attribute that existed in the past but was renamed (with a corresponding
schema file).

When introducing a new attribute name check all existing schema files to make
sure the name does not appear as a key of any "rename_attributes" section (keys
denote old attribute names in rename operations).

## Recommendations for OpenTelemetry Authors

- All names that are part of OpenTelemetry semantic conventions SHOULD be part
Expand Down
11 changes: 11 additions & 0 deletions specification/metrics/semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!-- toc -->

- [General Guidelines](#general-guidelines)
* [Name Reuse Prohibition](#name-reuse-prohibition)
* [Units](#units)
* [Pluralization](#pluralization)
- [General Metric Semantic Conventions](#general-metric-semantic-conventions)
Expand Down Expand Up @@ -66,6 +67,16 @@ and confusion for end users. (For example, prefer `process.runtime.java.gc*` ove
`process.runtime.gc.*`.) Measures of many operating system metrics are similarly
ambiguous.

### Name Reuse Prohibition

It is prohibited to introduce a new metric with a name that matches a name of
a metric that existed in the past but was renamed (with a corresponding
schema file).

When introducing a new metric name check all existing schema files to make sure
the name does not appear as a key of any "rename_metrics" section (keys denote
old metric names in rename operations).

### Units

Conventional metrics or metrics that have their units included in
Expand Down
10 changes: 10 additions & 0 deletions specification/trace/semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ The following library-specific semantic conventions are defined:
Apart from semantic conventions for traces and [metrics](../../metrics/semantic_conventions/README.md),
OpenTelemetry also defines the concept of overarching [Resources](../../resource/sdk.md) with their own
[Resource Semantic Conventions](../../resource/semantic_conventions/README.md).

## Event Name Reuse Prohibition

It is prohibited to introduce a new event with a name that matches a name of an
event that existed in the past but was renamed (with a corresponding schema
file).

When introducing a new event name check all existing schema files to make sure
the name does not appear as a key of any "rename_events" section (keys denote
old event names in rename operations).

0 comments on commit 63c9e8f

Please sign in to comment.