Observability and telemetry
OpenTelemetry defines observability as the ability to understand a system from the outside by asking questions about it, without knowing its inner workings. This ability helps troubleshoot problems that have not been encountered before and understand why an incident happened.
According to OpenTelemetry, for these questions to be answerable, the application must produce data through instrumentation. Application code emits signals such as traces, metrics, and logs. OpenTelemetry is the mechanism that instruments application code so that a system can become observable.
Telemetry is the data a system and its behavior produce. OpenTelemetry notes that this data can take the form of traces, metrics, or logs. A metric aggregates numerical data about infrastructure or an application over a period of time. A log is a timestamped message. A trace records the path a single request takes across multiple services.
Metrics: numerical data over time
OpenTelemetry's metric examples include a system's error rate, CPU utilization, and the rate of requests to a given service. This data is an aggregation of numerical measurements about infrastructure or an application over a period of time.
OpenTelemetry describes reliability as whether a service does what its users expect it to do. In its example, even if the system is continuously available, when a user wants to add a pair of black shoes to the cart, the system may not always add black shoes. Such a system may not be reliable.
A Service Level Indicator, or SLI, is a measurement of a service's behavior. OpenTelemetry describes a measurement taken from the user's point of view as a good SLI. The loading speed of a web page is one example. A Service Level Objective, or SLO, is a means of communicating reliability to an organization or to other teams; it does so by tying one or more SLIs to business value.
Four signals for monitoring
Google SRE defines four golden signals for monitoring: latency, traffic, errors, and saturation. Latency is the time it takes to service a request. Google SRE distinguishes between the latency of successful requests and that of failed requests. Including a fast error response in the overall latency calculation can be misleading. The latency of error responses is also tracked.
Traffic expresses the amount of demand placed on the system, using a metric suited to the nature of the system. Google SRE gives the HTTP request rate for a web service as an example. The same measurement can be split by the nature of the requests, for example into static and dynamic content. In an audio streaming system, network I/O rate or concurrent sessions, and in a key-value storage system, transactions and retrievals per second, are examples of traffic measurements.
Errors is the rate of requests that fail. According to Google SRE, a failure can appear as an explicit error response, as wrong content served alongside a successful response, or as a violation of a defined policy. If protocol response codes do not express every error condition, secondary, internal protocols may be needed to track partial failure modes.
Google SRE also distinguishes between catching requests that fail outright and detecting that wrong content is being served. Monitoring error responses on the load balancer may catch the first case. End-to-end system tests can detect that wrong content is being served.
Saturation shows how full the service is and focuses on the most constrained part of the system. Google SRE gives memory in a memory-constrained system and I/O in an I/O-constrained system as examples. In some systems, performance degrades before full utilization is reached. A rise in latency can also be an early sign of saturation.
Averages and distributions
Google SRE notes that an uneven distribution can hide behind average utilization values. Some CPUs or databases may be used much more heavily than others. A similar imbalance can arise with latency: a portion of requests can be much slower than the average suggests.
Grouping request counts by latency buckets is one way to show the difference between a slow average and a tail made up of very slow requests. These counts can be displayed as a histogram. Google SRE describes setting histogram boundaries at approximately exponential intervals as a way to visualize the distribution of requests.
The measurement interval also affects what data can be seen. According to Google SRE, observing CPU load over a long interval may not reveal brief spikes that cause high tail latency. On the other hand, measuring frequently can be costly in terms of collecting, storing, and analyzing the data.