Docs » Install and configure Splunk Distribution of OpenTelemetry Collector » Use the Collector with Splunk Observability Cloud » Add tags to your configuration

Add tags to your configuration 🔗

Tags are key-value pairs of data associated with recorded measurements to provide contextual information, distinguish, and group metrics during analysis and inspection. When measurements are aggregated to become metrics, tags are used as the labels to break down the metrics.

Include span tags in settings for the batch processor in your configuration YAML file. See data processing for more information on batch processing.

You can add span tags as attributes/newenvironment, which adds span tags to any spans that don’t already have the tags, or attributes/copyfromexistingkey, which overrides an existing span tag value.

The settings look like this in the configuration YAML file:

processors:
# Overrides an existing tag for a span.
attributes/copyfromexistingkey:
  actions:
    - key: SPAN_TAG_KEY
      from_attribute: "SPAN_TAG_VALUE"
      action: upsert
# Adds a tag to spans without a tag.
attributes/newenvironment:
  actions:
    - key: SPAN_TAG_KEY
      value: "SPAN_TAG_VALUE"
      action: insert

If you include the batch processor, you have to add the processor to your pipelines, as shown in the following example:

service:
  pipelines:
    traces:
      processors: [batch]