What Is Collector Gateway Mode in OpenTelemetry?
A plain-English guide to running the OpenTelemetry Collector as a central front door for all your telemetry — what it is, how it works, when to use it, and how to keep it safe and reliable.
Picture a large office building where hundreds of employees send mail every day. If each person walked to the post office on their own, the roads would be jammed, the post office would be overwhelmed, and nobody could check that the parcels were packed correctly. A smarter building has a central mailroom. Everyone drops their mail there, and the mailroom staff sort it, check it, stamp it, and hand it to the courier in neat bundles.
Modern software has the same problem. Dozens or hundreds of programs constantly produce telemetry, which is the stream of traces, metrics, and logs that describes how they are behaving. If every program sends its data straight to the monitoring tool, the result is a tangle of connections, secret passwords scattered everywhere, and no single place to control what leaves the company. Collector Gateway Mode is the central mailroom for telemetry.
This guide explains gateway mode from the ground up. You will learn what the OpenTelemetry Collector is, what makes a Collector a “gateway,” how data moves through it, how to scale and protect it, and which mistakes to avoid. Every new word is explained the first time it appears, so you do not need any earlier knowledge.
1What Is Collector Gateway Mode?
The short answer first, then the details that make it useful.
OpenTelemetry, often shortened to OTel, is a free, open source framework hosted by the Cloud Native Computing Foundation. It gives developers one standard way to produce and send telemetry. The OpenTelemetry Collector is a separate, standalone program that sits between your applications and your monitoring tools. It receives telemetry, can change or filter it, and then forwards it onward.
The Collector is flexible, which means it can be placed in several positions. Gateway mode is the pattern where one or more Collector instances run as a central, shared service. Many applications, and often many smaller Collectors, send their data to this service. The gateway then processes everything in one place and sends it to the final destinations, which are called backends. In simple terms, a gateway is a Collector that acts as a single front door for a whole cluster, data center, or region.
It is important to understand that gateway mode is not a separate product or a special download. It is the same Collector program, simply deployed in a certain way. The word “mode” describes where it runs and what job it does, not a different piece of software.
Think of the central mailroom in a big office. Employees do not run to the post office themselves. They drop their letters at the mailroom. The mailroom staff weigh every parcel, remove anything forbidden, add the correct labels, and give the courier a single tidy bundle. The post office hears from one trusted sender instead of three hundred confused ones. A gateway Collector plays exactly this role for telemetry.
What a gateway usually does
- Receives. It accepts telemetry from many applications and from smaller Collectors.
- Cleans. It removes secrets, personal data, and noisy details before data leaves your network.
- Enriches. It adds helpful labels, such as the environment or the team that owns a service.
- Samples. It decides which traces to keep and which to drop, so costs stay under control.
- Batches. It groups data into efficient bundles before sending.
- Routes. It sends different data to different destinations, or copies to several at once.
- Protects. It holds the passwords to the backends, so applications never need them.
What a gateway is not
A gateway is not a backend. It does not store telemetry for you to search, and it does not draw dashboards. It is also not an API gateway in the web sense, which manages requests from customers to your business services. It handles only telemetry about your software, never the customer traffic itself. Finally, it is not mandatory. Small systems can work happily without one, as we will see.
Why teams reach for a gateway
Most teams do not choose a gateway because it sounds elegant. They choose it because something hurt. Perhaps a monitoring bill doubled and nobody could say which service caused it. Perhaps a security review discovered that secret keys were copied into forty configuration files. Perhaps a change of vendor looked like six months of work. In every one of these stories, the missing ingredient was a single place where decisions about telemetry could be made.
A gateway supplies that place. It gives the platform team a lever they can pull to change what the whole company sends, and it gives application developers the comfort of knowing that sending telemetry is as simple as posting a letter. Everyone does the part they are good at, and nobody needs to understand the whole machine.
Gateway mode means “a shared Collector service that many senders talk to.” If a Collector serves a whole cluster or region instead of a single machine, it is acting as a gateway.
2Why Gateways Exist: A Short History
Every good pattern begins as a response to a painful problem. Gateways are no exception.
In the early days of tracing and monitoring, applications talked straight to the monitoring product. A developer added a small library, pointed it at the vendor’s address, and pasted in a secret key. For one program this was perfectly fine. For fifty programs written by ten teams, it became a headache.
Every program held its own copy of the secret key, so changing the key meant changing fifty programs. Every program had its own sending rules, so costs were unpredictable. Switching to a different monitoring product meant rewriting instrumentation across the company. And nobody had a single place to say, “never send customer email addresses out of this network.”
Early tracing tools such as Jaeger solved part of the problem by offering two helper programs: an agent that ran next to each application, and a collector that gathered data from many agents. The OpenCensus project built a similar service. When OpenCensus and OpenTracing merged into OpenTelemetry in 2019, the idea of a single vendor-neutral Collector, able to play both the agent and the collector roles, became part of the new standard.
Direct export
Applications send telemetry straight to a vendor. Simple, but keys, rules, and costs are scattered everywhere.
Agents and collectors
Tools like Jaeger add a local agent and a central collector, proving that a middle layer is helpful.
2019 — One standard
OpenTracing and OpenCensus merge into OpenTelemetry, and a single vendor-neutral Collector takes shape.
OTLP becomes the common language
The OpenTelemetry Protocol gives every sender and receiver one shared way to speak, making a central Collector easy to build.
Kubernetes era
As companies adopt Kubernetes, running a Collector per node as an agent and a shared Collector service as a gateway becomes a widely used combination.
Imagine every shop in a town running its own private road to the factory. Roads would crisscross everywhere, and any change to the factory’s address would mean redrawing every road. Now imagine one well-kept main road with a gatehouse. Shops use the main road, and only the gatehouse needs to know the factory’s address. The gateway is that gatehouse.
Three pressures pushed companies toward the middle layer. The first was cost, because telemetry volume grows faster than the business itself, and the bills follow. The second was privacy, because laws and customer promises limit what personal data may leave a network. The third was freedom, because nobody wants to be locked into a single vendor for life. A central Collector answers all three at once, which explains why the pattern spread so quickly once the tooling matured.
Over time, the Jaeger project itself began recommending the OpenTelemetry Collector instead of its own agent. That is a good sign of how widely the Collector has been accepted as the standard middle layer.
3Core Concepts You Need First
A handful of words explain nearly everything in the Collector world. Let us meet them one at a time.
Receiver
The part of the Collector that accepts incoming data. It is like the front desk of the mailroom, where people drop their letters. The most common receiver speaks OTLP.
Processor
A step that changes the data on its way through, such as removing a secret, adding a label, or grouping items together. Think of the staff who check and stamp each parcel.
Exporter
The part that sends data out to a destination. It is the courier collecting the final bundle.
Pipeline
One complete path from receivers, through processors, to exporters, defined separately for each signal. A Collector may run one pipeline for traces, another for metrics, and another for logs.
Connector
A special piece that acts as an exporter at the end of one pipeline and a receiver at the start of another. It can, for example, turn traces into metrics.
Extension
A helper that is not part of the data path, such as a health check, an authentication method, or a place to store a queue on disk.
Agent
A Collector that runs very close to the applications, usually on the same machine or beside the same program. It is a small mailbox on every floor of the building.
Gateway
A Collector that runs as a shared service for many senders. It is the central mailroom itself.
The three signals
The Collector handles three kinds of telemetry, each called a signal. Traces follow a single request through many services, like tracking a parcel from the warehouse to your door. Metrics are numbers measured over time, like a patient’s temperature chart. Logs are written records of events, like a ship’s diary. A good gateway treats all three, usually in separate pipelines, so that rules for one signal do not accidentally break another.
OTLP in plain words
OTLP stands for OpenTelemetry Protocol. It is the standard language that applications and Collectors use to hand telemetry to one another. It travels over two common transports: gRPC, a fast, efficient method that keeps a long-lived connection open, and HTTP, the same basic method that web pages use. By convention, gRPC listens on port 4317 and HTTP on port 4318. A port is simply a numbered door on a computer through which a particular kind of traffic enters.
Two Kubernetes words
Because gateways are very often run on Kubernetes, a system for managing many containers, two of its words appear often. A Deployment runs a chosen number of identical copies of a program somewhere in the cluster. A DaemonSet runs exactly one copy on every machine. Gateways are typically run as Deployments, because they are shared services that can live anywhere. Agents are typically run as DaemonSets, because they should live on every machine.
Gateways are also run on ordinary virtual machines, on cloud container services, and in private data centers. Kubernetes words appear in this guide only because it is the most common home for them.
4Architecture of a Gateway
Let us look at the building from the street, and then step inside.
From the outside, a gateway deployment has four parts. First are the producers: your applications, jobs, and smaller Collectors, which create and send telemetry. Second is a front door, usually a load balancer or a Kubernetes service, which gives all senders one stable address. Third are the gateway replicas, which are several identical Collector copies sharing the work. Fourth are the backends, the places where telemetry is finally stored and shown.
flowchart LR
subgraph CLIENTS["Telemetry producers"]
S1["Checkout service"]
S2["Payment service"]
S3["Inventory service"]
S4["Batch jobs"]
end
LB["Load balancer or Kubernetes service"]
subgraph GW["Gateway Collector replicas"]
G1["Gateway replica 1"]
G2["Gateway replica 2"]
G3["Gateway replica 3"]
end
subgraph BE["Backends"]
B1["Trace store"]
B2["Metrics store"]
B3["Log store"]
end
S1 -->|OTLP| LB
S2 -->|OTLP| LB
S3 -->|OTLP| LB
S4 -->|OTLP| LB
LB --> G1
LB --> G2
LB --> G3
GW --> B1
GW --> B2
GW --> B3
Read the diagram from left to right. Many producers send OTLP to one shared address. The load balancer shares the traffic among three identical replicas, so no single copy has to carry the whole load. If one replica fails, the others continue. The replicas then forward the data to whichever backends the team has chosen.
Inside one replica
Each replica is an ordinary Collector, and inside it every signal flows through the same three stages: receivers, processors, and exporters. The order of the processors matters a great deal, as the diagram shows.
flowchart LR
subgraph REC["Receivers"]
R1["OTLP receiver: gRPC 4317 and HTTP 4318"]
end
subgraph PRO["Processors in order"]
P1["Memory limiter"]
P2["Filter and redaction"]
P3["Attributes and resource labels"]
P4["Sampling"]
P5["Batch"]
end
subgraph EXP["Exporters"]
E1["OTLP exporter to backend"]
E2["Second backend copy"]
end
R1 --> P1
P1 --> P2
P2 --> P3
P3 --> P4
P4 --> P5
P5 --> E1
P5 --> E2
The memory limiter goes first, so that the Collector can refuse new data before it runs out of memory and crashes. Filtering and redaction come next, so unwanted or sensitive data is removed as early as possible. Labels are added after that. Sampling decides what to keep. Finally, the batch processor groups the surviving data into efficient bundles just before export. Placing batch last means the bundles are formed from the final data, not from data that will be dropped a moment later.
| Part | Job | Simple comparison |
|---|---|---|
| Producers | Create and send telemetry | Employees posting mail |
| Load balancer or service | Give one stable address and share traffic | The reception desk of the mailroom |
| Gateway replicas | Receive, process, and export | The mailroom staff |
| Extensions | Health checks, authentication, disk storage | Security guards and filing cabinets |
| Backends | Store and display telemetry | The archive that keeps the records |
One more detail helps beginners feel at home. A Collector is controlled by a single configuration that does two jobs. First, it lists the receivers, processors, exporters, and extensions that should exist, along with their settings. Second, it wires them together into pipelines, saying which pieces take part in each path and in what order. Because a piece can be defined once and used in several pipelines, a team can keep the file short and readable even when the gateway does a lot of work.
The project publishes more than one ready-made version of the Collector. A smaller one contains the essentials, and a larger “contrib” one adds many community-built receivers, processors, and exporters. Large teams often build a custom version containing only the pieces they use, which makes the program smaller and reduces the surface that attackers could target.
5Gateway, Agent, or Nothing at All?
Gateway mode is one of three common choices. Understanding all three helps you pick wisely.
There are three common ways to send telemetry. In the first, no Collector is used, and applications export directly to a backend. In the second, an agent Collector runs beside every application or on every machine. In the third, a gateway Collector acts as the shared central service. Many organizations combine the second and third, with agents forwarding to a gateway.
| Question | No Collector | Agent only | Gateway |
|---|---|---|---|
| Where does it run? | Nowhere. The application exports directly. | Next to the app, on every machine | As a shared service for a cluster or region |
| Where do backend keys live? | In every application | On every machine | Only in the gateway |
| Where are sampling and redaction rules set? | In every application | On every machine | In one central place |
| How hard is it to operate? | Easiest | Moderate | Moderate, with scaling and reliability to plan |
| Best suited to | Small systems, quick trials | Collecting machine-level data and offloading apps | Central control, security, and many senders |
Going without a Collector is like every employee walking their own mail to the post office. An agent is a mailbox placed on every floor, so employees can drop mail without leaving their desks. A gateway is the central mailroom that handles all mail leaving the building. Large buildings usually have both: mailboxes on each floor feed the central mailroom.
The two-tier combination
The most common arrangement on Kubernetes is a two-tier design. A small agent Collector runs on every node and gathers local data, including data that only a node-level program can see, such as machine metrics and container logs. Each agent then forwards what it has to the gateway service, which applies the shared rules and talks to the backends.
flowchart TB
subgraph N1["Node 1"]
A1["App pods"] --> AG1["Agent Collector: DaemonSet pod"]
end
subgraph N2["Node 2"]
A2["App pods"] --> AG2["Agent Collector: DaemonSet pod"]
end
subgraph N3["Node 3"]
A3["App pods"] --> AG3["Agent Collector: DaemonSet pod"]
end
AG1 --> GWS["Gateway service"]
AG2 --> GWS
AG3 --> GWS
GWS --> GW1["Gateway pod A"]
GWS --> GW2["Gateway pod B"]
GW1 --> BK["Observability backend"]
GW2 --> BK
The benefit of the combination is a clean split of work. Agents are light and close to the programs, so they are good at collecting and adding local details, such as which container produced the data. The gateway is shared and central, so it is good at decisions that need the big picture, such as sampling, redaction, and routing. Neither tries to do the other’s job.
You do not need all three on day one. Many teams begin with direct export, add a gateway when keys, costs, or privacy rules become a problem, and add agents later when they need node-level data.
6How Data Flows Through a Gateway
Follow one bundle of telemetry on its journey, from the moment it leaves an application to the moment it reaches storage.
An application creates telemetry
A program creates spans, metrics, or logs using the OpenTelemetry SDK. The SDK groups them into small batches and prepares to send them out.
The data reaches the front door
The SDK, or an agent, sends the batch over OTLP to the address of the gateway service. The load balancer picks one replica to receive it.
The receiver accepts it
The OTLP receiver reads the data and turns it into the Collector’s internal format, which is the same for every signal and every sender.
Processors do their work
The memory limiter checks that there is room. Then filters, redaction, labels, and sampling rules run in the order chosen by the team.
The batch processor bundles it
Data that survived is collected into larger groups, which are far cheaper to send than many tiny ones.
The exporter queues and sends
The exporter places each bundle in a queue and sends it to the backend, retrying if the first attempt fails.
The backend stores it
The backend saves the data so people can search traces, chart metrics, and read logs.
Why the queue matters
Backends are not perfect. They may be slow, restarting, or briefly unreachable. If the gateway tried to send each bundle and simply gave up on failure, data would be lost every time the backend hiccuped. So the exporter keeps a sending queue, a waiting line of bundles, and a retry rule that tries again after a growing pause. The queue turns a short outage from a disaster into a small delay.
What the sender is told
OTLP is a conversation. After the sender transmits a bundle, the receiver answers that it was accepted, or that something is wrong. When the exporter queue is enabled, the gateway usually answers “accepted” as soon as the data is safely in its queue, not after the backend confirms. This keeps applications fast, because they never wait for the slow last mile. The trade-off is that data sitting only in memory could be lost if the gateway crashes at that moment, which is why a disk-backed queue is worth considering for important data.
Partial success and bad data
Sometimes only part of a bundle is acceptable. A few items might be malformed, or too old, or rejected by a rule. OTLP allows the receiver to say that the bundle was accepted partially and to report how much was rejected. Well-built senders log this and carry on, rather than resending the whole bundle forever. If you ever see steady partial-rejection messages, that is a hint that something upstream is producing bad data, and it deserves a friendly conversation with the owning team.
When the gateway is overloaded, it can refuse new data with a polite “try again later” answer. This is called backpressure, and well-behaved senders respond by waiting and retrying. It is much better than the gateway accepting everything until it falls over. Do not treat refused data as a bug; treat it as a signal that the gateway needs more capacity.
7Load Balancing and Scaling
A single mailroom clerk cannot serve a thousand employees. Here is how gateways grow, and the traps along the way.
A gateway is only useful if it can keep up with the telemetry arriving. Fortunately, a basic gateway is stateless, which means each replica handles a bundle without needing to remember anything about earlier bundles. Stateless programs are easy to scale: just run more copies and share the traffic among them. Many teams let the platform do this automatically, adding replicas when processor or memory use climbs and removing them when it falls.
The long-lived connection trap
Remember that OTLP over gRPC keeps one connection open for a long time and sends many bundles through it. A simple load balancer shares connections, not bundles. If ten applications each open one connection, and three replicas exist, the connections might be shared evenly at first. But if an application restarts or a replica is added later, the new replica may receive almost nothing while old ones stay busy. The result is lopsided load, even though everything looks balanced on paper.
Imagine a supermarket where each shopper picks a checkout lane at the door and must stay in it all day, handing over one item at a time. If a new lane opens at noon, shoppers already standing in their lanes will never move. Some lanes will be crowded and others empty. To fix this, the store either asks shoppers to rejoin the line now and then, or it assigns each item to a lane individually.
| Fix | How it works | Good to know |
|---|---|---|
| Limit connection age | The gateway asks long-lived connections to close and reconnect after a while, so senders get spread again | Simple and often enough |
| Layer 7 load balancer | A smart balancer understands each request and shares individual bundles among replicas | Needs a balancer that supports gRPC properly |
| Client-side balancing | Senders learn the list of replicas and share requests among them | Needs the replicas to be discoverable |
| Use HTTP instead of gRPC | Shorter-lived requests spread more naturally | Slightly less efficient |
Scaling signals worth watching
Automatic scaling needs a trigger, and the best triggers are the ones that reflect real strain. Processor use is the simplest: when replicas are working near their limit, add more. Memory use is equally important, because the memory limiter will begin refusing data as it fills. A third, often forgotten signal is the queue: if exporter queues keep growing, the gateway is receiving faster than it can send, and more replicas may help only if the backend can accept the extra traffic. Always check that the backend is not the real bottleneck before adding copies.
When replicas must cooperate
Some jobs are stateful: they need to see related data together. The best example is tail sampling, where the Collector waits until a whole trace has arrived and then decides whether to keep it. If the spans of one trace are spread among different replicas, no replica sees the whole trace, and the decision is wrong. The same problem affects any step that counts or compares related data, such as turning spans into per-service metrics.
The usual cure is a two-tier gateway. The first tier receives data from everywhere and uses a special load-balancing exporter that picks the next collector by looking at the trace ID. All spans with the same trace ID go to the same second-tier collector, which can then make a correct decision.
flowchart LR
SVC["Services and agents"] --> T1["Tier 1 gateway: load balancing exporter"]
T1 -->|"hash of trace ID"| T2A["Tier 2 collector A: tail sampling"]
T1 -->|"hash of trace ID"| T2B["Tier 2 collector B: tail sampling"]
T1 -->|"hash of trace ID"| T2C["Tier 2 collector C: tail sampling"]
T2A --> BK["Backend"]
T2B --> BK
T2C --> BK
Think of the first tier as a sorting desk that looks at the trace label on each piece of mail and always puts the same label into the same bin. The second tier workers each own a few bins and can see every page of the stories they are responsible for. When a bin’s story is finished, the worker decides whether it is interesting enough to keep.
When the number of second-tier collectors changes, some traces that were halfway through may be split between the old and new owners. A few traces may therefore be judged incorrectly during the change. Scale the stateful tier carefully and gradually, and do not let automatic scaling bounce it up and down every few minutes.
8What a Gateway Does With Your Data
The real value of a gateway is the work it does in the middle. Here are the jobs that teams hand to it most often.
Redaction
Removes or masks sensitive details, such as email addresses, tokens, and card numbers, before data leaves your network. One rule here protects every service at once.
Sampling
Keeps all failed and slow traces, and only a small share of ordinary ones. This keeps the storage bill under control without losing the traces that matter.
Enrichment
Adds useful labels such as the environment, region, or owning team, so data can be searched and grouped consistently.
Filtering
Drops noise, such as health-check requests that fire thousands of times a minute and tell you nothing.
Routing
Sends different data to different places. Production traces may go to one backend, test traces to another, and a copy of everything to long-term archive storage.
Transformation
Renames labels or reshapes data so that old and new services look the same to the backend.
Metrics from traces
Counts spans and measures their durations to produce request, error, and latency numbers without any extra application code.
Credential holding
Keeps the secret keys for backends in one protected place instead of copying them into every application.
All of these jobs have one thing in common: they are policy. They express what the organization wants to happen to its telemetry. When policy lives in a gateway, a security team or a platform team can change it in one place, and the change takes effect everywhere without asking dozens of application teams to rebuild and redeploy their programs.
An example: a new privacy rule
The legal team announces that phone numbers must never be stored in the tracing tool. Without a gateway, every service team must hunt through its code and release a fix, which may take weeks. With a gateway, one platform engineer adds a masking rule, tests it, and rolls it out to the replicas. By the afternoon, no phone numbers leave the network, even from old services nobody remembers.
It also helps to think about who owns each rule. A rule that masks personal data belongs to the security team. A rule that drops noisy health checks belongs to the platform team. A rule that adds the owning team as a label belongs to whoever manages the service catalog. Writing the owner next to each rule, and reviewing changes together, prevents the gateway from becoming a mysterious pile of settings that nobody dares to touch. A tidy rulebook is a quiet gift to your future self.
What the gateway cannot know
A gateway sits far from the applications, so it sees only what the data tells it. Details that come from the local machine, such as which Kubernetes pod produced a span, are best added by an agent that runs next to the program. If the data passes through a proxy before reaching the gateway, the gateway may see the proxy’s address instead of the true sender, which breaks any enrichment that depends on the sender’s address. This is one more reason why the agent and gateway combination is so popular: each adds what it is best placed to know.
Within a pipeline, processors run in the order written. Put the memory limiter first, filters and redaction early, sampling after the data is labeled, and batching last. A wrong order can cause surprises, such as sampling decisions made before the label they depend on has been added.
9Reliability: When Things Go Wrong
A central service is a tempting place for failure. Good design makes sure a bad day does not become a lost week of data.
Because every sender depends on the gateway, an unreliable gateway is dangerous. The good news is that the Collector has several protections built in, and they stack on top of each other. Let us look at what happens when the backend is unavailable, which is the most common trouble.
sequenceDiagram
participant S as Service SDK
participant G as Gateway Collector
participant Q as Export queue
participant B as Backend
S->>G: 1. Send batch of spans
G->>Q: 2. Place batch in queue
G-->>S: 3. Acknowledge receipt
Q->>B: 4. Try to export
B--xQ: 5. Backend unavailable
Note over Q: 6. Wait and retry with growing delay
Q->>B: 7. Retry export
B-->>Q: 8. Backend accepts the batch
Note over Q: 9. If the queue fills, drop data and count it
In steps one to three, the service sends a bundle, the gateway places it in its queue, and the service is told that it was received. In step four the exporter tries to deliver the bundle, but in step five the backend is unavailable. Instead of dropping the bundle, the exporter waits a little and tries again, waiting longer each time, as step six shows. When the backend recovers in steps seven and eight, the waiting bundles are delivered. Step nine is the final safety valve: if the outage is so long that the queue becomes full, the oldest or newest data is dropped, and the drop is counted so you can see it.
Layers of protection
| Problem | Protection | What it does |
|---|---|---|
| Gateway runs out of memory | Memory limiter | Refuses new data when memory is nearly full, instead of crashing |
| Backend is slow or briefly down | Sending queue and retries | Holds data and tries again with growing pauses |
| Gateway restarts | Disk-backed queue | Keeps waiting data on disk so it survives a restart |
| One replica fails | Several replicas | Other replicas carry on while a replacement starts |
| A whole zone fails | Replicas spread across zones | Gateways in other zones continue serving |
| Rolling update interrupts traffic | Graceful shutdown | Finishes in-flight data before stopping |
Placing the replicas well
Spread replicas across different availability zones, which are separate buildings or power areas in a cloud region, so one local failure cannot remove every replica. Tell the platform not to stop too many replicas at once during maintenance. Also keep each replica’s memory limit comfortably below the container’s own limit, because if the container is killed for using too much memory, any data in flight is lost without ceremony.
Upgrading without drama
New Collector versions arrive regularly and carry fixes, features, and sometimes changes that require configuration updates. Plan upgrades the way you plan any change to a shared service. Read the release notes, try the new version in a test environment with realistic traffic, then upgrade one replica and watch its health numbers before moving on to the rest. Because several replicas share the work, a rolling upgrade can finish without any visible gap, provided each old replica is allowed to finish what it is doing before it stops.
Telemetry is important, but your customers matter more. Senders should be set with short timeouts and small buffers, so that if the gateway is unreachable, the application keeps running and simply drops some telemetry. A slow monitoring pipeline should never become the reason a shopping cart stops working.
10Security for a Gateway
A gateway sees everything and holds the keys to your backends. That makes it a very valuable target, and worth protecting carefully.
A gateway has two special features that matter for security. It sees the telemetry of the whole organization, which may contain details nobody planned to expose. It also holds the credentials for the backends, so anyone who takes control of it can send or read data as if they were the company. Treat it the way you would treat any important gate: lock it, watch it, and give it only the powers it needs.
| Risk | Example | Remedy |
|---|---|---|
| Eavesdropping | Telemetry crossing the network in clear text | Use encrypted connections, with TLS, between senders, gateways, and backends |
| Unknown senders | A stranger sends fake data to the open port | Require authentication, for example with certificates or tokens, and use network rules to allow only known callers |
| Public exposure | An open OTLP port reachable from the internet | Keep the receiver private, and avoid binding to every network address unless needed |
| Leaked credentials | Backend keys written in plain files or logs | Store keys in a secret manager and pass them in at start-up |
| Sensitive data in telemetry | Emails, tokens, or card numbers inside attributes | Redact centrally in processors before export |
| Vulnerable software | An old Collector build with known flaws | Keep versions current, and build a small custom Collector with only the parts you need |
| Tampered configuration | Someone edits the live rules by hand | Keep configuration in version control and require reviews for changes |
The mailroom of a company holds everybody’s letters and the courier account. It therefore has a locked door, a visitor list, and a rule that only trained staff handle parcels. Nobody would leave the door open to the street just because it is convenient. A gateway should have the same discipline.
Multiple teams, one gateway
In bigger organizations, several teams or even several customers share a gateway. In that case, the gateway can use an identity or a label on each request to decide where the data should go, and to keep one team’s data out of another team’s backend. The more teams share the gateway, the more important clear rules and review become.
Least privilege and an audit trail
Give the gateway only the permissions that it truly needs. It should be able to receive telemetry and write to the backends, and nothing more. It should not be able to read your databases, install software, or reach unrelated systems. Keep a record of who changed the configuration and when, so that if a strange rule appears, you can trace it back to a person and a reason. This habit rarely feels urgent on a quiet day, and it becomes priceless after an incident.
Newer Collector versions are more careful about which network address the receivers listen on by default. Even so, never rely on defaults for security. State the intended addresses and encryption settings explicitly, and test them from an unauthorized machine to prove that they are closed.
11Monitoring the Gateway Itself
You rely on the gateway to watch everything else. Who watches the gateway?
If a gateway quietly drops data, every dashboard downstream looks calm while problems go unseen. That is far worse than an obvious outage, because nobody knows to look. Fortunately, the Collector publishes internal telemetry about its own health, including metrics with names that begin with otelcol, along with its own logs. You should collect these and alert on them, ideally in a place that does not depend on the gateway you are measuring.
| What to watch | What it tells you | Typical action |
|---|---|---|
| Data accepted versus refused by receivers | Whether senders are being turned away | If refusals rise, add capacity or check memory settings |
| Data sent versus failed by exporters | Whether the backend is accepting data | If failures rise, check the backend and the network |
| Queue size compared with its capacity | How close you are to dropping data | Alert before the queue is full |
| Data dropped by processors | Whether limits or rules are discarding more than expected | Investigate and adjust rules |
| Memory and processor use | How hard each replica is working | Scale out before limits are hit |
| Restarts of replicas | Crashes, memory kills, or bad deployments | Read logs and fix the cause |
| Delay between creation and arrival | Whether data is fresh enough to be useful | Check queues and network paths |
Health checks and diagnostics
The Collector has a health check extension, a tiny web address that answers “am I well?” so the platform can restart a broken replica and avoid sending traffic to one that is not ready. It also offers diagnostic pages that show what is happening inside, such as which spans are currently moving through, which are handy during an investigation. Keep these pages private, because they reveal details about your system.
Alerts that earn their keep
Alert on data loss, not on busy-ness
A busy gateway that loses nothing is healthy. A quiet gateway that drops data is not.
Warn early on queues
Raise a warning when queues are half full, long before they overflow.
Watch the silence
If a usually chatty service suddenly sends nothing, either the service is down or its path to the gateway is broken. Both deserve a look.
Send gateway telemetry somewhere safe
Make sure the gateway’s own health data has a route that still works when the main route is broken.
Do not only look at today’s numbers. Watch the trend over weeks. If incoming data grows by ten percent every month, you can predict when your replicas will run short and add capacity in a calm, planned way. If the share of dropped data creeps upward, you can investigate before anyone complains. A gateway that is checked regularly stays small and boring, while a gateway that is only discussed during emergencies tends to surprise everybody at the worst moment.
A single dashboard showing received, processed, dropped, and sent data side by side makes it easy to see where in the pipeline data goes missing. If the numbers shrink between two stages, you have found the stage to investigate.
12Benefits, Drawbacks, and Trade-offs
Every design has a price. An honest view helps you decide whether a gateway is right for you.
Advantages
- Central control. Sampling, redaction, and routing rules live in one place.
- Safer secrets. Backend credentials stay in the gateway instead of every application.
- Easy backend changes. Switching or adding destinations needs no application changes.
- Lighter applications. Heavy work leaves the application, which only sends data onward quickly.
- Fewer backend connections. The backend talks to a few gateways, not to every program.
- Better cost control. Dropping noise early lowers storage and network bills.
Disadvantages
- One more thing to run. The gateway needs sizing, upgrades, and monitoring.
- A critical dependency. If it is poorly built, its failure affects all telemetry.
- An extra network hop. Data travels one more step, adding a small delay.
- Balancing is tricky. Long-lived connections and stateful jobs need careful design.
- Central bottleneck risk. A bad rule or an overloaded replica can affect every team.
- Skills needed. Teams must understand pipelines, queues, and scaling.
Common trade-offs in plain language
| Choice | What you gain | What it costs |
|---|---|---|
| Export directly from applications | Fewest moving parts | Keys, rules, and costs are scattered across every service |
| Agents only | Local data and light offloading | Policy must be repeated on every machine |
| Gateway only | Central policy with a simple layout | Cannot see node-level details by itself |
| Agents plus gateway | Local detail and central policy together | Two layers to operate |
| Single-tier gateway | Simple and easy to scale | Cannot do correct tail sampling |
| Two-tier gateway | Correct tail sampling and trace-level decisions | More complex routing and careful scaling |
| Memory-only queue | Fast and simple | Data can be lost if a replica crashes |
| Disk-backed queue | Survives restarts | Needs fast disks and extra care |
If you have one or two services and one backend, direct export may be perfectly fine. A gateway starts paying for itself when you have many services, several teams, strict privacy rules, or any need to control cost and change backends without touching application code.
13Good Habits and Design Patterns
Patterns are tried-and-true recipes. Habits are the small routines that keep a gateway calm and boring, which is exactly what you want.
Agent plus gateway
Run a light agent on every node to add local details, and a shared gateway to apply policy and talk to backends. Each layer does what it is best placed to do.
Two-tier for tail sampling
Use a first tier that routes by trace ID, and a second tier that makes the sampling decisions, so every trace is judged whole.
One gateway per region
Keep telemetry inside the region where it was created, which reduces delay, avoids expensive cross-region traffic, and helps with rules about where data may be stored.
Zone-aware routing
Send data to a gateway in the same availability zone when possible, to avoid cross-zone network charges while keeping other zones as backup.
Separate pipelines per signal
Give traces, metrics, and logs their own pipelines, so a problem or rule change in one does not disturb the others.
Configuration as code
Keep gateway rules in version control, review changes like application code, and roll them out gradually.
Habits that pay off
- Run at least two replicas. Even a small system should survive the loss of one copy.
- Always include the memory limiter. Make it the first processor, and set its limits below the container’s own limit.
- Batch last. Place the batch processor just before the exporters so bundles contain only surviving data.
- Size from numbers, not hunches. Estimate the spans, metrics, and logs per second, test one replica under load, and plan headroom.
- Turn on the exporter queue and retries. Add a disk-backed queue for data you cannot afford to lose.
- Use a managed way to deploy. Helm charts and the OpenTelemetry Operator for Kubernetes make it easier to run gateways consistently across clusters.
- Roll out changes slowly. Test new rules on one replica or a test environment first. A bad rule at a gateway affects everyone.
- Pin and update versions. Choose a specific Collector version, read the release notes, and plan regular upgrades so security fixes arrive.
- Document who owns what. Platform teams own the gateway, and service teams own their instrumentation. Write it down.
A gentle path to adopting a gateway
Start with one team
Pick a friendly team and one service. Send its telemetry through a single Collector and compare what arrives with what was sent.
Add safety and a second replica
Add the memory limiter, a queue, and a second copy, so the pilot already behaves like the real thing.
Move policy into the gateway
Take one rule at a time, such as masking or dropping health checks, out of applications and into the gateway.
Onboard more teams
Publish a short guide with the gateway address and a few examples, and welcome teams one by one.
Add agents and a second tier if needed
Only when you need node-level data or tail sampling, grow the design. Growth driven by a real need is always easier to defend.
Give developers one standard address and one short guide. If the easy way to send telemetry is the correct way, nobody has a reason to build secret side routes that bypass your rules.
14Common Mistakes, Anti-patterns, and Myths
Learning from other people’s mistakes is much cheaper than making your own.
An anti-pattern is a habit that looks sensible at first but causes trouble later. These four appear again and again in real gateway deployments.
What it looks like
A single gateway copy serves the whole company, running on one machine with no backup.
Why it hurts
When that copy restarts, crashes, or is updated, all telemetry for every team stops or is lost. The monitoring system becomes the weakest link in the chain.
Better approach
Run several replicas across zones, add a queue, and test failure on purpose.
What it looks like
The gateway has no memory limiter, no queue limits, and no resource limits on the container.
Why it hurts
A sudden burst of data fills memory, the container is killed, and data in flight vanishes. The restart may then face the same burst again and fall into a loop.
Better approach
Use a memory limiter first, set sensible queue limits, and let the platform add replicas when load climbs.
What it looks like
The gateway’s receiver is reachable from the internet with no encryption and no authentication, because “it was easier for the test.”
Why it hurts
Strangers can flood it with fake data, read its diagnostic pages, or use it as a stepping stone into the network. Test shortcuts have a habit of becoming permanent.
Better approach
Keep receivers private, require authentication and encryption, and allow only known callers.
What it looks like
A team enables tail sampling on several ordinary gateway replicas behind a simple load balancer.
Why it hurts
Spans of one trace land on different replicas, so each replica sees only part of the story and makes poor decisions. Traces look incomplete, and the team wrongly concludes that tail sampling does not work.
Better approach
Use the two-tier design, with routing by trace ID, so each trace is judged by exactly one collector.
Myths and realities
| Myth | Reality |
|---|---|
| Gateway mode is a special version of the Collector. | It is the same Collector, deployed as a shared service. The mode describes the role, not the software. |
| You must have a gateway to use OpenTelemetry. | Small systems can export directly. A gateway is a helpful option, not a requirement. |
| A gateway replaces the backend. | It only receives, processes, and forwards. A separate backend still stores and displays the data. |
| A gateway removes the need for agents. | Agents still collect node-level details that a distant gateway cannot see. |
| A load balancer alone makes the gateway scale evenly. | Long-lived gRPC connections can spread unevenly unless you manage connection age or balance at the request level. |
| Once data reaches the gateway it is safe. | With a memory-only queue, data can still be lost in a crash. Use disk-backed queues for important data. |
15A Worked Example and Real-World Scenarios
Let us size a gateway the way a platform engineer would, using simple arithmetic.
Imagine an online store whose platform runs 120 services. Together they handle about 20,000 customer requests per second at the busiest hour. Each request touches several services and produces about 12 spans on average. The team wants to keep roughly one tenth of the traces after sampling. The numbers below are for illustration only; real systems must be measured.
| Step | Calculation | Result |
|---|---|---|
| Spans arriving at the gateway | 20,000 requests per second times 12 spans | 240,000 spans per second |
| Capacity of one replica, from a load test | Measured by the team | About 40,000 spans per second |
| Replicas needed for the busy hour | 240,000 divided by 40,000 | 6 replicas |
| Replicas with 50 percent headroom | 6 plus half of 6 | 9 replicas |
| Replicas per zone, across three zones | 9 divided by 3 | 3 per zone |
| Spans sent to the backend after sampling | 240,000 times one tenth | 24,000 spans per second |
| Spans to hold in queues in a one-minute backend outage | 24,000 times 60 seconds | About 1,440,000 spans |
Reading the table from the top, the gateway must absorb 240,000 spans every second, even though only 24,000 will be stored. This is the important lesson: the gateway pays for the data it receives, not only for the data it keeps. Nine replicas, spread across three zones, give both capacity and protection against a zone failure. The last row shows why queues must be sized deliberately: a one-minute outage already needs room for well over a million spans, so the team must decide how much memory or disk it is willing to spend to hold them.
Real-world scenarios
A retail platform with many teams
Forty teams ship services every day. A platform team runs a gateway so that sampling, labels, and privacy rules are the same for everyone. When a team needs a new label, they ask the platform team, and the change reaches every service without waiting for each team to redeploy.
A bank with strict privacy rules
A financial company must prove that account numbers never leave its network. The gateway applies masking rules and sits at the only exit to the internet. Auditors review one set of rules instead of hundreds of application configurations.
A company changing monitoring vendors
A business decides to move to a different observability product. Because every application already sends OTLP to the gateway, the platform team adds the new backend, sends data to both for a month to compare, and then removes the old one. No application code changes at all.
A software company serving customers in many regions
Customers in Europe and Asia require their data to remain in their region. The company runs a gateway in each region and routes telemetry to a local backend, so rules about where data may live are enforced by the layout of the system itself.
The worked example hides one more cost that surprises many teams: network traffic between zones. Cloud providers often charge for data that crosses a zone boundary, and a large telemetry stream can add up quickly. If each agent prefers a gateway replica in its own zone, most of the bulk traffic stays local, while the other zones remain available as a backup. That one routing choice can save real money without any loss of safety, and it is a good example of how a thoughtful gateway design pays for itself.
16Frequently Asked Questions
17Summary and Key Takeaways
The whole story in a few simple ideas you can carry with you.
Key Takeaways
- Gateway mode is a role, not a product. It is the standard OpenTelemetry Collector deployed as a shared, central service for a cluster, data center, or region.
- It is the central mailroom for telemetry. Applications and agents send OTLP to one address, and the gateway receives, cleans, samples, batches, and forwards the data.
- It centralizes policy and secrets. Redaction, sampling, routing, and backend credentials live in one place, so changes need no application redeployment.
- Agents and gateways work best together. Agents add local, node-level detail, while the gateway applies company-wide rules and talks to the backends.
- Scaling needs thought. Spread long-lived gRPC connections properly, and use a two-tier design with trace ID routing when decisions such as tail sampling need whole traces.
- Reliability is built in layers. A memory limiter, sending queues, retries, disk-backed storage, several replicas, and zone spreading keep short outages from becoming data loss.
- Protect and watch the gateway itself. Use encryption, authentication, private receivers, and careful change control, and alert on dropped data, queue size, and restarts.