What Is a Processor in OpenTelemetry?

What Is a Processor in OpenTelemetry?

A friendly, ground-up guide to the checkpoints that sit between the moment your code creates telemetry and the moment it reaches storage: what they are, where they live, how they work inside, and how to use them safely.

Picture a busy airport. Passengers do not walk straight from the front door to the aircraft. They pass through check-in, security screening, passport control and boarding gates. Each stop has a clear job: add a boarding pass, remove dangerous items, check who you are, make sure the right people reach the right plane. Without these stops, the airport would be chaos.

Telemetry data, which is the information your software sends out about itself, has a very similar journey. It is created inside your application, and it eventually reaches a place where engineers can search it. In between, it needs to be grouped, cleaned, enriched, filtered and protected. In OpenTelemetry, the checkpoints that do this work are called processors. In this guide, we will learn what they are, where they live, and how to use them wisely, using simple words and everyday examples.

2
Places processors live: inside the SDK and inside the Collector
3
Signals they can handle: traces, metrics and logs
1st
Usual position of the memory limiter in a Collector pipeline

1The Problem: Raw Telemetry Is Not Ready to Travel

Before learning the tool, let us feel the problem it solves.

Telemetry is born messy

Telemetry is information that a system sends out about itself: timings, counts, error messages and the path of a request. When your code creates a piece of telemetry, such as a record of one database query, that record is raw. It may be missing useful details, like which cloud region it came from. It may contain things that should never leave the building, like a customer’s email address. It may be one of millions of nearly identical records that nobody needs to keep.

Now imagine sending each record one by one over the network the moment it is created. A busy service might create tens of thousands of records every second. Sending them individually would be like a shop owner driving to the post office for every single letter. It wastes effort, slows down the shop, and clogs the roads.

What we really need

We need a set of steps, placed between creation and storage, that can do several jobs. These jobs include grouping records into batches, adding missing labels, removing sensitive values, throwing away noise, protecting the system from running out of memory, and deciding which records are worth keeping. Doing all this inside your business code would be messy and hard to change. OpenTelemetry’s answer is to make these steps separate, reusable pieces called processors.

Everyday Analogy

Think of a factory conveyor belt. Raw items roll in at one end. Along the belt, there are stations: one washes the item, one adds a label, one rejects broken items, and one packs items into boxes. The workers who made the item do not need to do any of this. They just put the item on the belt. Processors are the stations on the telemetry conveyor belt.

2So, What Is a Processor?

A short, honest answer first, and then the important twist.

A processor in OpenTelemetry is a component that sits in the path of telemetry data and does some work on it before it moves to the next step. That work might be changing the data, grouping it, filtering it, delaying it, or protecting the system. A processor does not create the original data, and it does not store the final data. It lives in the middle.

A processor is a checkpoint, not a starting line and not a finish line.

The twist: there are two kinds of processors

This is the point that confuses most beginners. The word “processor” appears in two different places in OpenTelemetry, and they behave differently even though they share a name.

Inside Your App

SDK Processors

Small hooks inside the OpenTelemetry SDK. Span processors and log record processors see each span or log record as it starts or ends, and hand it onward to exporters.

Separate Program

Collector Processors

Steps inside the OpenTelemetry Collector, a standalone program. They work on batches of traces, metrics or logs that arrive from many applications.

QuestionSDK ProcessorCollector Processor
Where does it run?Inside your application processInside the Collector program, often on another machine or container
Who configures it?The developer who sets up the SDKWhoever operates the Collector, often a platform team
What does it see?Telemetry from just that one applicationTelemetry from many applications at once
Which signals?Spans and log recordsTraces, metrics and logs
Typical jobsBatching, adding details at start or end of a span, handing data to exportersBatching, filtering, redacting, enriching, sampling, memory protection
Changing it needsUsually an application restart or redeployA Collector configuration change, with no change to applications
i
Tip

When someone says “add a processor,” always ask: “In the SDK or in the Collector?” Many confused conversations come from two people picturing different places.

3Core Concepts: Where Processors Fit in the Bigger Picture

A few words you need before we go deeper.

Signals

A signal is a type of telemetry. OpenTelemetry has three main ones. Traces describe the journey of one request through your system, made of timed steps called spans. Metrics are numbers measured over time, like requests per second. Logs are timestamped text records of events.

The API, the SDK, and the Collector

The API is the set of interfaces your code uses to ask for telemetry, like a wall socket that anything can plug into. The SDK is the real engine behind the API that records and sends the data. The Collector is a separate program that receives telemetry from many sources and forwards it to storage. Processors live in the SDK and in the Collector, but not in the API. The API never processes anything. It only describes what your code may ask for.

The Collector pipeline

The Collector is built from a small number of building blocks, and a processor is only one of them. Understanding the others shows you what a processor is not.

Entry Door

Receiver

Accepts telemetry coming in, for example over the standard OpenTelemetry protocol, called OTLP, or from older formats.

Checkpoint

Processor

Changes, filters, groups or protects the data on its way through.

Exit Door

Exporter

Sends the data out to a backend, such as a tracing system, metrics store or log search tool.

Bridge

Connector

Joins the end of one pipeline to the start of another, and can turn one signal into another, such as counting spans to make a metric.

Helper

Extension

Adds side features that are not part of the data path, like health checks and authentication helpers.

The Route

Pipeline

A named path for one signal type that links receivers, then processors in order, then exporters.

Everyday Analogy

Think of a post office. Receivers are the front counter where parcels arrive. Processors are the sorting, weighing and labelling rooms. Exporters are the delivery trucks that leave for different cities. A pipeline is the rule that says “parcels of this type go through these rooms, in this order, to those trucks.”

4SDK Span Processors in Depth

The processors that live inside your application, starting with tracing.

The job of a span processor

Inside the SDK, when your code starts a span, finishes a span, or asks the SDK to shut down, the SDK tells the registered span processors. A span processor is like a receptionist who is told about every visitor arriving and leaving. A processor can be told four main things.

1

On Start

Called when a span begins. The span is still open, so a processor can add details, such as a deployment label or a feature flag, before any of the real work is done.

2

On End

Called when a span finishes. The span is now complete and read-only, so a processor can look at it, copy it into a queue, or hand it to an exporter, but it cannot change the span any more.

3

Force Flush

A request to send everything that is waiting right now, without waiting for the usual schedule. This is useful in short-lived programs that are about to exit.

4

Shutdown

Called when the application is closing. The processor should send what it holds and release its resources.

Sampler or processor?

Beginners often mix up a sampler and a span processor. They are different pieces with different jobs. A sampler runs at the very start, when a span is created, and decides whether this span should be recorded at all. A span processor runs afterwards, on spans that exist, and decides what to do with them. In short, the sampler asks “should this exist?” and the processor asks “what do we do with it now?”

The two built-in kinds

Almost every SDK ships with two standard processors that hand finished spans to an exporter.

Simple Span Processor

  • Sends each span to the exporter right away, one at a time
  • Very easy to understand and good for learning or testing
  • Nothing is waiting in a queue, so little is lost at exit
  • But it can slow down your application, because every span causes an export

Batch Span Processor

  • Collects finished spans in a queue and sends them in groups
  • Far kinder to your application and the network
  • The normal choice for production
  • Needs correct shutdown or flush, or the last few spans may be lost
!
Watch Out

Using the simple processor in production is a classic mistake. Under heavy traffic, each request may wait for a network call to finish, which can add real delay to your users. Use the batch version for live systems.

Everyday Analogy

The simple processor is a courier who delivers every single letter the moment you write it. The batch processor is a courier who waits at your door, collects letters in a bag, and leaves when the bag is full or when five seconds have passed. The second courier makes far fewer trips.

5Inside the Batch Processor

The most common processor in the world, and the one worth understanding properly.

The batch processor, in both the SDK and the Collector, follows the same simple idea. Finished items go into a waiting line, called a queue. A background worker takes items out of the queue in groups and sends each group to the next step. The queue has a size limit so that it cannot eat all your memory.

flowchart LR
    A["Span ends in application"] --> B["Batch processor"]
    B --> C{"Is the queue full?"}
    C -->|Yes| D["Drop the new span and count it as dropped"]
    C -->|No| E["Add span to queue"]
    E --> F{"Batch size reached or timer expired?"}
    F -->|No| G["Wait in queue"]
    F -->|Yes| H["Background worker takes a batch"]
    H --> I["Exporter sends batch over the network"]
    G --> F
    
Figure 1: How a batch processor decides when to send

The knobs you can turn

Most batch processors have a few settings with sensible defaults. The exact numbers can differ between languages and versions, so always check your own documentation, but the ideas are the same everywhere.

SettingWhat It ControlsWhy It Matters
Maximum queue sizeHow many items can wait at onceProtects memory. If the queue is full, new items are dropped
Maximum batch sizeHow many items go out in one sendBigger batches mean fewer trips, but heavier messages
Scheduled delay or timeoutHow long to wait before sending a partly full batchShort delay means fresher data, long delay means better efficiency
Export timeoutHow long one send may take before giving upStops one slow send from blocking everything

Why dropping data is actually a safety feature

It may sound alarming that a processor can drop data. But consider the alternative. If the backend is slow and the queue could grow without limit, your application would slowly use more and more memory until it crashed. The whole point of OpenTelemetry’s design is that observability must never be the reason your service goes down. A bounded queue chooses to lose a little telemetry rather than risk the real application.

Production Example: The Slow Backend

A team’s tracing backend becomes slow during a maintenance window. Because their services use a batch processor with a bounded queue, the services keep serving customers normally. The only visible effect is a counter showing dropped spans, which an alert reports. After the backend recovers, normal flow resumes. Without the bounded queue, the same incident could have crashed dozens of services.

6Log Record Processors and the Metrics Story

Processors exist for logs too, but metrics work a little differently.

Log record processors

For logs, the SDK has log record processors. They work much like span processors. They are told when a log record is emitted, and they can change it or pass it along. Just like spans, there are simple and batch versions, and production systems normally use the batch kind. A typical use is to add the same shared labels, such as the service name or environment, to every log record.

Metrics do not use processors in the SDK

Here is a surprise. In the SDK, metrics do not flow through a “metric processor.” Instead, two other concepts shape metric data.

Collector of Numbers

Metric Reader

Decides when metrics are gathered and handed to an exporter. A common kind collects and exports on a fixed schedule, often once a minute by default.

Shape Changer

View

Lets you rename a metric, choose which attributes to keep, drop a metric entirely, or change how values are grouped into ranges.

In the Collector, however, metrics do pass through processors, just like traces and logs. So if you need to filter or change metrics, you can do it there. This difference is a good reminder to be exact about which “processor” you mean.

Everyday Analogy

Spans and logs are like individual letters, each one handled as it is posted. Metrics are like a monthly electricity bill. Nobody handles each unit of power one by one. Instead, a meter is read on a schedule, and the reading is summarised. The metric reader is the person who reads the meter, and a view is the rule for how the bill is laid out.

7Collector Processors: A Tour of the Toolbox

The Collector offers many ready-made processors. Here are the ones every beginner should know.

Collector processors are configured, not coded. The operator writes a short configuration file that names the processors to use and sets their options. No application code changes. Some processors are in the core Collector, while many others are in a larger collection often called the contrib distribution. The maturity of each processor varies, so always check its status before depending on it in production.

Protect

Memory Limiter

Watches how much memory the Collector uses. When it gets close to a limit, it starts refusing new data so the Collector does not crash.

Group

Batch

Groups data into batches before sending. This makes exporting efficient and reduces network traffic.

Edit

Attributes

Adds, updates, hashes or deletes attributes on spans, logs or metric points, such as masking a sensitive field.

Edit

Resource

Changes the labels that describe the thing that sent the data, like the service name or environment.

Remove

Filter

Drops data that matches rules you write, such as health-check requests that nobody wants to store.

Reshape

Transform

A flexible processor that uses a small rule language, called OTTL, to change data in many ways at once.

Enrich

Kubernetes Attributes

Looks up the Kubernetes pod, namespace and deployment that sent the data, and adds those details automatically.

Enrich

Resource Detection

Discovers facts about the machine or cloud environment, like region and host, and adds them to the data.

Sample

Probabilistic Sampler

Keeps a fixed percentage of traces or logs and drops the rest in a consistent way.

Sample

Tail Sampling

Waits until a whole trace is complete, then decides to keep it based on rules, such as “keep all errors and all slow traces.”

Protect

Redaction

Removes or masks values that look sensitive, using allow lists or patterns.

Rename

Span Processor

A Collector processor that can rename spans or build span names from attributes. Do not confuse it with the SDK span processor.

!
Watch Out

The Collector has a processor called the “span processor,” and the SDK has components also called span processors. They share a name but are entirely different things in different places with different jobs.

8Architecture: Processors Inside the Collector

Let us put all the pieces on one map.

flowchart LR
    subgraph APPS["Applications with OpenTelemetry SDK"]
        A1["Order Service"]
        A2["Payment Service"]
        A3["Inventory Service"]
    end
    A1 --> R["OTLP Receiver"]
    A2 --> R
    A3 --> R
    subgraph COL["OpenTelemetry Collector Pipeline"]
        R --> P1["Memory Limiter"]
        P1 --> P2["Kubernetes Attributes"]
        P2 --> P3["Filter"]
        P3 --> P4["Redaction"]
        P4 --> P5["Tail Sampling"]
        P5 --> P6["Batch"]
    end
    P6 --> E1["Tracing Backend"]
    P6 --> E2["Long Term Archive"]
    
Figure 2: A typical trace pipeline with processors in order

Read the diagram from left to right. Three services send their spans to a receiver. The data then walks through six processors, one after another, in the exact order the operator wrote them. At the far end, exporters send it to different places. Each processor receives the output of the one before it, so if one processor drops a span, every processor after it never sees that span.

One pipeline per signal

In the Collector, you define separate pipelines for traces, metrics and logs. Each pipeline lists its own receivers, processors and exporters. A single processor can be named in several pipelines, but each pipeline gets its own working copy of it. Not every processor supports every signal, so always check which signals a processor can handle.

Agent and gateway layouts

Many teams run Collectors in two layers. A small agent Collector runs next to each application, on the same machine or in the same pod, and does light work like adding host details and batching. A central gateway Collector receives from all the agents and does heavier work like tail sampling and routing. This split keeps your applications light and your heavy logic in one place.

9Internal Working and Data Flow

What actually happens to a span as it moves through processors?

sequenceDiagram
    participant App as Application SDK
    participant Rec as Collector Receiver
    participant Mem as Memory Limiter
    participant Fil as Filter
    participant Bat as Batch
    participant Exp as Exporter
    participant Back as Backend
    App->>App: Span ends and SDK batch processor queues it
    App->>Rec: Send batch using OTLP
    Rec->>Mem: Pass data
    Mem->>Mem: Check memory use
    Mem->>Fil: Pass data if memory is healthy
    Fil->>Fil: Drop health check spans
    Fil->>Bat: Pass remaining spans
    Bat->>Bat: Wait for batch size or timer
    Bat->>Exp: Send larger batch
    Exp->>Back: Deliver to storage
    
Figure 3: One batch travelling from the SDK through Collector processors

Step by step

1

The SDK Processor Batches

Inside the application, the SDK batch processor collects finished spans and sends them out as a group, over the network, to the Collector.

2

The Receiver Accepts

The Collector’s receiver turns the incoming network message into the Collector’s internal format, which is shared by all components.

3

The Memory Limiter Checks

It looks at current memory use. If the Collector is too full, it refuses the data, and the sender is told to retry later.

4

Middle Processors Do Their Jobs

Enrichers add labels, filters remove noise, redactors mask secrets, and samplers choose what to keep.

5

The Batch Processor Packs

Remaining data is grouped into efficient batches, ready for the trip out.

6

The Exporter Delivers

It sends the batch to the backend, retrying if the backend is briefly unavailable.

Notice that the same idea, batching, appears twice: once in the SDK and once in the Collector. This is normal. The SDK batch makes the trip from application to Collector efficient, and the Collector batch makes the trip from Collector to backend efficient, after data has been filtered and sampled and the numbers have changed.

10Order Matters: The Most Important Rule

Because each processor works on the output of the one before it, the order you choose changes the result.

Everyday Analogy

Think about washing clothes. If you iron first and wash after, your effort is wasted. If you dry before you wash, nothing gets clean. Some orders simply make sense and others do not. Processor order is the same.

A sensible order and the reasons behind it

flowchart TD
    O1["1. Memory Limiter: protect the Collector first"] --> O2["2. Enrich: add Kubernetes and cloud details"]
    O2 --> O3["3. Filter: drop data nobody wants"]
    O3 --> O4["4. Redact and Transform: mask or reshape"]
    O4 --> O5["5. Sample: keep only what is valuable"]
    O5 --> O6["6. Batch: group for efficient sending"]
    
Figure 4: A commonly recommended processor order
1

Memory Limiter First

It should guard the door before heavy work begins. If it sits late in the line, the Collector might already be overloaded by earlier steps.

2

Enrich Before You Filter or Sample

Filters and sampling rules often depend on labels. If your rule says “drop data from the test namespace,” the namespace label must exist first.

3

Filter Early to Save Work

Dropping useless data early means later processors have less to handle.

4

Redact Before Data Leaves

Sensitive values should be masked before they are sampled, batched and exported, so that no copy escapes unmasked.

5

Sample Before Batching

Sampling removes data, so batching afterwards packs only what is left. Batching first would waste effort.

6

Batch Last

It prepares the final shape of the data for the exporter.

i
Tip

Think of it as “protect, enrich, remove, hide, choose, pack.” If your configuration reads in that order, you are usually on solid ground. There are exceptions, so always test with real sample data.

11Tail Sampling: A Processor with Special Needs

The smartest processor is also the one that is easiest to get wrong.

Normally, sampling is decided at the start of a trace, which is called head sampling. It is cheap and simple, but it is blind. At the start, you do not know yet whether this request will fail or be slow. If you keep ten percent at random, you will probably lose most of your interesting traces.

Tail sampling waits until the trace is finished and then decides. A tail sampling processor holds all the spans of each trace in memory for a short waiting time, then applies rules such as “keep every trace with an error,” “keep every trace slower than two seconds,” and “keep five percent of everything else.” This gives you the best of both: low cost and high value.

Everyday Analogy

A museum curator can choose which paintings to display before they are painted (head sampling), or after seeing the finished works (tail sampling). The second approach picks better art, but it needs a storeroom to hold all the paintings while the curator decides.

The hidden requirement

For tail sampling to work, all the spans of one trace must arrive at the same Collector instance. If the spans of one trace are spread across ten Collectors, no single one sees the whole story, and its decision will be wrong. In larger setups, teams place a Collector layer in front that routes spans by trace ID, so that every span with the same trace ID goes to the same sampling Collector. This routing is usually done by a special exporter that balances load using the trace ID.

Benefits

  • Keeps the traces that matter: errors and slow requests
  • Reduces storage cost dramatically
  • Rules can use many conditions, not just a random chance

Costs

  • Needs memory to hold traces while waiting
  • Needs trace-aware routing in multi-Collector setups
  • Adds a delay before data reaches the backend
  • A trace that takes longer than the waiting time may be judged too early

Production Example: Cost Under Control

An online store produces millions of traces every hour, almost all of them fast and successful. They send everything through a gateway layer with tail sampling, keeping every trace that has an error, every trace slower than an agreed limit, and a small slice of the rest. Their storage bill drops sharply, yet engineers still find every failing checkout. Similar ideas are also offered as dedicated products by observability vendors, such as Honeycomb’s Refinery sampling proxy.

12Practical Scenarios: Processors at Work

Five everyday problems and the processor that solves each one.

Scenario 1: “Our dashboards are full of health-check noise”

Load balancers call a health endpoint every few seconds. Thousands of useless spans are stored daily. A filter processor can drop spans whose route matches the health endpoint, before they ever reach storage.

Scenario 2: “A developer accidentally logged a credit card number”

A value ended up as a span attribute. The attributes or redaction processor can delete or mask it in the Collector, which acts as a safety net even when the application is wrong. The real fix is still to stop the application from recording it.

Scenario 3: “We cannot tell which pod produced this span”

The Kubernetes attributes processor looks up the pod, namespace and deployment based on where the data came from, and adds them automatically. Developers do not need to write any code to get this.

Scenario 4: “Our Collector keeps running out of memory during traffic spikes”

The memory limiter placed first in the pipeline refuses data when memory gets close to its limit, which prevents a crash. Senders retry later, so most data is eventually delivered, and the Collector stays alive.

Scenario 5: “Different teams use different names for the same thing”

One team labels the environment “env,” another uses “environment,” and a third uses “stage.” A transform or attributes processor can rewrite them into a single standard name, so dashboards work everywhere. This is a bridge solution while teams fix their code over time.

13SDK or Collector? Choosing Where to Process

The same job can often be done in two places. Which should you choose?

JobBetter in the SDKBetter in the Collector
Batching for exportYes, always keep a batch processor in the SDKAlso yes, before final export to the backend
Adding details known only to the codeYes, for example a user tier or feature flag known at span startNo, the Collector cannot know what the code knows
Adding infrastructure detailsPossible but repetitiveYes, one place for every service
Redacting secretsBest to avoid recording them at allYes, as a central safety net
Filtering noisePossible, but needs a redeploy to changeYes, changes need no application release
Tail samplingNot possible, the SDK sees only its own spansYes, it needs the whole trace
Protecting against overloadBounded queues in the batch processorYes, the memory limiter

A useful rule: do in the SDK what only your code can know, and do in the Collector what is shared, changeable or needs a wider view. Keeping policy decisions out of application code means platform teams can adjust them in minutes without asking dozens of developers to redeploy.

14Advantages, Disadvantages and Trade-offs

No design is free of cost. Let us look honestly at both sides.

Advantages

  • Separation of concerns: application code creates data, processors shape it
  • Central control: policies change in one place without redeploying services
  • Lower cost: filtering and sampling reduce what you store and pay for
  • Safety: memory limits and bounded queues protect your systems
  • Privacy help: redaction adds a second line of defence
  • Vendor freedom: change processors and exporters without touching code

Disadvantages

  • Extra moving parts: another thing to run, tune and monitor
  • Added delay: batching and tail sampling hold data for a while
  • Order mistakes: a wrong order gives wrong results, sometimes silently
  • Resource use: heavy processors need real memory and CPU
  • Uneven maturity: some processors are still evolving
  • Hidden data loss: a bad rule can drop good data without anyone noticing

Key trade-offs

DecisionOption AOption B
Batch timeoutShort, so data appears faster, but more small sendsLong, so sends are efficient, but data arrives later
Queue sizeLarge, which survives longer backend problems but uses more memorySmall, which is safe on memory but drops data sooner
Sampling styleHead sampling, cheap and simpleTail sampling, smart but needs memory and routing
Filtering locationEarly in the pipeline, which saves workLate, which lets earlier steps use the data first
Redaction approachBlock list of known bad fields, simple but easy to miss new onesAllow list of known good fields, stricter and safer

15Security Considerations

Processors sit on the road that all your data travels. That makes them powerful, and sensitive.

Privacy

Use Processors as a Safety Net

Redact or remove secrets and personal data in the Collector. But do not rely on it alone. Avoid recording sensitive values in the first place.

Prefer Allow Lists

Keep Only Known Fields

An allow list keeps only attributes you approved. A block list can miss new sensitive fields added later by a developer.

Hashing

Know What Hashing Does

Hashing an identifier hides the plain value but keeps matches possible. It can still be guessable for small sets of values, so it is not a perfect shield.

Access

Protect Configuration

Whoever can edit processor rules can hide or drop evidence. Limit and audit who may change Collector configuration.

Transport

Encrypt Every Hop

Use encrypted, authenticated connections between applications, Collectors and backends.

Compliance

Mind Privacy Laws

Laws such as GDPR can apply to telemetry. Redaction and retention rules in processors help you meet them.

!
Watch Out

A redaction rule that only runs in one pipeline does nothing for data that travels through another. Make sure every pipeline and every signal that could carry sensitive data has the right protection.

16Monitoring, Logging and Metrics: Watching the Processors

The pipeline that watches your systems also needs to be watched.

A processor that quietly drops data or refuses data is doing its job, but you must know it is happening. The Collector exposes its own metrics about its health, and the names of many processor-related metrics begin with a shared prefix that includes the word “processor.” Build a small dashboard and a few alerts around these signals.

  • Refused data: a rising count from the memory limiter means the Collector is under pressure and senders are being told to wait.
  • Dropped data: data discarded because queues were full or rules removed it. Compare drops caused by your own filter rules with drops caused by overload.
  • Batch sizes and send timing: if batches are always tiny, your timeout may be too short. If they are always at the maximum, you may need more capacity.
  • Queue depth: a queue that is always nearly full is a warning before data loss begins.
  • Collector memory and CPU: heavy processors, especially tail sampling, can push these up.
  • Silence alerts: alert when a service that normally sends telemetry suddenly sends none.
  • Collector logs: configuration errors and rejected data often appear first in the Collector’s own logs.

Production Example: The Overzealous Filter

A platform team added a filter to drop test traffic. A small mistake in the rule also matched real checkout requests from one region. Dashboards for that region went quiet, and nobody was alerted until a customer complaint arrived. A simple comparison between the count of spans received and the count exported, per region, would have caught the gap on day one.

17Design Patterns and Anti-Patterns

Habits worth copying and traps worth avoiding.

Good design patterns

Pattern

Pipes and Filters

Small steps, each doing one job, joined in a line. This classic software idea is exactly how Collector pipelines are built.

Pattern

Agent plus Gateway

Light processing next to each application, and heavy processing in a central layer.

Pattern

Backpressure

When overloaded, refuse new work politely so senders slow down. The memory limiter does exactly this.

Pattern

Bounded Buffers

Every queue has a maximum size, so a slow neighbour cannot cause a crash.

Pattern

Trace-Aware Routing

Send all spans of the same trace to the same Collector so tail sampling sees complete traces.

Pattern

Configuration as Code

Keep Collector configuration in version control with reviews and tests, because small edits change what data you keep.

Anti-patterns

ANTI-PATTERN 01Avoid
The Mistake

Using the simple span processor in production.

Why It Hurts

Each finished span triggers an export, which can slow requests and overload the network under load.

Better Approach

Use the batch span processor and make sure shutdown or flush is called when the application stops.

ANTI-PATTERN 02Avoid
The Mistake

Putting the memory limiter late in the pipeline, or leaving it out.

Why It Hurts

Earlier processors may already have used up memory, and a traffic spike can crash the Collector, losing even more data.

Better Approach

Place the memory limiter first, and give the Collector sensible container memory limits that match its settings.

ANTI-PATTERN 03Avoid
The Mistake

Running tail sampling on several Collectors without routing by trace ID.

Why It Hurts

Each Collector sees only part of a trace, and sampling decisions become wrong. You may keep half a trace or drop a failing one.

Better Approach

Add a load-balancing layer that routes by trace ID, or use a single sampling tier sized for the load.

ANTI-PATTERN 04Avoid
The Mistake

Piling dozens of complicated rules into one transform processor that nobody understands.

Why It Hurts

It becomes hard to test and review, and a small edit can quietly change large amounts of data.

Better Approach

Keep rules small and named for their purpose. Fix problems at the source in application code where possible, and treat the Collector rule as a temporary bridge.

18Best Practices and Common Mistakes

A practical checklist for a healthy processing pipeline.

Best practices

  • Always use batching. Keep the batch processor in the SDK and in the Collector, and tune sizes and timeouts from real measurements.
  • Protect first. Put the memory limiter at the start of every Collector pipeline.
  • Keep the order intentional. Follow “protect, enrich, remove, hide, choose, pack” and write down why any exception exists.
  • Test with sample data. Before deploying a new rule, run known samples through it in a test Collector and check what comes out.
  • Roll out gradually. Apply new filtering or sampling rules to a small slice of traffic first, and compare counts before and after.
  • Prefer allow lists for sensitive fields. Decide what you allow, rather than guessing everything you must block.
  • Monitor the processors. Alert on refused data, dropped data and silent services.
  • Flush on shutdown. Make sure applications call shutdown so the last batch is not lost, especially in short-lived jobs and serverless functions.
  • Keep Collector versions current. Processor behaviour and names change over time, so read release notes before upgrades.
  • Document your pipeline. A one-page diagram of the processors and why each exists saves hours during incidents.

Common mistakes beginners make

  • Confusing the SDK span processor with the Collector span processor.
  • Thinking a sampler and a processor are the same thing.
  • Defining a processor in the configuration but forgetting to list it in the pipeline, so it never runs.
  • Expecting a processor to modify a span after it has ended in the SDK. Ended spans are read-only.
  • Forgetting that a processor may not support all three signals.
  • Setting a batch timeout so long that engineers think the system is broken because data arrives late.
  • Dropping data with a filter and then wondering why dashboards look empty.
i
Tip

A processor must be both defined and listed in a pipeline to run. This is one of the most common reasons people say “my processor does nothing.” Always check the pipeline list.

19Real-World and Industry Examples

How these ideas appear in tools and platforms you may already know.

Amazon Web Services

AWS offers the AWS Distro for OpenTelemetry, a supported build of OpenTelemetry components that includes the Collector. Customers on services such as containers and serverless platforms use it to receive telemetry, process it, and forward it to AWS monitoring tools or to other backends.

Grafana

Grafana Alloy is a distribution built around the OpenTelemetry Collector. It combines the same receiver, processor and exporter ideas into one agent that teams use to batch, enrich and route data to Grafana’s stack or to other systems.

Kubernetes Platforms

Teams running on Kubernetes widely use the Kubernetes attributes processor to tag every span, metric and log with the pod, namespace and deployment, so that engineers can jump from a slow trace straight to the workload that produced it.

Observability Vendors

Vendors such as Datadog, New Relic and Honeycomb accept OpenTelemetry data. Companies often place their own Collector in front, so that sampling, redaction and routing rules live in one place that the company controls, regardless of which vendor receives the data.

Multi-Backend Setups

A common pattern is to send the same processed data to two destinations: a fast, expensive store for recent data, and a cheaper archive for long-term needs. Processors can prepare each copy differently, for example by keeping all spans for the archive but sampling heavily for the fast store.

A typical growth journey

1

Start With the Basics

Applications use the SDK batch processor and send straight to a Collector with only batching and a memory limiter.

2

Add Enrichment

Add Kubernetes and cloud details so every piece of data says where it came from.

3

Clean and Protect

Filter noise, redact sensitive fields and standardise attribute names.

4

Control Cost

Introduce probabilistic sampling, then tail sampling with trace-aware routing as volume grows.

5

Operate Like a Product

Version the configuration, test changes, monitor the pipeline and review rules regularly.

20Frequently Asked Questions

Quick answers to questions beginners ask most.

Q1What is a processor in OpenTelemetry in one sentence?
It is a component that sits between where telemetry is created and where it is sent, and does work on the data, such as batching, enriching, filtering, redacting or sampling it.
Q2Is a processor part of the OpenTelemetry API?
No. The API only defines what your code can ask for. Processors live in the SDK and in the Collector.
Q3What is the difference between an SDK processor and a Collector processor?
An SDK processor runs inside your application and sees only that application’s spans or logs. A Collector processor runs in a separate program and works on data from many applications, across traces, metrics and logs.
Q4What is the difference between a sampler and a processor?
A sampler decides at span creation whether the span will be recorded. A processor works on spans that already exist. In the Collector, sampling is also available as a processor that acts on data after it arrives.
Q5Which processor should I always use?
The batch processor, in both the SDK and the Collector, and the memory limiter at the start of every Collector pipeline. These two give you efficiency and safety.
Q6Can a processor change a span after it ends?
In the SDK, no. When a span ends it becomes read-only. Changes must happen at span start or while it is running. In the Collector, processors can change the data that arrives, because it is a copy in transit.
Q7Are there processors for metrics?
Not in the SDK, where metric readers and views shape the data. In the Collector, many processors do support metrics.
Q8Does the order of processors really matter?
Yes. Each processor receives the output of the one before it. Putting a sampler before an enricher, or a batch before a filter, can give wrong or wasteful results.
Q9Why does my processor seem to do nothing?
The most common reason is that it is defined but not listed in the pipeline. Other reasons are a rule that does not match the data, or a processor that does not support the signal you are sending.
Q10Will processors slow down my application?
SDK processors add a small cost, and the batch processor keeps it low by sending data in the background. Collector processors run outside your application, so they do not slow your requests, but they do use the Collector’s own resources.
Q11What happens to data if the memory limiter refuses it?
The sender is told the data was refused and can retry later, depending on its settings. Short pressure usually causes delay rather than loss, but long pressure can lead to dropped data, so you should watch the refused data counters.
Q12Do I need to write code to create a processor?
For common needs, no. Collector processors are configured with settings and rules. Writing a custom processor is possible but is an advanced step, and most teams never need it.

21Summary and Key Takeaways

If you remember only a few things, remember these.

Key Takeaways

  • A processor is a checkpoint. It sits between creation and storage of telemetry and does work such as batching, enriching, filtering, redacting or sampling.
  • There are two homes for processors. SDK processors live inside your application, and Collector processors live in a separate program. Always be clear which one you mean.
  • Batching is the everyday hero. It groups data for efficient sending, and its bounded queue protects your application from crashing when a backend is slow.
  • Samplers and processors are different. A sampler decides whether a span should exist, and a processor decides what to do with spans that do.
  • Order matters. A good default is protect, enrich, remove, hide, choose, then pack, with the memory limiter first and the batch processor last.
  • Tail sampling is powerful but demanding. It needs memory and requires all spans of a trace to reach the same Collector.
  • Treat the pipeline as a product. Keep configuration in version control, test rules, protect sensitive data, and monitor for dropped, refused and missing data.