Lightstep from ServiceNow Logo






Lightstep from ServiceNow Logo

OpenTelemetry Core Concepts: Attributes and Labels

Key:value pairs can be used to affix metadata to spans, events, metrics, and distributed contexts in order to query, filter, and further analyze trace data. Depending on the resource (span, event, or metric), the OpenTelemetry documentation may refer to these key:values as attributes or labels.

Metadata referenceResource
AttributeSpans, events

Attributes and labels should apply to the entirety of the resource they are describing.

Let’s take a closer look at the Resource Conventions document for definitions of standard attributes for OpenTelemtry’s data resources.

Document Conventions

Attributes are grouped logically by the type of the concept that they described. Attributes in the same group have a common prefix that ends with a dot. For example all attributes that describe Kubernetes properties start with k8s.

Certain attribute groups in this document have a Required column. For these groups if any attribute from the particular group is present in the Resource then all attributes that are marked as Required MUST be also present in the Resource. However it is also valid if the entire attribute group is omitted (i.e. none of the attributes from the particular group are present even though some of them are marked as Required in this document).


type: service

Description: A service instance.

service.nameLogical name of the service.
MUST be the same for all instances of horizontally scaled services.
service.namespaceA namespace for
A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. is expected to be unique within the same namespace. The field is optional. If service.namespace is not specified in the Resource then is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.
service.instance.idThe string ID of the service instance.
MUST be unique for each instance of the same service.namespace, pair (in other words service.namespace,, triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations).
service.versionThe version string of the service API or implementation as defined in Version Attributes.semver:2.0.0No

service.namespace and are not intended to be concatenated for the purpose of forming a single globally unique name for the service. For example the following 2 sets of attributes actually describe 2 different services (despite the fact that the concatenation would result in the same string). {: .callout}

# Resource attributes that describe a service.
namespace = Company.Shop = shoppingcart
# Another set of resource attributes that describe a different service.
namespace = Company = Shop.shoppingcart


type: library

Description: Telemetry library information.

library.nameThe name of the telemetry library.opentelemetryNo
library.languageThe language of telemetry library and of the code instrumented with it.
The following spelling SHOULD be used for language strings: "cpp", "dotnet", "erlang", "go", "java", "nodejs", "php", "python", "ruby", "webjs"
library.versionThe version string of the library as defined in Version Attributes.semver:1.2.3No

Compute Unit

Attributes defining a compute unit (e.g. Container, Process, Lambda Function).


type: container

Description: A container instance.

container.nameContainer name.opentelemetry-autoconf
container.image.nameName of the image the container was built
container.image.tagContainer image tag.0.1

Deployment Service

Attributes defining a deployment service (e.g. Kubernetes).


type: k8s

Description: A Kubernetes resource.

k8s.cluster.nameThe name of the cluster that the pod is running in.opentelemetry-cluster
k8s.namespace.nameThe name of the namespace that the pod is running in.default
k8s.pod.nameThe name of the pod.opentelemetry-pod-autoconf
k8s.deployment.nameThe name of the deployment.opentelemetry

Compute Instance

Attributes defining a computing instance (e.g. host).


type: host

Description: A host is defined as a general computing instance.

host.hostnameHostname of the host.
It contains what the hostname command returns on the host machine.
host.idUnique host id.
For Cloud this must be the instance_id assigned by the cloud provider
host.nameName of the host.
It may contain what hostname returns on Unix systems, the fully qualified, or a name specified by the user.
host.typeType of host.
For Cloud this must be the machine type.
host.image.nameName of the VM image or OS install the host was instantiated from.infra-ami-eks-worker-node-7d4ec78312, CentOS-8-x86_64-1905
host.image.idVM image id. For Cloud, this value is from the provider.ami-07b06b442921831e5
host.image.versionThe version string of the VM image as defined in Version Attributes.0.1


Attributes defining a running environment (e.g. Cloud, Data Center).


type: cloud

Description: A cloud infrastructure (e.g. GCP, Azure, AWS).

cloud.providerName of the cloud provider.
Example values are aws, azure, gcp.
cloud.account.idThe cloud account id used to identify different entities.opentelemetry
cloud.regionA specific geographical location where different entities can runus-central1
cloud.zoneZones are a sub set of the region connected through low-latency links.
In aws it is called availability-zone.

Version Attributes

Version attributes such as service.version and library.version are values of type string, with naming schemas hinting at the type of a version, such as the following:

  • semver:1.2.3 (a semantic version)
  • git:8ae73a (a git sha hash)
  • (a untyped version)

The type and version value MUST be separated by a colon character :.