Serverless Computing & Microservices

Chapter 10
Reliability, Observability and Operational Analytics

Advance Diploma in Cloud Computing
Serverless Computing & Microservices   •   Advance Diploma

Reliability, Observability and Operational Analytics

Introduction

Serverless and microservices architectures allow organisations to deploy independently scalable services, functions, managed databases, queues and event streams. These advantages also create operational complexity. A single customer request may cross an API gateway, several functions, multiple services, a message broker and external providers. Failures may be partial, intermittent and difficult to reproduce. Traditional server monitoring, based mainly on host utilisation, is therefore insufficient.

Reliability engineering addresses whether a system performs its required function consistently. Observability concerns the extent to which internal system behaviour can be understood from its externally visible outputs. Operational analytics uses collected evidence to detect trends, diagnose incidents, evaluate service quality and guide improvement.

In this chapter, reliability is treated as a socio-technical property: architecture, code, infrastructure, people, processes and business expectations all contribute. The objective is not to eliminate every failure, which is usually impossible and economically inefficient, but to detect, contain, learn from and reduce harmful failure.

Learning Objectives

By the end of this chapter, the reader should be able to:

  1. distinguish logs, metrics, traces and events and select appropriate uses for each;
  2. design correlation identifiers and distributed tracing for microservices and serverless workflows;
  3. explain OpenTelemetry’s role in vendor-neutral instrumentation;
  4. define service-level indicators (SLIs), service-level objectives (SLOs) and error budgets;
  5. calculate availability, latency and error-budget consumption under stated assumptions;
  6. use operational analytics to identify patterns and probable causes;
  7. conduct blameless incident analysis and convert findings into engineering actions; and
  8. evaluate governance, privacy, cost and reliability trade-offs.

1. Reliability in Distributed Applications

Reliability is the probability that a system performs its specified function for a stated period under stated conditions. In cloud applications, “working” is multidimensional. A request may receive an HTTP response but still be unacceptable if it is too slow, stale, incomplete or functionally incorrect.

Important reliability attributes include:

  • Availability: whether the service is usable when requested.
  • Latency: how long an operation takes, commonly examined using percentiles.
  • Correctness: whether the result is semantically valid.
  • Durability: whether stored data remains available and uncorrupted.
  • Scalability: whether performance remains acceptable as demand changes.
  • Resilience: the ability to tolerate faults and recover.
  • Recoverability: the ability to restore service and data after disruption.

A distributed system has failure independence only when failures in one component do not significantly increase failures elsewhere. In practice, shared dependencies—identity providers, databases, networks, deployment pipelines and configuration stores—create correlated failure. Reliability design therefore considers both component behaviour and dependency topology.

Failure modes in serverless and microservices systems

Typical failure modes include function timeouts, throttling, cold-start latency, exhausted database connections, queue backlogs, malformed events, retry storms, duplicate message processing, regional outages, deployment defects and third-party API failure. A retry can improve reliability for transient faults but can worsen overload. Similarly, an asynchronous queue can protect a user-facing request path but may increase processing delay.

Useful design controls include timeouts, bounded retries, exponential backoff with jitter, circuit breakers, bulkheads, rate limits, idempotency keys, dead-letter queues, health checks, graceful degradation and tested recovery procedures.

2. The Observability Model

Observability is commonly implemented through four related evidence types: logs, metrics, traces and events. They answer different questions rather than competing to be the single source of truth.

EvidenceMain questionTypical useMain limitation
LogWhat happened at a particular point?Detailed diagnosis and auditHigh volume; difficult aggregation
MetricHow much, how often or how long?Alerting, dashboards and trendsLoses individual-event detail
TraceHow did one request move through the system?Dependency and latency analysisSampling and instrumentation cost
EventWhat state change occurred?Workflow and business analysisSemantics must be defined clearly

Logs

A production log should be structured, machine-readable and consistent. JSON is common, although the format is less important than stable fields. Useful fields include timestamp, severity, service name, environment, version, operation, outcome, duration, trace identifier, span identifier, request identifier and a carefully controlled error representation.

Logs should describe meaningful state transitions and failures, not merely repeat framework messages. A log message such as “payment authorization rejected” is more useful than “error code 17” if it includes a safe reason category, transaction identifier and dependency context. Sensitive values—passwords, access tokens, payment-card data and unnecessary personal information—must not be logged.

Severity levels should have operational meaning. For example, INFO may represent normal lifecycle events, WARN an abnormal but handled condition, and ERROR a failed operation requiring investigation. Excessive use of ERROR creates alert fatigue.

Metrics

Metrics are numerical measurements recorded over time. Common categories are:

  • Counter: a cumulative count that normally increases, such as requests or failures.
  • Gauge: a value that can rise or fall, such as queue depth.
  • Histogram: observations grouped into buckets, such as request duration.
  • Summary: a client-side statistical summary, often including quantiles.

The four golden signals are latency, traffic, errors and saturation. Metrics may describe infrastructure, service behaviour or business outcomes. Examples include successful checkout rate, messages delayed beyond a threshold, function throttles and database connection utilisation.

Metric labels enable slicing by dimensions such as region, route or status class. However, unbounded labels—particularly user IDs, request IDs or arbitrary URLs—create high cardinality and excessive cost. A sound metric design uses stable, bounded dimensions.

Traces and spans

A trace represents one logical operation across components. It consists of spans, where each span records an operation, timing, attributes, status and relationships to other spans. A parent span may represent an incoming request; child spans may represent database access, function execution or an external API call.

Distributed tracing makes critical-path latency visible. If total latency is 900 ms and a downstream call consumes 700 ms, optimisation should begin with the dependency rather than with unrelated local code. Parallel spans must not be added naively to calculate total duration, because overlapping work occurs concurrently.

Trace sampling controls storage and processing cost. Head sampling decides early, before the complete outcome is known. Tail sampling can retain unusual traces—errors, high latency or rare routes—after observing more of the trace. Sampling policies should preserve evidence for important failures and not systematically exclude low-volume customers or regions.

Events

An event records a business or system fact, such as OrderAccepted, PaymentFailed or FunctionThrottled. Events should have explicit schemas, versioning and ownership. An event is not necessarily the same as a log: logs describe operational observations, while events often drive state transitions or downstream processing.

3. Correlation and Context Propagation

Correlation allows evidence from separate components to be associated with one user operation. A correlation identifier should be generated at a trusted boundary or safely accepted from a controlled upstream system. It should be propagated through HTTP headers, messaging metadata and asynchronous workflow context.

Modern distributed tracing commonly uses W3C Trace Context, including a trace identifier and span identifier. A request may also have a business-level identifier, such as an order ID, and an idempotency key. These identifiers serve different purposes:

IdentifierPurpose
Trace IDConnects spans belonging to one distributed operation
Span IDIdentifies one operation within a trace
Request IDIdentifies an application request, often for support workflows
Business IDIdentifies a domain object such as an order
Idempotency keyPrevents repeated processing of the same intended operation

Identifiers must not be treated as secrets. They should be unpredictable enough to avoid collisions but should not contain personal information. Trust boundaries matter: blindly copying arbitrary incoming headers can permit spoofing or misleading investigations. Systems should validate, replace or mark externally supplied identifiers according to policy.

Asynchronous processing requires explicit context handling. When a producer places a message on a queue, trace context and safe business context can be stored in message attributes. The consumer then creates a new consumer span linked to, or descended from, the producer span. Because a message may be retried or processed by multiple consumers, one trace may contain repeated attempts; attempt number and delivery count should be recorded.

4. OpenTelemetry

OpenTelemetry (OTel) is an open-source, vendor-neutral framework for generating, collecting and exporting telemetry. It provides APIs, software development kits, automatic instrumentation in supported ecosystems, semantic conventions and collectors. It is not itself a storage or visualisation product.

A typical architecture is:

  1. application code creates spans, metrics and logs through OTel APIs or instrumentation;
  2. an OTel SDK applies configuration, batching and sampling;
  3. telemetry is exported using a supported protocol;
  4. an OTel Collector receives, processes and routes data; and
  5. back-end systems store, query and visualise the evidence.

The Collector can perform batching, filtering, attribute enrichment, redaction, sampling and routing. This reduces direct coupling between applications and a particular observability vendor. Nevertheless, a Collector is not a substitute for sound instrumentation or a clear data-retention policy.

Instrumentation should focus on user journeys and dependency boundaries. Automatic instrumentation can capture HTTP, database and messaging activity quickly, but manual spans are often required for business operations such as “reserve inventory” or “calculate insurance premium.” Semantic conventions improve consistency, although teams must manage changes in conventions and instrumentation libraries.

An observability implementation should answer practical questions: Which customer operation failed? Which deployment introduced the change? Is the issue regional? Which dependency is slow? Is the error affecting all traffic or one tenant? If telemetry cannot answer these questions, collecting more undirected data may not solve the problem.

5. Service-Level Indicators and Objectives

A service-level indicator (SLI) is a quantitative measure of a service aspect relevant to users. An SLO is a target value or range for an SLI over a defined period. An SLA is a formal agreement, often contractual, that may include consequences for not meeting targets. SLOs are engineering objectives; SLAs are legal or commercial commitments.

A strong SLI uses an event-based numerator and denominator. For availability over a period:

Availability = (Good requests ÷ Valid requests) × 100%

Here, “good requests” must be explicitly defined, perhaps as responses below 500 ms with an accepted status; “valid requests” are requests that should be included, excluding health checks or intentionally rejected malformed traffic when appropriate. The formula assumes that requests are the unit of user experience and that the measurement boundary is consistently applied.

For a 30-day period containing 10,000,000 valid requests and 9,995,000 good requests:

Availability = (9,995,000 ÷ 10,000,000) × 100% = 99.95%

Latency should generally be expressed with percentiles rather than averages. The 99th percentile, p99, is the value at or below which approximately 99% of observations fall. Percentiles do not add linearly across services, and a p99 computed from aggregated averages is not a valid p99. Histograms or appropriately merged raw distributions are needed for defensible aggregation.

An SLO might state: “At least 99.9% of checkout requests complete successfully within 2 seconds each calendar month.” It must specify request population, measurement location, time window, exclusions and treatment of retries.

Error budgets

If the availability SLO is 99.9%, the error-budget fraction is:

Error budget fraction = 1 − SLO fraction

For a 30-day month of 43,200 minutes:

Allowed unavailability = 43,200 × (1 − 0.999) = 43.2 minutes

The calculation assumes the SLO is time-based and that every minute has equal significance. A request-based SLO instead uses the allowed proportion of unsuccessful requests. For 2,000,000 valid requests and a 99.9% objective, up to 2,000 requests may be unsuccessful, subject to the precise definition of “unsuccessful.”

Error budgets create a decision mechanism. When substantial budget remains, teams may accept controlled change risk. When the budget is nearly exhausted, release pace, testing, capacity or reliability work may need adjustment. The budget is not permission to cause failures and should not become a punitive performance target.

6. Operational Analytics and Diagnosis

Operational analytics converts telemetry into decisions. A useful investigation moves from symptom to scope, timeline, hypotheses and evidence.

A practical investigation sequence

  1. Validate the signal. Confirm that the alert reflects a real user or service problem rather than an instrumentation defect.
  2. Establish scope. Determine affected routes, regions, tenants, versions and dependency paths.
  3. Construct a timeline. Align deployment events, metric changes, logs, traces, queue growth and provider incidents using synchronized clocks.
  4. Compare cohorts. Compare successful and failed requests, old and new versions, or affected and unaffected regions.
  5. Test hypotheses. Use traces and controlled queries to distinguish a slow dependency from local saturation, bad data or a code regression.
  6. Mitigate first. Roll back, disable a feature, route around a region, increase capacity or apply another reversible control.
  7. Verify recovery. Confirm improvement through the SLI and user-facing indicators, not merely the absence of an error log.

Correlation is not causation. A graph showing increased latency after a deployment supports investigation but does not prove that the deployment caused it. Confounding factors such as traffic mix, dependency changes or a simultaneous provider event must be considered.

Useful analyses include rate calculations, time-window comparisons, cohort analysis, anomaly detection and dependency graphs. Alert thresholds should reflect user impact and duration. A single transient error may be less important than a sustained increase in failed payments, even if the latter has a smaller percentage change.

Alert quality

An alert should identify an actionable condition, include context and route to an owner. Alerts based solely on CPU may miss a severe business failure; alerts on every log error may overwhelm responders. Multi-window, multi-burn-rate alerting can detect rapid and slow SLO consumption, but the policy must be understandable and tested. Every alert should have a runbook, severity definition and escalation path.

7. Incident Response and Post-Incident Learning

An incident is an event that threatens or degrades a service’s expected operation. Effective response separates immediate coordination from later causal analysis. Roles may include incident commander, operations lead, communications lead and subject-matter experts.

During response, teams should:

  • declare the incident and establish a shared communication channel;
  • record facts, decisions and timestamps;
  • protect customer data and responder access;
  • reduce impact using reversible actions;
  • communicate clearly about known effects and uncertainty; and
  • close only after monitoring confirms stable recovery.

A blameless post-incident review does not mean avoiding accountability. It means examining system conditions, incentives, tooling, assumptions and decision processes rather than reducing the explanation to an individual’s mistake. A useful report includes impact, detection, timeline, contributing factors, response effectiveness, recovery and prioritised corrective actions.

The “five whys” can help explore contributing conditions, but it should not be used mechanically to identify a single human culprit. Distributed incidents often have multiple causes: an unbounded retry, an undocumented dependency limit, incomplete canary analysis and an alert that measured infrastructure rather than user impact.

Corrective actions should have an owner, due date, success measure and priority. Actions should be classified as prevention, detection, mitigation, recovery or learning. “Be more careful” is not a measurable action; “add an idempotency test for duplicate payment events and monitor duplicate rate below the defined threshold” is more useful.

8. Illustrative Case: Checkout Degradation

Background

A fictional online retailer operates an API gateway, serverless checkout functions, an inventory service, a payment microservice and a queue for order confirmation. Its monthly checkout SLO is 99.9% successful requests under two seconds.

Problem

During a promotional campaign, customers report slow checkout. The dashboard shows only a modest increase in function errors, but the checkout SLI falls below its objective. Queue depth and payment latency rise sharply.

Analysis

Trace analysis shows that most slow requests wait on the payment provider. The payment service retries timed-out calls three times without sufficient backoff. These retries increase provider load and consume function execution time. Meanwhile, a deployment has increased the checkout function’s timeout from 10 to 30 seconds, allowing more concurrent executions to remain active. Logs contain request IDs but not consistently propagated trace context, making some asynchronous confirmation paths difficult to connect.

The team compares regions and versions. The problem is strongest in the newly deployed version and in the region with the highest campaign traffic. This evidence supports, but does not alone prove, a relationship between the deployment, retry policy and overload.

Approach and solution

The incident commander disables the new retry configuration and enables a controlled feature flag that permits checkout completion with an asynchronous payment confirmation state. The team applies exponential backoff with jitter, caps attempts, introduces an idempotency key for payment requests and routes a portion of traffic to a healthy region. A queue consumer is scaled within the provider’s limits, and a dead-letter queue is monitored.

The engineering team then standardises W3C trace propagation through HTTP and message attributes, adds a payment-dependency latency SLI, and creates an alert on rapid error-budget consumption. A canary deployment policy prevents a release from expanding when checkout latency or payment failure rate deteriorates.

Outcome

User-visible latency returns below the SLO threshold, queue depth declines and duplicate payment attempts disappear. The post-incident review identifies retry amplification and insufficient end-to-end telemetry as the principal contributing conditions. The organisation does not treat the incident as evidence that retries are always wrong; rather, retries must be bounded, classified by error type, coordinated with timeouts and protected by idempotency.

Learning points

  1. A low infrastructure error rate can coexist with severe user impact.
  2. Traces reveal dependency and critical-path behaviour that logs alone may obscure.
  3. Retry policies are part of system capacity and reliability design.
  4. Correlation context must cross asynchronous as well as synchronous boundaries.
  5. SLOs and error budgets connect technical evidence to release decisions.

9. Governance, Privacy and Cost

Telemetry is operational data and may be personal, confidential or commercially sensitive. Organisations should apply data minimisation, purpose limitation, access control, encryption, retention limits and audit logging. Trace attributes should not include full customer profiles, tokens or payment details. Redaction must occur before data leaves a trusted processing boundary where possible.

Retention should reflect investigation needs, regulatory requirements and cost. High-cardinality metrics and full-fidelity traces can become expensive at scale. Sampling, aggregation, tiered storage and selective retention reduce cost, but aggressive sampling can conceal rare failures. Sampling policies should be evaluated against reliability objectives and fairness concerns.

Access to production telemetry should follow least privilege. Incident responders may need temporary elevated access, with approval and audit trails. Cross-border data movement may invoke privacy and data-residency obligations. Regulatory frameworks differ by jurisdiction, so engineering teams should work with security, legal and compliance specialists rather than assuming that telemetry is harmless technical metadata.

AI-assisted operations can summarise incidents, cluster similar errors and suggest probable causes. Such systems may hallucinate causal explanations, expose sensitive data or encode biased prioritisation. AI recommendations should remain advisory unless controls, provenance, testing and human approval are established. The underlying telemetry must still be accurate and well governed.

10. Contemporary Practices and Best Practices

Modern reliability programmes increasingly combine platform engineering, product ownership and site reliability engineering. Important practices include:

  • define SLIs from user journeys rather than infrastructure convenience;
  • instrument service and asynchronous boundaries consistently;
  • standardise semantic fields and trace propagation;
  • use dashboards that combine user impact, dependencies and saturation;
  • test failure modes through fault injection or controlled game days;
  • design for idempotency and duplicate delivery;
  • use canaries, progressive delivery and automated rollback;
  • maintain tested runbooks and recovery procedures;
  • review error-budget consumption in planning and release decisions; and
  • measure the effectiveness of corrective actions after incidents.

Observability should be treated as a product capability. Teams should know who owns each signal, how it is queried, how long it is retained and what action follows a threshold breach. More telemetry is not automatically better observability; useful observability is relevant, trustworthy, affordable and actionable.

Chapter Summary

Reliable serverless and microservices applications require more than healthy infrastructure. They require explicit reliability objectives, resilient interaction patterns, consistent telemetry and disciplined operational learning. Logs provide detailed records, metrics support aggregation and alerting, traces reveal distributed request paths, and events describe meaningful state changes. Correlation identifiers and context propagation connect these forms of evidence across synchronous and asynchronous boundaries.

OpenTelemetry provides vendor-neutral APIs, SDKs, instrumentation and collection components, but its value depends on appropriate instrumentation and governance. SLIs quantify user-relevant behaviour, SLOs define targets, and error budgets translate reliability into an engineering decision framework. Operational analytics should establish scope, construct timelines, test hypotheses and distinguish correlation from causation. Incident response should prioritise mitigation and communication, while blameless post-incident analysis should produce owned, measurable improvements. Privacy, access control, retention and cost must be designed into the observability system from the beginning.

Key Terms

Observability: The ability to understand internal system behaviour from externally available outputs.

Reliability: The ability of a system to perform its required function under stated conditions for a stated period.

Availability: The proportion of time or valid requests during which a service is usable.

Resilience: The ability to tolerate faults and continue or recover acceptable operation.

Log: A recorded description of an application or system event.

Metric: A numerical measurement recorded over time.

Trace: A representation of one distributed operation across components.

Span: A timed operation within a distributed trace.

Correlation identifier: An identifier used to connect evidence associated with one operation or business process.

OpenTelemetry: A vendor-neutral framework for generating, collecting and exporting telemetry.

Service-level indicator (SLI): A quantitative measure of a service attribute.

Service-level objective (SLO): A target for an SLI over a defined period.

Service-level agreement (SLA): A formal service commitment, often contractual.

Error budget: The permitted unreliability implied by an SLO.

Cardinality: The number of distinct values in a metric dimension or attribute.

Idempotency: The property that repeating an operation produces the same intended effect as performing it once.

Circuit breaker: A control that temporarily stops calls to an failing or overloaded dependency.

Incident: An event that threatens or degrades expected service operation.

Blameless post-incident review: A structured analysis focused on system conditions and learning rather than individual blame.

Tail sampling: Selecting telemetry after observing enough of a trace to retain significant outcomes such as errors or high latency.

Review Questions

Short Answer Questions

  1. What are the principal differences between logs, metrics and traces?
  2. Why should correlation context be propagated through asynchronous messages?
  3. Distinguish an SLI, an SLO and an SLA.
  4. What is the purpose of an error budget?
  5. Why can uncontrolled retries reduce reliability?

Long Answer Questions

  1. Explain how OpenTelemetry can reduce vendor coupling while supporting distributed observability.
  2. Describe a method for designing a user-centred availability and latency SLO.
  3. Discuss how logs, metrics and traces should be combined during incident diagnosis.
  4. Explain the operational and governance risks of high-cardinality telemetry.
  5. Describe the stages and principles of a blameless post-incident review.

Analytical / Application Questions

  1. A service receives 5,000,000 valid requests in a month, of which 12,500 fail the defined availability test. Calculate availability and determine whether a 99.8% SLO is met. State your assumptions.
  2. A payment workflow has three retries, no idempotency key and a provider that is intermittently timing out. Analyse how this design can amplify failure and propose a safer interaction pattern.
  3. A dashboard shows normal CPU, rising p99 latency and growing queue depth after a deployment. Develop a hypothesis-driven investigation plan using metrics, traces, logs and deployment evidence.

Multiple Choice Questions with Answers

Question 1

Which telemetry type is most suitable for examining the path of one request across several microservices?

A. Metric

B. Trace

C. Gauge

D. Static configuration

Correct Answer: B. Trace

Question 2

An SLO is best described as which of the following?

A. A legal contract in every case

B. A target for a service-level indicator over a defined period

C. A record of every application event

D. A method for encrypting telemetry

Correct Answer: B. A target for a service-level indicator over a defined period

Question 3

For a 99.9% time-based availability SLO, what fraction represents the error budget?

A. 0.1%

B. 0.9%

C. 99.9%

D. 100.9%

Correct Answer: A. 0.1%

Question 4

Which identifier primarily connects spans belonging to one distributed operation?

A. Trace ID

B. Database password

C. Deployment ticket number

D. Metric bucket

Correct Answer: A. Trace ID

Question 5

Why is an unbounded user ID usually a poor metric label?

A. It prevents all metrics from being collected

B. It creates high cardinality and can increase cost

C. It makes counters decrease

D. It automatically encrypts the metric

Correct Answer: B. It creates high cardinality and can increase cost

Question 6

Which practice most directly limits duplicate effects when a message is delivered more than once?

A. Increasing log verbosity

B. Using an idempotency key or idempotent processing

C. Removing all timeouts

D. Increasing metric cardinality

Correct Answer: B. Using an idempotency key or idempotent processing

Question 7

What is a principal advantage of tail sampling?

A. It can retain traces based on observed outcomes such as errors

B. It guarantees that every trace is stored

C. It eliminates the need for instrumentation

D. It measures CPU without collecting telemetry

Correct Answer: A. It can retain traces based on observed outcomes such as errors

Question 8

A month has 10,000,000 valid requests and 9,995,000 good requests. What is the availability?

A. 99.50%

B. 99.90%

C. 99.95%

D. 99.995%

Correct Answer: C. 99.95%

Question 9

Which statement best reflects blameless incident analysis?

A. No individual or system may ever be held accountable

B. The review focuses on system conditions and contributing factors rather than personal blame

C. Only the final error should be documented

D. The review should avoid recording decisions

Correct Answer: B. The review focuses on system conditions and contributing factors rather than personal blame

Question 10

What should normally happen when an error budget is nearly exhausted?

A. Ignore reliability data until the next year

B. Consider reducing risky change and prioritising reliability work

C. Delete historical telemetry

D. Increase all retry counts without analysis

Correct Answer: B. Consider reducing risky change and prioritising reliability work

Serverless Computing & Microservices
Chapter 10 of 15