insert, upsert, delete, etc.) and wire the processor into pipelines correctly.
See the OpenTelemetry Collector docs for more details: OpenTelemetry Collector.
Collector configuration
Below is a minimal Collector configuration that defines an attributes processor instance namedattributes/add_env. The configuration also includes an OTLP receiver, the batch processor, a Jaeger OTLP exporter, and a debug exporter for local inspection.
What this configuration does
- Receives OTLP/HTTP traffic on port 4318 (
receivers.otlp.protocols.http.endpoint). - Runs an attributes processor instance named
attributes/add_envthat mutates attributes on telemetry. - Uses the
batchprocessor to group telemetry before sending to exporters. - Exports traces to a Jaeger collector at
http://jaeger:4317via theotlp/jaegerexporter. - Sends telemetry to the
debugexporter so you can view messages in the Collector logs while testing.
Why name the attributes instance attributes/add_env?
Naming the instance attributes/add_env lets you reference it in pipelines as attributes/add_env. The full processor type is attributes and add_env is the instance name.
Attributes actions explained
In theattributes/add_env processor we define two actions:
deployment.environmentset toproductionwithaction: insertinsertonly adds the attribute if it does not already exist.
service.regionset tous-west-2withaction: upsertupsertadds the attribute if missing and overwrites it if present.
| Action | Purpose | Example |
|---|---|---|
insert | Add the attribute only if it does not already exist. | deployment.environment=production |
upsert | Add the attribute if missing or overwrite if present. | service.region=us-west-2 |
delete | Remove the attribute if it exists. | - key: foo action: delete |
extract | Extract values from existing attributes (e.g., regex capture) into a new attribute. | - key: version action: extract |
hash | Replace attribute value with a hashed value (useful for PII). | - key: user_id action: hash |
update | Update an attribute only if it already exists. | - key: env action: update |
Processor execution order matters. Place processors in the sequence you want them applied. For example, if you want attributes added before batching (so they appear in the batched payload), list the attributes processor before the batch processor.
Choose the correct action type for your intent. Use
insert to avoid overwriting existing values and upsert if you want to force a value. Misusing upsert can unintentionally overwrite source-provided attributes.Processor order and pipeline behavior
Processors are executed in the order you list them in a pipeline. In thetraces pipeline above:
attributes/add_envruns first — it mutates/sets attributes on each trace/span.batchruns next — it groups the modified telemetry before exporting.
Verify in Jaeger
After restarting the Collector with this configuration and generating traces from your instrumented application, inspect traces in Jaeger. You should observe the added/modified attributes such asdeployment.environment=production and service.region=us-west-2.

Additional resources
- OpenTelemetry Collector documentation: https://opentelemetry.io/docs/collector/
- Jaeger tracing: https://www.jaegertracing.io/
insert vs upsert), and place the processor in the correct pipeline order so your mutations are applied when you expect them.