Prohibit usage of retired names in semantic conventions (#2191)

* Prohibit usage of retired names in semantic conventions

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.

* Fix based on comments

* Add changelog entry

Co-authored-by: Carlos Alberto Cortez <calberto.cortez@gmail.com>
This commit is contained in:
Tigran Najaryan 2021-12-13 13:04:41 -05:00 committed by GitHub
parent d42c6f54a9
commit 7652ed48fa
2 changed files with 19 additions and 0 deletions

View File

@ -7,6 +7,7 @@
<!-- toc --> <!-- toc -->
- [General Guidelines](#general-guidelines) - [General Guidelines](#general-guidelines)
* [Name Reuse Prohibition](#name-reuse-prohibition)
* [Units](#units) * [Units](#units)
* [Pluralization](#pluralization) * [Pluralization](#pluralization)
- [General Metric Semantic Conventions](#general-metric-semantic-conventions) - [General Metric Semantic Conventions](#general-metric-semantic-conventions)
@ -66,6 +67,15 @@ and confusion for end users. (For example, prefer `process.runtime.java.gc*` ove
`process.runtime.gc.*`.) Measures of many operating system metrics are similarly `process.runtime.gc.*`.) Measures of many operating system metrics are similarly
ambiguous. ambiguous.
### Name Reuse Prohibition
A new metric MUST NOT be added with the same name as 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 ### Units
Conventional metrics or metrics that have their units included in Conventional metrics or metrics that have their units included in

View File

@ -31,3 +31,12 @@ The following library-specific semantic conventions are defined:
Apart from semantic conventions for traces and [metrics](../../metrics/semantic_conventions/README.md), 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 OpenTelemetry also defines the concept of overarching [Resources](../../resource/sdk.md) with their own
[Resource Semantic Conventions](../../resource/semantic_conventions/README.md). [Resource Semantic Conventions](../../resource/semantic_conventions/README.md).
## Event Name Reuse Prohibition
A new event MUST NOT be added with the same name as 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).