Skip to main content

Foundations of Observability

Published 13 min readMarkdown

This first section of the course introduces the foundations of observability by starting with the evolution of application architecture.

Monolithic Architecture

In the early days, web applications were typically built using what is known as a monolithic architecture.

In this model, all the components of an application โ€” for example, payment processing, user registration, and the shopping cart โ€” were combined into one large codebase.

The frontend (such as JavaScript, CSS, HTML) and the backend business logic were all developed together in a single project. Everything ran on a single database.

However, this architecture had its downsides.
If you wanted to make a small change and deploy it to the production environment, you had to deploy the entire application.
This made it difficult and time-consuming to implement frequent or minor improvements.
Teams could only focus on developing one part of the system at a time, and working on multiple features in parallel was challenging.

Microservices Architecture

Over time, the industry moved toward a more flexible approach known as Microservices Architecture.

With microservices, the application is broken into small, independent services, and each service has its own separate database or storage.
The user interface is also kept separate from the backend services.

The key advantages of this approach are:

  • Small updates can be deployed independently, without needing to redeploy the whole system.

  • Different teams can work on different services at the same time, enabling faster development.


From a DevOps perspective, we can compare:

  • Monolithic architecture to the traditional Waterfall methodology.

  • Microservices architecture to CI/CD (Continuous Integration and Continuous Delivery).

In Waterfall, the software cannot be released until it is fully completed. The process is done step by step: gather requirements โ†’ analyze โ†’ design โ†’ develop โ†’ test โ†’ deploy.

What is the Waterfall software development methodology and is it ...

But in CI/CD, we plan small changes, implement them quickly, build, test, release, deploy โ€” and repeat the cycle frequently.

What is CI/CD?

The Role of the CI/CD Pipeline in Cloud Computing - Civo.com

The goal is to keep this cycle short and continuous, rather than waiting to finish an entire system before deployment.

Observability

So, how does all this relate to Observability?

In a microservices environment, you're not managing one large app โ€” you're managing many small services.
This increases the chance that something can go wrong, such as:

  • A service breaking down.

  • Communication between services failing (via messages or API calls).

  • Security threats, since having more services also means a larger attack surface.

Similarly, with CI/CD, you are deploying changes frequently.
Every deployment introduces a risk of failure.
Because of this, itโ€™s essential to have strong observability โ€” meaning the ability to monitor and understand whatโ€™s happening in your system in real-time.

Observability helps you catch problems early, understand failures, and ensure the system continues to run smoothly even as changes are made often.


๐Ÿ’ก What is Monitoring?

Monitoring is the process of collecting and visualizing data about a system during its runtime โ€” meaning, while itโ€™s actively running.
The goal is to check and track the systemโ€™s health, making sure everything works as expected.

Good monitoring helps us answer three important questions:

  1. Is the service running?

  2. Is it working as expected?

  3. Is it performing well?


๐Ÿš— A Simple Analogy: The Car Dashboard

Think of a carโ€™s dashboard.

  • If the engine RPM is above zero, then we know the engine is on โ†’ โœ… The service is running.

  • If the car is moving at 50km/h, then itโ€™s doing what itโ€™s supposed to โ†’ โœ… It functions as expected.

  • But if the engine warning light is on and there are other error indicators, then โ†’ โš ๏ธ It may not be performing well, even though itโ€™s still running and moving.


๐ŸŒ Example with a Real Website: "Save the Koala"

Letโ€™s now apply these 3 questions to a real system โ€” the website of the Australian Koala Foundation https://savethekoala.com/ called Save the Koala.

1. Is the service on?

We can check by sending an HTTP GET or HEAD request to the site.
If it responds with a status code 200 OK, it means the site is up and running.

curl -o /dev/null -s -w "%{http_code}\n" https://savethekoala.com/

2. Is the service functioning as expected?

Let's assume the site uses Python on the backend.

  • This is an internal check that requires access to the server's logs to "monitor and record Python errors."

  • Error Logging: The Python application on the server should be set up to log errors to a file or a logging service.

  • Log Monitoring: We use a log management system like Elastic Stack, Splunk, or Datadog to monitor and record Python errors. If the errors stay below a certain threshold (e.g., fewer than 5 errors per minute), we can consider the system to be working properly.

3. Is the service performing well?

This relates to response time.
For example, if an HTTP GET request returns in 20 milliseconds or less, we might say the system is performing well.

curl -o /dev/null -s -w "Total Time: %{time_total}s\n" https://savethekoala.com/

A Simple Python example (monitor.py) - checking if the service is on and how well it is performing.

import requests
import time

def check_website(url):
    try:
        start_time = time.time()
        response = requests.get(url, timeout=5)  # Set a timeout for the request
        end_time = time.time()

        response_time_ms = (end_time - start_time) * 1000

        print(f"Checking URL: {url}")

        # Check if the service is on (Status Code)
        if response.status_code == 200:
            print(f"1. Is the service on? - YES (Status Code: {response.status_code})")
        else:
            print(f"1. Is the service on? - NO (Status Code: {response.status_code})")

        # Check if the service is performing well (Response Time)
        performance_threshold_ms = 20  # Your threshold
        if response_time_ms <= performance_threshold_ms:
            print(f"3. Is the service performing well? - YES (Response Time: {response_time_ms:.2f} ms)")
        else:
            print(f"3. Is the service performing well? - NO (Response Time: {response_time_ms:.2f} ms)")

    except requests.exceptions.RequestException as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    website_url = "https://savethekoala.com/"
    check_website(website_url)

Output:

py monitor.py
Checking URL: https://savethekoala.com/
1. Is the service on? - YES (Status Code: 200)
3. Is the service performing well? - NO (Response Time: 2517.09 ms)

๐Ÿ“Š Telemetry Data

The data collected for monitoring is called Telemetry Data.

  • It helps identify where a problem is happening or might happen, but it doesn't diagnose the problem.

In microservices-based systems, which consist of many small parts working together, telemetry data can indicate where the problem might be.


๐Ÿ“ˆ Key DevOps Metrics

In DevOps, there are two especially important metrics for monitoring success:

1. Mean Time to Detection (MTTD)

MTTD is the amount of time, on average, between the start of an issue and when teams become aware of it.

2. Mean Time to Resolution (MTTR)

MTTR is the average amount of time between when an issue is detected, and when the systems are fixed and operating normally.

Both MTTD and MTTR are critical indicators of a team's efficiency in handling incidents.


๐Ÿ“Š What Metrics Should We Collect for Monitoring?

Now that we understand what monitoring is, the next important question is:

Which metrics should we collect to monitor our system effectively?

Collecting random or irrelevant data wonโ€™t help. We need meaningful, structured metrics that reflect the health and performance of each part of our system.


๐Ÿ—๏ธ Layers of a Microservices-Based Application

A typical microservices-based system can be divided into three main layers:

  1. UI Layer โ€“ Where users interact via websites or mobile apps.

  2. Service Layer โ€“ Where the microservices (like cart service, promotion service, payment service, fulfillment service, etc.) live.

  3. Infrastructure Layer โ€“ Which provides the resources (CPU, memory, disk, network) that the services depend on.


๐Ÿ” Monitoring Methods by Layer

We use different monitoring frameworks for each layer:

MethodCoversDescription
REDService Layer & some UIFocused on request/response behavior
USEInfrastructure LayerFocused on resource usage
Four Golden SignalsService & InfraGoogleโ€™s recommended core metrics
Core Web VitalsUI LayerGoogleโ€™s web performance metrics

๐Ÿ“• RED Method (Request-driven)

RED stands for:

  • R โ€“ Rate: Number of requests per second (e.g., 2 million req/sec).

  • E โ€“ Errors: Number of failed requests (e.g., HTTP 500s or fatal service errors).

  • D โ€“ Duration: Response time or latency of each request.

๐Ÿ” This method is great for measuring how well your services are handling requests.


โš™๏ธ USE Method (Resource-driven)

USE stands for:

  • U โ€“ Utilization: How much of a resource is used (e.g., CPU % or disk %).

  • S โ€“ Saturation: When resources are fully consumed and start queuing (e.g., 100% network usage causes packet delays).

  • E โ€“ Errors: Hardware or system-level errors (e.g., disk write failures).

โœ… Ideal values: Low utilization, zero saturation, zero errors.


๐Ÿ›‘ Four Golden Signals (by Google)

Google introduced the Four Golden Signals in its Site Reliability Engineering (SRE) Handbook.
If you can only monitor 4 things in a user-facing system, monitor:

  1. Latency โ€“ Response time of the system

  2. Traffic โ€“ Request volume or throughput

  3. Errors โ€“ Failure rate

  4. Saturation โ€“ Resource limits being hit

๐Ÿ’ก In essence: RED + Saturation = Four Golden Signals.


๐ŸŒ Core Web Vitals (UI/Frontend Performance)

Core Web Vitals are performance metrics introduced by Google, specifically for websites, and focus only on the user interface layer.

  1. Largest Contentful Paint (LCP)

    • Measures load time perception โ€” how long it takes until the main content is visible to the user.
  2. First Input Delay (FID)

    • Measures interactivity โ€” how fast the page reacts when a user tries to interact (like typing into a form).
  3. Cumulative Layout Shift (CLS)

    • Measures visual stability โ€” how much the layout shifts unexpectedly during load.

โš ๏ธ These vitals are important for SEO (Search Engine Optimization).
If your Core Web Vitals score is poor, Google may rank your website lower in search results.


๐Ÿ” Summary

Each layer of your system requires different kinds of monitoring:

LayerMethodWhat to Track
UICore Web VitalsUser experience and responsiveness
ServicesRED / Golden SignalsRequests, errors, latency
InfrastructureUSE / Golden SignalsCPU, memory, network usage and limits

Collecting the right metrics helps you not only monitor but also understand and improve your system's performance and reliability.


๐Ÿ” Monitoring vs. Observability

Now that weโ€™ve learned about monitoring, letโ€™s explore a broader and more powerful concept: observability.


โœ… Monitoring vs. Observability: Are They Different?

Yes โ€” but not in a conflicting way.

Monitoring is a subset of observability.
Monitoring is necessary, but not enough on its own in modern distributed systems.


๐Ÿ› ๏ธ Whatโ€™s the Difference?

๐Ÿ”ง Monitoring:

  • Is predefined โ€” you must know in advance what you want to monitor (e.g., CPU usage, memory, uptime).

  • Is typically used to detect known issues and verify if the system is working as expected.

  • Works well in monolithic architectures, where failure points are more predictable.

  • Answers:

    • Is the system working?

    • Where and when did the problem occur?

๐ŸŒ Observability:

  • Helps you discover unknown problems โ€” including those you didnโ€™t anticipate.

  • Provides a complete view of the system by analyzing multiple types of data (metrics, logs, traces).

  • Helps in modern, complex systems (like microservices) where components are distributed and interconnected.

  • Answers:

    • Why did the issue happen?

    • What might break next?


๐Ÿš— Analogy: The Car Dashboard

Letโ€™s go back to our car dashboard example:

  • The dashboard lights (e.g., engine light, battery warning) are like monitoring alerts โ€” they show you something is wrong.

  • But they donโ€™t tell you why itโ€™s happening.

To find the root cause, you take the car to a mechanic.
The mechanic connects a diagnostic device (e.g., via ODB port) to pull detailed data from the carโ€™s systems.

This extra data helps them identify the root cause โ€” just like observability tools do for complex software systems.


๐Ÿ“Š Summary Table

FeatureMonitoringObservability
PurposeDetect known issuesDiscover unknown issues
SetupPredefined metricsOpen-ended data analysis
ScopeNarrow (what you chose to monitor)Broad (system-wide signals)
Answersโ€œIs it working?โ€ / โ€œWhere did it break?โ€โ€œWhy did it break?โ€ / โ€œWhat could go wrong next?โ€
Best ForMonolithic systemsMicroservices / Distributed systems
Tool ExampleCPU/memory dashboards, alertsLogs, traces, metrics, unified platforms (e.g., OpenTelemetry, Datadog)

๐Ÿ”ฎ The Power of Observability

Observability allows you to:

  • Understand the โ€œunknown unknownsโ€ โ€” problems you didnโ€™t plan for.

  • Detect root causes faster โ€” not just symptoms.

  • Predict and prevent failures โ€” using correlated data across layers.

Itโ€™s not just about collecting more data โ€” itโ€™s about collecting the right data and being able to analyze it meaningfully.


๐Ÿ“ก What Types of Telemetry Data Are Collected in Observability?

Now that we've covered what observability is, letโ€™s look at the types of telemetry data we collect in an observability platform.

To easily remember these, think of the acronym: MELT:

  • M = Metrics

  • E = Events

  • L = Logs

  • T = Traces

Each type provides different insights and is valuable for understanding system behavior.


๐Ÿ”” Events

An event is a specific action that occurred at a particular point in time.

๐Ÿงƒ Example:

Imagine your system is a vending machine.
If a customer buys a bag of chips at 3:20 PM, thatโ€™s an event:

  • The action = purchase

  • The timestamp = 3:20 PM

๐Ÿ“Œ Events often flow through event streaming platforms like Apache Kafka, especially in microservices, where services communicate by sending events to each other.

You can also generate custom events within your observability tools โ€” they help confirm that an expected action actually happened.


๐Ÿ“ˆ Metrics

A metric is a numerical, aggregated value that summarizes events over time.

๐Ÿ“Š Example (vending machine again):

  • "100 bags of chips were purchased every minute" โ€” thatโ€™s a metric.

  • It gives you a trend or pattern over time.

Metrics are useful for:

  • Comparing performance (e.g., โ€œThis week vs. last weekโ€)

  • Identifying performance drops (e.g., sales fell from 200 to 100 per minute)

Metrics help you quantify your system's health and behavior.


๐Ÿ“„ Logs

A log is a detailed record of an event โ€” with context.

๐Ÿ“‹ Example:

Instead of just saying a chip was purchased, a log might say:

โ€œAt 3:20 PM, a $2 bag of chips was purchased using Mastercard from vending machine ID: X, located in Sydney.โ€

๐Ÿ›  Logs are valuable because they include:

  • What happened

  • Where it happened

  • How it happened

  • With what data

Logs are often used during troubleshooting or when a more detailed view of the system's behavior is needed.


๐Ÿ” Traces

A trace follows a requestโ€™s full journey through multiple services in a microservices-based system.

๐Ÿ”„ Example:

If a customer buys chips with a credit card:

  1. Vending machine collects card info

  2. Sends info to the bank

  3. Bank contacts Mastercard

  4. Mastercard responds to the bank

  5. Bank responds to the vending machine

  6. Chips are dispensed

This entire flow is a trace.

๐Ÿ“Œ If something goes wrong (e.g., slow response, timeout), tracing shows exactly where the failure or delay occurred.

Traces help:

  • Diagnose latency issues

  • Visualize service-to-service communication

  • Identify bottlenecks or fail points


๐Ÿง  Summary: MELT

TypePurposeExample
MetricAggregated performance data over timeโ€œ100 purchases per minuteโ€
EventA single, timestamped actionโ€œOne bag of chips purchased at 3:20 PMโ€
LogDetailed record of an eventโ€œBag of chips ($2), paid with Mastercard, from machine Xโ€
TraceRequest path across servicesFlow from vending machine โ†’ bank โ†’ Mastercard โ†’ back

Using MELT data together gives you a complete, observable view of your system โ€” from high-level trends down to specific technical errors and root causes.

More from this blog