SynfraCore
Synfracore
Start Learning
Navigation

Academies

Platform

RoadmapsLabsCertificationsInterviewPYQsAI AssistantCareer
Start Learning Free Learning Roadmaps

OpenTelemetry — Fundamentals

Core concepts and commands — hands-on from the start

📄
Last updated Nov 2026
Expert Content

OpenTelemetry — Fundamentals

Spans: the unit traces are built from

A span represents one unit of work — handling an HTTP request, running a database query, calling a downstream service. Every span has a name, a start and end time, a trace ID (shared by every span in the same trace), and its own span ID. A span that was triggered by another span records that span's ID as its parent, which is how a flat list of spans reconstructs into a tree showing exactly which call triggered which.

text
Trace ID: abc123
  Span: "GET /checkout"          (root span, no parent)
    Span: "query inventory_db"   (parent: GET /checkout)
    Span: "call payment-service" (parent: GET /checkout)
      Span: "query payments_db"  (parent: call payment-service)

A single slow request often turns out to have one slow span buried three levels deep — the whole point of a trace tree is finding that span directly, instead of guessing which service is responsible from end-to-end latency alone.

Attributes and semantic conventions

A span (or a metric, or a log record) carries key-value attributes describing it — http.response.status_code, db.system, error.type. OpenTelemetry publishes semantic conventions recommending standard attribute names for common cases, specifically so two different teams' instrumentation of "an HTTP request" produces comparably-named data instead of one team calling it status_code and another calling it httpStatus.

Verify exact attribute names against the current OpenTelemetry semantic conventions before relying on them — this is an actively evolving part of the spec, and attribute names have been renamed between versions (for example, HTTP attributes moved from an older http.method style to a newer http.request.method style in a past semantic-convention revision).

Metrics: counters, gauges, and histograms

OTel defines a small set of metric instrument types, each suited to a different shape of measurement:

•Counter — a value that only goes up (total requests served, total errors). Never decreases.
•UpDownCounter — a value that can go up or down (current number of active connections).
•Histogram — a distribution of measured values (request duration), letting you compute percentiles later rather than only an average.

Picking the wrong instrument type loses information permanently: a counter can tell you total requests served, but never what a typical request's latency looked like, because it was never designed to record a distribution in the first place.

The Collector's three-stage pipeline

Every Collector pipeline has the same three stages, configured independently for traces, metrics, and logs:

Receivers
How telemetry enters the Collector — OTLP from an app, or scraping an existing Prometheus endpoint
Processors
Transform data in flight — batch for efficiency, filter out noise, add or rename attributes
Exporters
Send processed telemetry onward — to one backend, or several at once

A single Collector instance can run several independent pipelines (one for traces, one for metrics, one for logs), each wiring together its own chosen receivers, processors, and exporters — they don't have to share the same path end to end.

Sampling: not every trace needs to be kept

At high request volume, storing every single trace in full is expensive and often unnecessary — most traces of a healthy system look identical. Head sampling decides whether to keep a trace at the very start, before it's known whether anything interesting happens (cheap, but can discard a trace that turns out to matter). Tail sampling waits until the whole trace is complete before deciding, which lets you deliberately keep every trace involving an error or unusually high latency, at the cost of buffering complete traces before the sampling decision is made.

Try it: Pick a request flow you know well — even a simple one, like a login endpoint calling an auth service and a database. Sketch it as a span tree like the example above, labeling which span would be the parent of which. Then think through what a tail-sampling rule that always keeps error traces would need to see before it could make that decision.

Share:
Join our Community
Daily tips, job alerts, interview help — join engineers learning together
→
Up Next
⚡
OpenTelemetry — Intermediate
Real-world patterns, best practices, and deeper topics
Also Worth Exploring
← Back to all OpenTelemetry modules
← InstallationIntermediate →