Enforce attribute keys to follow common specifications.
An聽Attribute
聽is a key-value pair, which is encapsulated as part of a span. The attribute key should follow a set of common specifications to be considered valid.
The following OpenTelemetry Semantic Conventions for attribute keys are defined:
- It must be a non-null聽and non-empty string.
- It must be a valid Unicode sequence.
- It should use namespacing to avoid name clashes. Delimit the namespaces using a dot character. For example聽
service.version
聽denotes the service version where聽service
聽is the namespace and聽version
聽is an attribute in that namespace. - Namespaces can be nested. For example聽
telemetry.sdk
聽is a namespace inside top-level聽telemetry
聽namespace and聽telemetry.sdk.name
聽is an attribute inside聽telemetry.sdk
聽namespace. - For each multi-word separate the words by underscores (use snake_case). For example聽
http.status_code
聽denotes the status code in the http namespace. - Names should not coincide with namespaces. For example if聽
service.instance.id
聽is an attribute name then it is no longer valid to have an attribute named聽service.instance
聽because聽service.instance
聽is already a namespace.
This rule has the following options:
"error"
requires attribute keys to follow the OTel semantic convention"disabled"
disables the attribute keys verification"warning"
verifies attribute keys to follow the OTel semantic convention but does not impact the analyzer score
If you don鈥檛 want to enforce OTel attribute keys, don鈥檛 enable this rule.