Rename Metrics labels to attributes (#1775)

This commit is contained in:
Jakub Malinowski 2021-07-01 00:11:54 +02:00 committed by Josh Suereth
parent 71df386e08
commit dcf74c311a
2 changed files with 18 additions and 20 deletions

View File

@ -1,4 +1,4 @@
# Attribute and Label Naming # Attribute Naming
**Status**: [Experimental](../document-status.md) **Status**: [Experimental](../document-status.md)
@ -13,10 +13,9 @@ Table of Contents
</details> </details>
_This section applies to Resource, Span and Log attribute names (also known as _This section applies to Resource, Span, Log, and Metric attribute names (also
the "attribute keys") and to keys of Metric labels. For brevity within this known as the "attribute keys"). For brevity within this section when we use the
section when we use the term "name" without an adjective it is implied to mean term "name" without an adjective it is implied to mean "attribute name"._
"attribute name or metric label key"._
Every name MUST be a valid Unicode sequence. Every name MUST be a valid Unicode sequence.
@ -50,7 +49,7 @@ Names SHOULD follow these rules:
namespace. Because of this rule be careful when choosing names: every existing namespace. Because of this rule be careful when choosing names: every existing
name prohibits existence of an equally named namespace in the future, and vice name prohibits existence of an equally named namespace in the future, and vice
versa: any existing namespace prohibits existence of an equally named versa: any existing namespace prohibits existence of an equally named
attribute or label key in the future. attribute key in the future.
## Name Pluralization guidelines ## Name Pluralization guidelines
@ -81,14 +80,13 @@ Names SHOULD follow these rules:
- When a new namespace is necessary consider whether it should be a top-level - When a new namespace is necessary consider whether it should be a top-level
namespace (e.g. `service`) or a nested namespace (e.g. `service.instance`). namespace (e.g. `service`) or a nested namespace (e.g. `service.instance`).
- Semantic conventions exist for four areas: for Resource, Span and Log - Semantic conventions exist for four areas: for Resource, Span, Log, and Metric
attribute names as well as Metric label keys. In addition, for spans we have attribute names. In addition, for spans we have two more areas: Event and Link
two more areas: Event and Link attribute names. Identical namespaces or names attribute names. Identical namespaces or names in all these areas MUST have
in all these areas MUST have identical meanings. For example the `http.method` identical meanings. For example the `http.method` span attribute name denotes
span attribute name denotes exactly the same concept as the `http.method` exactly the same concept as the `http.method` metric attribute, has the same
metric label, has the same data type and the same set of possible values (in data type and the same set of possible values (in both cases it records the
both cases it records the value of the HTTP protocol's request method as a value of the HTTP protocol's request method as a string).
string).
- Semantic conventions MUST limit names to printable Basic Latin characters - Semantic conventions MUST limit names to printable Basic Latin characters
(more precisely to (more precisely to
@ -99,8 +97,8 @@ Names SHOULD follow these rules:
## Recommendations for Application Developers ## Recommendations for Application Developers
As an application developer when you need to record an attribute or a label As an application developer when you need to record an attribute first consult
first consult existing semantic conventions for existing semantic conventions for
[Resources](../resource/semantic_conventions/README.md), [Resources](../resource/semantic_conventions/README.md),
[Spans](../trace/semantic_conventions/README.md), [Spans](../trace/semantic_conventions/README.md),
and and
@ -117,7 +115,7 @@ To do that consider a few options:
- The name is specific to your application that will be used internally only. If - The name is specific to your application that will be used internally only. If
you already have an internal company process that helps you to ensure no name you already have an internal company process that helps you to ensure no name
clashes happen then feel free to follow it. Otherwise it is recommended to clashes happen then feel free to follow it. Otherwise it is recommended to
prefix the attribute name or label key by your application name, provided that prefix the attribute name by your application name, provided that
the application name is reasonably unique within your organization (e.g. the application name is reasonably unique within your organization (e.g.
`myuniquemapapp.longitude` is likely fine). Make sure the application name `myuniquemapapp.longitude` is likely fine). Make sure the application name
does not clash with an existing semantic convention namespace. does not clash with an existing semantic convention namespace.
@ -133,7 +131,7 @@ subset of Unicode code points).
## otel.* Namespace ## otel.* Namespace
Attribute and label names that start with `otel.` are reserved to be defined by Attribute names that start with `otel.` are reserved to be defined by
OpenTelemetry specification. These are typically used to express OpenTelemetry OpenTelemetry specification. These are typically used to express OpenTelemetry
concepts in formats that don't have a corresponding concept. concepts in formats that don't have a corresponding concept.

View File

@ -40,4 +40,4 @@ indices that are kept in sync (e.g., two attributes `header_keys` and `header_va
both containing an array of strings to represent a mapping both containing an array of strings to represent a mapping
`header_keys[i] -> header_values[i]`). `header_keys[i] -> header_values[i]`).
See [Attribute and Label Naming](attribute-and-label-naming.md) for naming guidelines. See [Attribute Naming](attribute-naming.md) for naming guidelines.