The Telemetry Pipeline
This part maps those seven steps using one failing checkout, then looks closely at the two that cause the most confusion: how data leaves the app (push or pull, and over what), and where the agent and the gateway run. The OpenTelemetry and OTel Collector parts that follow go deeper into each.
Seven steps from code to pager
The telemetry pipeline is the path telemetry takes from the line of code that creates it to the dashboard or page that a person sees. Every signal follows the same seven steps. Learn them once and every tool in this guide fits into one of them.
To make the steps concrete, follow one example the whole way: a checkout request fails with a 500 error.
- Instrument: create the data. Code in your app records what happened. You write some of it yourself (a log call, a counter), and a library adds the rest automatically, for example a timer around every HTTP call. Example: the checkout handler logs
"payment failed", adds 1 tohttp_requests_total{status="500"}, and the OTel SDK records a span for the request. - Emit: make the data available outside the app. Until now the data lives only in the app's memory. There are three common ways to get it out (see How data leaves the app). Example: the log line is printed to stdout, the counter waits on the app's
/metricspage, and the span is sent over OTLP. - Collect: pick it up close to the app. A small agent runs on the same machine or pod as your app and gathers the data from step 2. Your app hands data to something close and fast, so a slow or broken backend never slows your app down. Example: an OTel Collector on the node reads the stdout log, scrapes
/metrics, and receives the span. - Process: clean and cut before storing. Data is grouped into batches, personal info is removed, labels are added, noise is dropped, and only a sample of traces is kept. This usually happens in a central gateway, a shared pool of Collectors that every agent forwards to. It is the cheapest place to throw data away, because data dropped here is never stored or billed. Example: the gateway strips the card number from the log, adds
env=prod, and keeps this trace because it has an error. - Store: save it in a database built for that signal. Each signal has its own kind of database, because each is queried differently. Old data is deleted or shrunk to less detail over time. Example: the log goes to Loki, the counter to Prometheus, the trace to Tempo.
- Query: ask questions. Each store has a query language: PromQL for metrics, LogQL for logs, TraceQL for traces, or SQL. Example:
rate(http_requests_total{status="500"}[5m])gives the checkout error rate. - Visualize / alert: show people. Dashboards draw the query results. Alert rules run the same queries on a schedule and page someone when a threshold is crossed. Example: the error rate goes above 1%, Alertmanager pages the on-call engineer, and they open the Grafana dashboard.
The rule to remember: data dropped at steps 1, 4 or 5 is gone for good. Steps 6 and 7 can only ask questions about what was kept.
How data leaves the app: push and pull
Step 2, "emit", covers two opposite models. In push, the app sends data to someone. In pull, the app only exposes its data, and someone else comes to read it. Three methods cover almost everything:
| Method | Model | How it works | Typical use |
|---|---|---|---|
| stdout / log file | Push (to a file) | The app writes lines. An agent such as Fluent Bit or the Collector tails the file and ships the lines. | Logs |
/metrics page | Pull | The app runs a small HTTP endpoint, for example http://app:8080/metrics, that lists the current value of every counter and gauge as plain text. Prometheus or the Collector requests it every ~15 s. This is called scraping. If a scrape fails, Prometheus records up == 0, so you get a "target is down" signal for free. | Metrics (Prometheus style) |
| OTLP | Push (over the network) | The OTel SDK batches data and sends it to a Collector over gRPC (port 4317) or HTTP (port 4318). | Traces (the default). Metrics often. Logs less often: most teams still write logs to stdout (see Is everything moving to OTLP?) |
Why pull is the default for metrics
With pull, the app doesn't need to know where the backend is. It has no setting like "send metrics to prometheus.internal:9090". It keeps counters in memory and answers when someone requests /metrics. Finding the apps is the scraper's job, usually through service discovery (for example Kubernetes labels). If the backend moves, is replaced or goes down, the app doesn't change.
The scraper also sets the pace. The monitoring side decides how often data is collected, so a buggy app can't flood the backend by sending 10,000 times a second: nothing reaches the backend until the scraper asks for it. That keeps backend load predictable. And a failed scrape is itself information: the target is down (up == 0). The Prometheus part covers what else a scrape records.
Where pull breaks: short-lived jobs
Pull only works if the process is still alive when the scraper arrives. Any job that lives for less than one scrape interval can be missed completely:
t=0s scrape
t=2s batch job starts, processes 500 rows, sets rows_processed=500
t=5s job exits, and its in-memory metrics are gone
t=15s next scrape: nothing to read. The job ran, but monitoring never saw it.So short jobs push instead. Cron jobs, batch scripts, CI steps and serverless functions send their final numbers just before exiting, to something long-lived: usually the Pushgateway, or a Collector over OTLP. Prometheus then scrapes that middleman on its normal schedule:
short job ──push on exit──▶ Pushgateway ◀──scrape every 15s── PrometheusThe rule of thumb: pull for long-running services, and push for anything that can exit before the next scrape. The Pushgateway has its own traps; see Pushgateway: Only for Batch Jobs.
Why spans are pushed
A span is a record of one unit of work: what ran, when it started and ended, and whether it failed (the Traces part lists every field). When the checkout request arrives, the SDK opens a span. When the handler returns, the SDK closes it, and the finished span sits in the app's memory:
name: "POST /checkout"
trace_id: 4bf92f35… ← shared by every span of this request, in every service
span_id: 00f067aa…
parent_id: (none: this is the root span)
start/end: 10:00:00.000 → 10:00:00.840 (840 ms)
status: ERROR
attributes: http.status_code=500, user.tier=goldA counter is a single current value, so a scraper can read it at any time and still be right. Spans are separate events, often thousands per second, and each one finishes once and then has to go somewhere. There is no "current value" to scrape, so the app sends them as they finish. Sending them as structured OTLP, not text lines, keeps trace_id and parent_id as real fields the backend can join on to draw the trace waterfall.
"The span is sent over OTLP" means four things happen:
- The SDK puts each finished span in an in-memory buffer.
- Every few seconds, or when the buffer fills, the exporter packs the spans into one batch.
- It sends the batch to the Collector as a gRPC call to
:4317or an HTTP POST to:4318. OTLP is the format of that request. - The Collector's OTLP receiver accepts it. That is step 3's "receives the span."
If the Collector is down, the buffer fills and the SDK drops spans so the app does not block. This is one more reason to keep the agent on the same node. The wire format itself is in OTLP: The Wire Protocol.
Is everything moving to OTLP?
Partly. OTLP carries all three signals over the same ports, with one path per signal (/v1/traces, /v1/metrics, /v1/logs). One OTel SDK has a part for each signal: TracerProvider, MeterProvider and LoggerProvider. The gain is not that the SDK is clever. The three parts share the same resource (service.name is set once, so names match across signals) and the same context (a log written during a request gets its trace_id automatically). Adoption differs by signal:
- Traces: almost always pushed over OTLP.
- Metrics: often OTLP, and Prometheus can accept OTLP directly. Many teams still use the
/metricsscrape because it is simple and givesup == 0for free. - Logs: the slowest to move. You keep your logging library (log4j, logback, Python
logging), and a bridge passes its records to theLoggerProvider. How mature the bridge is depends on the language (see Logs: The Bridge, Not a New API). Many teams also keep logging to stdout on purpose: a line written to stdout is already on disk if the app crashes a moment later, while an OTLP batch still in memory is lost. The Collector tails the file (filelogreceiver) and converts the lines to OTLP.
So the trend is that OTLP becomes the common format from the Collector onward. It does not mean every app pushes every signal over OTLP itself.
Where the agent and the gateway run
The agent (step 3) and the gateway (step 4) are the same program, the OTel Collector. The only difference is where you run it. You can run either one, both, or neither.
- Agent (step 3): a Collector on the same node as the app. It takes data off the app quickly and adds host and pod labels.
- Gateway (step 4): a shared pool of Collectors that every agent sends to. Because it sees all the data, it can batch, redact, filter and sample, for example keep every trace that had an error, before anything reaches the stores.
So it is not "agent or gateway". These are the setups you will see:
| Setup | Path | When it fits |
|---|---|---|
| Agent + gateway | app → agent → gateway → store | The production default. The agent collects, the gateway decides what to keep. |
| Agent only | app → agent → store | Small clusters. Simpler, but every agent needs store credentials and writes to the store on its own, so a large fleet can overload it. |
| Gateway only | app → gateway → store | Serverless, or places where you cannot run a long-lived agent. What you lose depends on the platform (see Gateway only on Lambda). |
| Neither | app → store | Tiny or dev setups. Store credentials sit inside every app. |
How data gets into the agent (the SDK pushes OTLP, or the agent tails log files, or scrapes /metrics) is a separate question from where the agent runs. Both choices, and the two-tier gateway that tail sampling needs, are in Deployment Topology: Agent and Gateway.
Gateway only on Lambda
On your own VMs with no agent, nothing reads stdout, log files or host metrics, so all of it stays on the machine. Serverless platforms are different. On Lambda you cannot install an agent on the machine, but you don't need one for stdout: your code still just writes to stdout (print, console.log), and the Lambda platform captures it. The platform does the agent's log-reading job. Logs then leave by one of two paths:
Path 1 (default):
code → stdout → Lambda platform → CloudWatch Logs
→ subscription filter → Firehose / Lambda → your backend
Path 2 (extension):
code → stdout → Lambda platform ──Telemetry API (push)──→ extension in the sandbox
(OTel / ADOT Collector layer)
→ gateway → storeAn extension is a separate process that runs inside the function's sandbox, so it works like a small agent. Unlike a real agent, it lives only as long as the execution environment, and it has no durable disk buffer. Here is what gateway-only keeps and loses on each platform:
| Data | Gateway only on your own VMs (no agent) | Gateway only on Lambda |
|---|---|---|
| Logs to stdout | Lost: nothing reads them | Kept: the platform captures them |
Logs to a file (e.g. /tmp/app.log) | Lost | Lost: gone when the sandbox is recycled, unless your code ships them |
| Host metrics (CPU, disk, network) | Lost | Lost: AWS hides the host. You get platform metrics instead (duration, memory used, init time, throttles) |
The Invariants
- Guarantees: Every signal passes through the same seven steps, so every tool sits at one of them. A pull target that cannot be scraped shows up as
up == 0. A line written to stdout is on disk even if the app crashes a moment later. - Does not guarantee: That anything dropped at steps 1, 4 or 5 can be recovered: queries and dashboards see only what the store kept. That a job shorter than one scrape interval is ever scraped. That spans survive a Collector outage (the SDK drops them rather than block the app), or that logs buffered in a Lambda extension survive a frozen sandbox.
Back to the central question
The guide's central question asked which signal threw away the fact that would have explained a slow slice of checkouts, and which tool decided that. What observability actually is answered the first half. This part answers where to look for the second: the decision was made at one of three steps.
At step 1, in the process, a metric was aggregated or a trace was sampled before it left the app. At step 4, the gateway dropped, sampled or redacted it before it was stored. At step 5, the store deleted or downsampled it by age. Data can also never arrive at all: a batch job that exits between scrapes, spans dropped when the Collector was down, logs written to a file that no agent reads.
You should now be able to take any piece of telemetry, name the step where it could have been lost and the tool that owns that step, and say how each signal leaves the app and what that path cannot survive. The next two parts open up the tools at the front of the pipeline: OpenTelemetry for steps 1 and 2, and the OTel Collector for steps 3 and 4.