@@ -6,7 +6,7 @@ Table of Contents
66</summary >
77
88- [ Attributes] ( #attributes )
9- - [ Attribute Naming] ( #attribute-naming )
9+ - [ Attribute and Label Naming] ( #attribute-and-label -naming )
1010</details >
1111
1212## Attributes
@@ -37,12 +37,22 @@ indices that are kept in sync (e.g., two attributes `header_keys` and `header_va
3737both containing an array of strings to represent a mapping
3838` header_keys[i] -> header_values[i] ` ).
3939
40- ### Attribute Naming
40+ ## Attribute and Label Naming
4141
42- Attribute name (also known as the "attribute key") MUST be a valid Unicode
43- sequence.
42+ _ This section applies to Resource, Span and Log attribute names (also known as
43+ the "attribute keys") and to keys of Metric labels. For brevity within this
44+ section when we use the term "name" without an adjective it is implied to mean
45+ "attribute name or metric label key"._
4446
45- Attribute names SHOULD follow these rules:
47+ Every name MUST be a valid Unicode sequence.
48+
49+ _ Note: we merely require that the names are represented as Unicode sequences.
50+ This specification does not define how exactly the Unicode sequences are
51+ encoded. The encoding can vary from one programming language to another and from
52+ one wire format to another. Use the idiomatic way to represent Unicode in the
53+ particular programming language or wire format._
54+
55+ Names SHOULD follow these rules:
4656
4757- Use namespacing to avoid name clashes. Delimit the namespaces using a dot
4858 character. For example ` service.version ` denotes the service version where
@@ -56,68 +66,67 @@ Attribute names SHOULD follow these rules:
5666 words by underscores (i.e. use snake_case). For example ` http.status_code `
5767 denotes the status code in the http namespace.
5868
59- - Attribute names SHOULD NOT coincide with namespaces. For example if
69+ - Names SHOULD NOT coincide with namespaces. For example if
6070 ` service.instance.id ` is an attribute name then it is no longer valid to have
6171 an attribute named ` service.instance ` because ` service.instance ` is already a
62- namespace. Because of this rule be careful when choosing attribute names:
63- every existing attribute name prohibits existence of an equally named
64- namespace in the future, and vice versa: any existing namespace prohibits
65- existence of an equally named attribute in the future.
72+ namespace. Because of this rule be careful when choosing names: every existing
73+ name prohibits existence of an equally named namespace in the future, and vice
74+ versa: any existing namespace prohibits existence of an equally named
75+ attribute or label key in the future.
6676
67- #### Recommendations for OpenTelemetry Authors
77+ ### Recommendations for OpenTelemetry Authors
6878
69- - All attribute names that are part of OpenTelemetry semantic conventions
70- SHOULD be part of a namespace.
79+ - All names that are part of OpenTelemetry semantic conventions SHOULD be part
80+ of a namespace.
7181
72- - When coming up with a new convention make sure to check existing namespaces
73- for
82+ - When coming up with a new semantic convention make sure to check existing
83+ namespaces for
7484 [ Resources] ( https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions ) ,
7585 [ Spans] ( https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/trace/semantic_conventions ) ,
7686 and
7787 [ Metrics] ( https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/metrics/semantic_conventions )
78- to see if the new attributes fits.
88+ to see if the new name fits.
7989
8090- When a new namespace is necessary consider whether it should be a top-level
8191 namespace (e.g. ` service ` ) or a nested namespace (e.g. ` service.instance ` ).
8292
83- - Semantic conventions MUST limit attribute names to printable Basic Latin
84- characters (more precisely to
93+ - Semantic conventions MUST limit names to printable Basic Latin characters
94+ (more precisely to
8595 [ U+0021 .. U+007E] ( https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)#Table_of_characters )
86- subset of Unicode code points). It is recommended to further limit attribute
87- names to the following Unicode code points: Latin alphabet, Numeric,
88- Underscore, Dot (as namespace delimiter).
96+ subset of Unicode code points). It is recommended to further limit names to
97+ the following Unicode code points: Latin alphabet, Numeric, Underscore, Dot
98+ (as namespace delimiter).
8999
90- #### Recommendations for Application Developers
100+ ### Recommendations for Application Developers
91101
92- As an application developer when you need to record an attribute first consult
93- existing semantic conventions for
102+ As an application developer when you need to record an attribute or a label
103+ first consult existing semantic conventions for
94104[ Resources] ( https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions ) ,
95105[ Spans] ( https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/trace/semantic_conventions ) ,
96106and
97107[ Metrics] ( https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/metrics/semantic_conventions ) .
98- If appropriate attribute name does not exists you will need to come up with a
99- new name. To do that consider a few options:
100-
101- - The attribute is specific to your company and may be possibly used outside the
102- company as well. To avoid name clashes with attributes introduced by other
103- companies (in a distributed system that uses applications from multiple
104- vendors) it is recommended to prefix the attribute name by your company's
105- reverse domain name, e.g. ` com.acme.shopname ` .
106-
107- - The attribute is specific to your application that will be used internally
108- only. If you already have an internal company process that helps you to ensure
109- no name clashes happen then feel free to follow it. Otherwise it is
110- recommended to prefix the attribute name by your application name, provided
111- that the application name is reasonably unique within your organization (e.g.
108+ If an appropriate name does not exists you will need to come up with a new name.
109+ To do that consider a few options:
110+
111+ - The name is specific to your company and may be possibly used outside the
112+ company as well. To avoid clashes with names introduced by other companies (in
113+ a distributed system that uses applications from multiple vendors) it is
114+ recommended to prefix the new name by your company's reverse domain name, e.g.
115+ ` com.acme.shopname ` .
116+
117+ - The name is specific to your application that will be used internally only. If
118+ you already have an internal company process that helps you to ensure no name
119+ clashes happen then feel free to follow it. Otherwise it is recommended to
120+ prefix the attribute name or label key by your application name, provided that
121+ the application name is reasonably unique within your organization (e.g.
112122 ` myuniquemapapp.longitude ` is likely fine). Make sure the application name
113123 does not clash with an existing semantic convention namespace.
114124
115- - The attribute may be generally applicable to applications in the industry. In
116- that case consider submitting a proposal to this specification to add a new
117- attribute to the semantic conventions, if necessary also to add a new
118- namespace for the attribute.
125+ - The name may be generally applicable to applications in the industry. In that
126+ case consider submitting a proposal to this specification to add a new name to
127+ the semantic conventions, and if necessary also to add a new namespace.
119128
120- It is recommended to limit attribute names to printable Basic Latin characters
129+ It is recommended to limit names to printable Basic Latin characters
121130(more precisely to
122131[ U+0021 .. U+007E] ( https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)#Table_of_characters )
123132subset of Unicode code points).
0 commit comments