Observability Fundamentals
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Checked on 2026-11-09 against Grafana 13.3.x and Kibana 9.5.x.
Every chart on a dashboard and every alert rule in this section is built from the same raw material: telemetry that a running system emits about itself. Before choosing a panel type or writing a rule it pays to be precise about what that telemetry is, what each kind of signal can and cannot tell you, how a measurement is identified so that it can be queried later, and how one signal leads to another when you are chasing a problem. This page is the vocabulary that the rest of the section relies on. It is tool-neutral: the same ideas apply whether the data ends up in Prometheus, Mimir, Loki and Tempo behind Grafana, or in Elasticsearch behind Kibana.
The running example is Bookshelf, the Spring Boot 4.1 book catalogue that the lab in
Hands-On Lab instruments with Micrometer and OpenTelemetry. Its setup
(the /actuator/prometheus endpoint, OTLP traces and structured JSON logs) is described in
Metrics and Observability and
Logging, and is not repeated here.
Monitoring and observability
Monitoring is the practice of watching a set of signals that you decided in advance were worth watching, and being told when they leave an acceptable range. A CPU graph, a request-rate panel and an alert on the 5xx ratio are all monitoring. It works well for failures you have already imagined.
Observability is the property of a system that lets you ask questions you did not imagine in advance, by looking at what it emits. The official Elastic description of its Observability solution lists logs, metrics, traces and profiling as the data it covers, with infrastructure monitoring, synthetics, SLOs and alerting built on top (Source: Elastic Observability). In practice the two overlap: monitoring is the part of observability that you automate (dashboards and alerts), and the rest is exploration, which is what the Explore, Drilldown and Discover tools are for. The practical consequence is that a system needs rich, well-labelled telemetry first. Dashboards and alerts are views over it.
The signals
OpenTelemetry defines the vocabulary that most modern tooling shares. Its signals page lists traces, metrics, logs and baggage as supported, and profiles as still in development, with events described as a specific kind of log (Source: OpenTelemetry signals). Grafana and Elastic both ingest these signals, so the table below uses the same names.
| Signal | Answers | Typical shape | Cost profile |
|---|---|---|---|
Metrics |
Is something wrong, and how wrong? How is a quantity trending? |
Numeric samples at regular intervals, identified by a name and labels. Small, cheap to store, fast to aggregate. |
Cost grows with the number of distinct label combinations (the series count), not with traffic. Excellent for alerts. |
Logs |
What exactly happened in this one occurrence? |
Timestamped records, ideally structured (JSON) with fields such as level, message and trace id. |
Cost grows with traffic and verbosity. Rich, but expensive to store and to search at volume. |
Traces |
Where in the call chain did this request spend its time or fail? |
A tree of spans, one per operation, sharing a trace id, with durations and attributes. |
Cost grows with traffic times spans per request, so traces are usually sampled. |
Profiles |
Which function or line of code consumes CPU or memory? |
Stack samples aggregated over time (flame graphs). |
Low per-request overhead, but another store to run. A development-stage signal in OpenTelemetry, available in Grafana (Pyroscope) and Elastic (Universal Profiling). |
Events |
Something discrete happened: a deploy, a feature-flag flip, a scale-out. |
A small record with a time and a few attributes, often shown as an annotation over a chart. |
Negligible volume. Very valuable for explaining a change in another signal. |
Michael Hausenblas frames the choice of signal as a cost and benefit trade-off, assessing the instrumentation effort, the telemetry volume and what you can observe with each signal. That is the lens used on Storage, Retention and Cost. For alerting the practical rule is: alert on metrics (cheap, aggregated, always evaluable), investigate with traces and logs (detailed, but expensive to evaluate continuously), and use profiles when the cause is inside the code itself.
Bookshelf emits all of them: the request counters and latency histograms are metrics, the JSON lines on standard output are
logs, the OTLP spans for GET /books and its PostgreSQL calls are traces, and a deployment annotation on a dashboard is an
event.
Time series, samples and labels
A metric is stored as a time series: a sequence of measurements ordered in time. Grafana’s introduction describes it exactly that way, and notes that each data point can carry tags that say where it was measured and let you filter (Source: Introduction to time series).
Three terms are used precisely in this section.
-
A sample is one measurement: a timestamp and a value, for example 4,312 requests at 10:00:15.
-
A label (Prometheus, Loki), tag (Graphite, OpenTSDB, InfluxDB) or attribute (OpenTelemetry) is a key and value that describes the measurement, for example
method="GET"orstatus="500". Elasticsearch calls the fields that play this role dimensions in a time series data stream. -
A series is the sequence of samples that share the same name and the same set of labels.
Grafana’s page on dimensions states the identity rule directly: a series is identified by its name plus its labels, as in
temperature {country=us,state=ma,city=boston}, and a query that returns several series distinguishes them by their
dimensions
(Source: Time series dimensions). Two samples
with the same name but one different label value belong to two different series. That is what makes labels powerful (you can
slice http_server_requests_seconds_count by route or status) and also what makes them dangerous.
A related point from the same page matters for alerting later: in a SQL-like table result every extra dimension becomes a column, and an alert rule evaluating such a result treats multiple dimensions as multiple conditions in one alert rather than as multiple alerts. Series identity is therefore also what Grafana Alerting uses to decide how many alert instances exist.
Cardinality
Cardinality is the number of distinct series a metric produces. If a metric has labels with n_1, n_2 and so on distinct
values, the worst case is the product of those counts:
For example http_server_requests_seconds_count with 40 routes, 5 methods, 6 status codes and 20 pods can reach
series, and a histogram multiplies that again by the number of buckets. Adding a
label whose values are unbounded (a user id, a raw URL with ids in it, an e-mail address, a trace id) makes the series count
grow with traffic until the backend runs out of memory. This is the single most common way for a monitoring system to
become slow or expensive, which is why cardinality is a cost driver covered in
Storage, Retention and Cost.
The same discipline applies in Elasticsearch. In a time series data stream the fields marked time_series_dimension identify
the series, and the dimensions together with the timestamp determine the document identity, so a duplicate is rejected with a
409 Conflict
(Source: Time series data stream).
Keep identifiers that vary per request in logs and traces, never in metric labels or dimensions. The Prometheus side of the
data model is in Data Model and Metric Types.
Seeing series in the lab
With the grafana profile running, Prometheus exposes the series of one metric. Count them and look at their label sets:
count(http_server_requests_seconds_count)
count by (uri) (http_server_requests_seconds_count)
topk(10, count by (__name__) ({job="bookshelf"}))
Reference: Prometheus querying basics.
Run a load generator that requests many distinct ids, then repeat the first query: if the number grows with every new id
the application is putting an unbounded value in a label. A clean Bookshelf keeps the uri label as a route template such
as /books/{id} rather than the concrete path.
Exemplars and signal correlation
Metrics tell you that p95 latency doubled. They cannot tell you which request was slow. An exemplar bridges that gap: it is a specific trace that represents a measurement taken in a given time interval, attached to a metric sample. Grafana describes it as pointing from an aggregated metric to a high-latency trace so that you do not have to compare fast and slow traces by hand (Source: Introduction to exemplars).
The OpenTelemetry data model gives the exact shape: an exemplar links a metric data point to its originating context, with an optional trace id and span id, a timestamp, a value and filtered attributes, and its value is already included in the parent histogram bucket, count and sum (Source: OpenTelemetry metrics data model). Exemplars are therefore extra data on a sample, not a separate series.
In Grafana, exemplar support is documented for the Prometheus data source. You enable it in the data source’s exemplar
settings, and exemplars appear as highlighted stars over a time series in Explore and in dashboards. Hovering shows the trace
id, and the link opens the trace in the configured tracing data source (the Grafana page uses Tempo). Exemplars are not
available with the Instant query type of the Prometheus query editor
(Source: Prometheus query editor). On the
Prometheus server, storing exemplars requires the feature flag --enable-feature=exemplar-storage
(Source: Prometheus feature flags).
Exemplars are one link in a larger idea: correlation, which means moving between signals about the same event by following
shared identifiers instead of searching by time alone. The identifiers are the trace id and span id (carried in logs and in
exemplars), and the resource attributes that name the service (service.name) and its instance. The Grafana page also shows
the log-to-trace direction: with Loki derived fields a regular expression extracts the trace id from a log line so that the
line becomes a link to the trace
(Source: View exemplar data).
The flow above is the one every later page assumes. In Grafana it is built from exemplars and Loki derived fields. In Kibana the same trace id is the join key that you filter on in Discover and the Observability apps, and the lab step below checks that it works. Correlation only works if three things are true in the application: logs include the trace id, metrics use the same service and instance names as traces, and the collector does not strip those attributes. Michael Hausenblas treats correlation as a topic in its own right, covering how OpenTelemetry carries context and how metrics, traces, logs and profiles can each be correlated, and notes that vendor support for it was still maturing. That caution is less true now, because both tools ship the links described above.
Push and pull collection
There are two ways for telemetry to reach a collector.
-
Pull (scrape): the collector contacts the application on a schedule and reads its current state. Prometheus does this against
/actuator/prometheus. The collector controls the interval, it can tell a target is down because the scrape fails (theupmetric), and the application needs no knowledge of the backend. -
Push: the application, or an agent beside it, sends data when it has it. OTLP, remote write, Logstash and Elastic Agent work this way. It suits short-lived jobs, firewalled networks and event-like data such as logs and spans, but a silent application and a broken pipeline then look identical.
That last point is why the lab alert "no data from the service" exists. Pulled metrics give you an explicit failure signal; pushed telemetry needs an alert on the absence of data, with careful handling of how the alert treats missing samples. The pipelines that implement each model are described in Telemetry Collection Pipelines.
What can go wrong
-
Unbounded labels. A label that varies per request creates a new series for every value. Check with the count queries above and drop or normalise the label at the source or in the collector.
-
Missing correlation ids. Logs without a trace id cannot be joined to traces. Verify that a log line from a slow request contains the id of that request’s trace.
-
Inconsistent names. If metrics call the service
bookshelfand traces call itbookshelf-api, links between them fail silently. Use one service name across signals. -
Treating absence as health. With push-based data, no samples can mean no problems or a broken pipeline. Alert on the absence of data explicitly.
-
Sampling hides the evidence. Aggressive trace sampling means the trace behind an exemplar may not exist. Sample on the collector with rules that keep errors and slow requests.
Verify it in the lab
-
Start the
grafanaprofile and open Explore with the Prometheus data source. Runcount(http_server_requests_seconds_count)and note the number. -
Request a few hundred different book ids, for example with
for i in $(seq 1 300); do curl -s -o /dev/null localhost:8080/api/books/$i; done, and run the query again. The count must stay flat, because the application reports the route template/api/books/{id}. -
The lab does not enable exemplars, so follow the log-to-trace link instead: in Explore with Loki, run
{application="bookshelf"} |= "trace_id", expand a line and click the Trace link of thetrace_idderived field. The trace must open in Tempo with the same trace id. -
Start the
kibanaprofile and in Discover filter on that trace id: the log documents and the trace spans appear together.
In the books
Rob Chapman and Peter Holmes (chapters 1 and 2) introduce metrics, logs, traces and "other" telemetry together with the personas that consume them, then cover log formats, metric types and tracing protocols. Michael Hausenblas (chapter 2) compares the signals by instrumentation cost and benefit, and chapter 11 covers correlation. Both were written against Grafana 9 and 10 and predate Grafana Alloy, the Drilldown apps and the OpenTelemetry-first Elastic path, so use them for the concepts and use the official pages above for current setup. The publisher links are in the bibliography on the section index.
Where to go next
-
Metric Types and Aggregation explains how a series is turned into counters, gauges and histograms and queried over time.
-
Telemetry Collection Pipelines shows how signals reach each backend.
-
RED, USE and the Golden Signals chooses which metrics to watch.