Cloud · Observability

OpenTelemetry Collector deployment patterns: agent, gateway, or both?

Instrumenting services with OpenTelemetry is the easy part. Deciding where the Collector runs decides your sampling options, your egress bill and how many places hold backend credentials. Here is how I choose.

PlaybookSumanta Mukhopadhyay7 min read4 sources
#observability#opentelemetry#platform#kubernetes
PLAYBOOK · CLOUD · OBSERVABILITY22 Oct 2026 · 00:15 GST

Most teams adopting OpenTelemetry start by pointing their SDKs straight at a vendor endpoint. It works for a demo. At scale it means every service holds backend credentials, sampling decisions happen in hundreds of places, and switching vendors requires redeploying everything. The OpenTelemetry Collector fixes that, but where you run it matters.

The agent pattern

In the agent pattern, a Collector runs alongside the application or on the same host, as a sidecar or a Kubernetes DaemonSet. Applications send OTLP to it, and it exports to one or more backends1.

Diagram of the agent pattern: applications with OpenTelemetry SDKs send OTLP to a Collector running alongside them, which exports to backends
The agent pattern: a Collector per host or per application, close to the workload. Source: OpenTelemetry documentation, Agent deployment pattern · CC BY 4.0

Agents are good at collecting host-level data, adding local metadata such as Kubernetes attributes, and buffering briefly when the network hiccups. They're poor at decisions that need to see a whole trace, because each agent only sees its own host's spans.

The gateway pattern

In the gateway pattern, applications or other Collectors send telemetry to a single OTLP endpoint served by Collector instances running as a standalone service, typically one endpoint per cluster, data centre or region2. A simple version puts an ordinary load balancer in front of Collector replicas.

For tail sampling, that isn't enough: every span of a trace must reach the same Collector. The documented answer is two tiers. The first tier uses a load-balancing exporter that routes by trace ID or service name; the second tier runs processors such as tail sampling2.

Diagram of a two-tier gateway: an application sends OTLP to a first-tier Collector using the load-balancing exporter, which routes to second-tier Collector replicas and then to a backend
A two-tier gateway: the first tier load-balances by trace so the second tier can make whole-trace decisions. Source: OpenTelemetry documentation, Gateway deployment pattern · CC BY 4.0

Agent-to-gateway: the usual answer

OpenTelemetry's documentation describes combining the two, and gives three reasons3:

  • Separation of concerns. Agent configuration stays small; heavy processing lives centrally.
  • Scalable cost control. Gateways see complete traces, so sampling and batching decisions are better, and they scale independently.
  • Security and stability. Agents talk to gateways over internal networks; gateways are the stable egress point that manages retries and credentials.

Credentials for your observability vendor should live in a handful of gateway pods, not in every service. That alone justifies the gateway for most organisations.

How I choose

SituationPattern
Small team, one cluster, low volumeAgent only, or SDK straight to a single gateway
Need host metrics and Kubernetes metadataAgents as a DaemonSet
Need tail sampling or central PII redactionTwo-tier gateway
Multiple clusters or regions, data residency rulesAgent-to-gateway, with a gateway per region
Sending to more than one backendGateway, so routing changes in one place

Practical rules

  1. Redact centrally. Put PII and secret scrubbing in the gateway so one policy covers everything, especially for prompt and response content in LLM observability.
  2. Keep data in region. For GCC and EU workloads, a regional gateway makes residency rules enforceable, as in Saudi PDPL and cross-border AI.
  3. Sample where you can see the trace. Head sampling in SDKs is cheap but blind; tail sampling in the gateway keeps errors and slow traces.
  4. Monitor the Collectors themselves: queue sizes, dropped data and export failures. A silent pipeline failure looks like a quiet system.
  5. Plan for new signals. Profiles now flow through the Collector too4, as covered in OpenTelemetry Profiles. A gateway layer makes adding them a configuration change.

How I can help

I design observability platforms on OpenTelemetry, from Collector topology and sampling to redaction and cost control. As a fractional CTO I can own that roadmap. Or analyse your challenge and bring the result to a call.

References
  1. 1
    Agent deployment patternOpenTelemetry documentation
  2. 2
    Gateway deployment patternOpenTelemetry documentation
  3. 3
    Agent-to-gateway deployment patternOpenTelemetry documentation
  4. 4
    OpenTelemetry Profiles Enters Public AlphaOpenTelemetry blog · 26 Mar 2026
FAQ

Common questions

What is the agent pattern for the OpenTelemetry Collector?

A Collector runs alongside the application or on the same host, for example as a sidecar or Kubernetes DaemonSet. Applications send OTLP data to it, and it exports to one or more backends.

What is the gateway pattern?

Applications or other Collectors send telemetry to a single OTLP endpoint provided by one or more Collector instances running as a standalone service, typically per cluster, data centre or region. A two-tier version uses a load-balancing exporter so all spans of a trace reach the same Collector, which tail sampling requires.

Why combine agents and gateways?

OpenTelemetry's documentation lists separation of concerns, scalable cost control through central sampling and batching, and security, since gateways become a stable egress point that handles retries and credentials.

Keep reading

Related

Open to advisory, fractional CTO & select builds

Let's talk about what you're building.

The fastest route is a free 30-minute call. Prefer to write? Send a message and I'll reply personally within two business days.

Start a conversation

How would you like to reach me?

Book a 30-min callFastest. Pick any open slot on my calendar.→ Write in GmailOpens a pre-filled draft in your browser.→ Use my email appOutlook, Apple Mail or your default client.→

I reply personally within two business days. US & UAE time zones.