Skip to content

Transforming Telemetry in the Collector: OTCA practice questions

The Collector is a convenient place to reshape telemetry before it leaves your infrastructure, usually for data quality, governance, cost or security. Contrib processors offer dozens of transformations, and the documentation warns that heavy transformations can noticeably affect Collector performance.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Transforming Telemetry in the Collector covers in OTCA

The Collector is a convenient place to reshape telemetry before it leaves your infrastructure, usually for data quality, governance, cost or security. Contrib processors offer dozens of transformations, and the documentation warns that heavy transformations can noticeably affect Collector performance.

Much of this work now runs on the OpenTelemetry Transformation Language, OTTL. An OTTL statement combines a function, such as set or delete_key, with an optional where condition that decides whether the function runs. Paths reach into the data through contexts like resource, scope, span, spanevent, metric, datapoint, exemplar and log. OTTL cannot cross signals, so a log statement cannot read a span field.

The transform processor executes OTTL statements in order, with separate lists named trace_statements, metric_statements and log_statements. Each list accepts only the contexts that belong to its signal. Its error_mode defaults to ignore, which logs the error and continues. The silent mode skips logging, and propagate returns the error up the pipeline, dropping the payload. The older attributes processor, which inserts, updates, upserts, deletes, hashes, extracts or converts attributes, and the resource processor, which does the same for resource attributes, both now state that they are superseded by the transform processor. For metric renames, the metrics transform processor remains an option.

Dropping data is the filter processor's job, and it also uses OTTL. Telemetry that matches any configured condition is dropped, because the conditions are ORed. Conditions are evaluated from higher levels to lower ones. Removing every span event leaves the span in place, but removing every data point of a metric removes the metric. For sensitive values, the redaction processor keeps only allowed attribute keys and can mask blocked values, and its list of allowed keys fails closed when left empty.

Enrichment usually comes from two processors. The resource detection processor adds host or cloud information from detectors such as env, system, ec2, gcp or azure, and when two detectors set the same attribute the first one listed wins. The Kubernetes attributes processor adds pod, namespace, node and workload metadata and needs RBAC read access to the Kubernetes API.

Sampling is a transformation too. The probabilistic sampler processor makes stateless decisions from the trace ID and is the efficient choice when you need a fixed percentage. The tail sampling processor holds spans in memory, for 30 seconds by default, and then applies policies such as latency, status code or OTTL conditions to the whole trace, which requires all spans of a trace to reach one instance. Batching closes the loop. Exporters can batch inside their sending queue, which is off until you configure a batch block, and the separate batch processor belongs after memory_limiter and any sampling.

Key points

  • OTTL statements pair a function with an optional where condition, and OTTL cannot access another signal.
  • The transform processor defaults to error_mode ignore, while propagate drops the payload.
  • The filter processor drops telemetry that matches any of its conditions.
  • The attributes and resource processors are documented as superseded by the transform processor.
  • Probabilistic sampling is stateless; tail sampling needs whole traces on one Collector instance.
  • With several resource detectors, the first detector to set an attribute wins.

Three sample questions

17 OTCA questions on Transforming Telemetry in the Collector, 17 with explanations. How practice works

Question 1

What happens when a context in the transform processor does not meet any of its global conditions?
  1. A.An error is logged and processing continues.
  2. B.The processor stops processing any further contexts.
  3. C.All statements within that context are executed without conditions.
  4. D.The associated statements for that context are skipped.

Correct answer: D

The transform processor README says the global conditions of a statement group are ORed together, so "only one condition needs to evaluate to true in order for the statements (including their individual Where clauses) to be executed". When none of them is true, the statements of that group are not run for that context and processing moves on. Why the other options are wrong. "An error is logged and processing continues.": an unmet condition is not an error; error_mode only governs errors raised while a statement runs. "The processor stops processing any further context…": only the statements of that group are skipped; other contexts and groups are still processed. "All statements within that context are executed wi…": this reverses the rule; the statements run only when at least one condition is true.

Sources: Collector contrib: transform processor README (v0.164.1), OpenTelemetry docs: Transforming telemetry

Question 2

Which Collector processor is configured with a list of actions such as insert, update, upsert, delete, hash and extract to add an attribute like environment: production?
  1. A.Attributes Processor
  2. B.Transform Processor
  3. C.Metrics Transform Processor
  4. D.Filter Processor

Correct answer: A

The attributes processor README says it takes a list of actions, performed in the configured order, and lists insert, update, upsert, delete, hash, extract and convert. The Transforming telemetry page shows it adding an attribute with action: insert. Why the other options are wrong. "Transform Processor": the transform processor is configured with OTTL statements such as set(...), not with an actions list. "Metrics Transform Processor": the metrics transform processor renames metrics and labels with transforms and operations, and works only on metrics. "Filter Processor": the filter processor drops telemetry that matches OTTL conditions; it does not add attributes.

Sources: Collector contrib: attributes processor README (v0.164.1), OpenTelemetry docs: Transforming telemetry

Question 3

What role does the OpenTelemetry Collector play in the context of log management?
  1. A.It only collects traces and metrics, not logs.
  2. B.It replaces all existing logging libraries in applications.
  3. C.It serves as a backend storage for logs.
  4. D.It enriches and processes logs uniformly before export

Correct answer: D

The Logs spec says OpenTelemetry uses the Collector for log collection: log pipelines based on the log data model, processors such as attributesprocessor that operate on log data, and parsing and enrichment before the logs are sent on. Logs collected by other agents can also be sent to the Collector "where the logs can be further processed and enriched". Why the other options are wrong. "It only collects traces and metrics, not logs.": the Collector has log pipelines and log receivers such as filelog. "It replaces all existing logging libraries in appl…": OpenTelemetry embraces existing logging libraries rather than replacing them. "It serves as a backend storage for logs.": the Collector is not a storage backend; it exports logs to backends.

Sources: OpenTelemetry spec: Logs, OpenTelemetry docs: Collector

Practice this topic

Focus mode keeps every question on Transforming Telemetry in the Collector until you leave it. 10 free guest answers, then a free account; no credit card.

Or open OTCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

If I do not already run tail sampling, how should I sample a fixed percentage of traces?

Use the probabilistic sampler processor. The tail sampling README calls it more efficient and recommends the tail sampling probabilistic policy only when tail sampling is already running.