Observability: What, Why and How
Published: 2023-10-15 03:27:41

## What is Observability?

**Observability** is a fundamental concept in the realms of software engineering, DevOps, and systems administration. It revolves around the idea of gaining insight into the internal state of a system by examining the data it generates and emits. **At its core, observability is about understanding what is happening within a system based on the outputs it produces.**

In simpler terms, consider it as a set of tools and practices that allow you to decipher the inner workings of your applications, services, and infrastructure by examining the signals they emit. The more observable your system is, the more swiftly and accurately you can traverse from identifying a problem to pinpointing its root cause and eventually resolving it.

It's important to note that observability goes beyond mere buzzwords or a fancy term for monitoring. It represents an evolutionary step in addressing the unique challenges posed by modern distributed systems. As applications become increasingly complex and interconnected, traditional monitoring methods often fall short in providing the depth of insights required to maintain and optimize these intricate ecosystems.

---


## Why do you need Observability?

**Monitoring** is the practice of vigilantly watching over your systems to detect specific scenarios or conditions, both desirable and undesirable. It's the guardian that keeps an eye on the known unknowns—the issues you are aware of and can anticipate. 
Monitoring is a crucial first step in ensuring system reliability and performance.

However, in the complex and dynamic landscape of modern software and infrastructure, where systems are constantly changing and evolving, monitoring alone may fall short. These systems often present a myriad of **unknown unknowns**—issues that you neither know exist nor can predict. This is where **observability** comes into play.

**Example:**
Imagine you have a complex microservices architecture powering your e-commerce platform. Your monitoring tools have been diligently watching for known issues like high CPU usage or excessive memory consumption. However, you start receiving customer complaints about slow checkouts, and your monitoring tools haven't triggered any alerts.

With observability, you dig deeper into the system. You find that the payment service was sometimes experiencing significant delays for specific transactions. By your telemetry data, you discover that these delays are caused by external payment gateway timeouts during high traffic spikes—a scenario not explicitly monitored for.

Armed with this newfound knowledge, you implement adaptive strategies to handle these external service hiccups gracefully, ensuring a smoother shopping experience for your customers. This proactive approach to addressing unknown unknowns is a key strength of observability.

**Observability builds on top of monitoring**, extending your capability to navigate the intricate terrain of your systems. It equips you with a flexible and holistic view of your system's behavior and performance. While monitoring focuses on what you expect to see, observability empowers you to explore what's happening within your system, even when you don't have predefined expectations.

With observability, you can delve deep into your applications, services, and infrastructure, uncovering insights that would otherwise remain hidden. It enables you to swiftly and effectively trace the root cause of any problem, be it an unexpected performance dip or a mysterious error.

In essence, observability transforms your system management from a reactive stance, where you address known issues, to a proactive approach, where you anticipate and mitigate the unknowns that can impact your operations and user satisfaction.

![Ice berg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pfmd6gvxm1585z3ggti5.png)

---

## How do you achieve Observability?

To achieve observability, you must understand the fundamental building blocks of application observability: **metrics, traces, and logs**. 
These components provide crucial telemetry data to help you gain insights into your system's behavior

### Metrics
- Metrics are time-series data that represent counts or measures, typically calculated or aggregated over time intervals.
- Anything that can be measured or tracked as a number can be collected as a metric.
- Some examples include response time, request counts, CPU usage, memory consumption, error rates, and latency, resource health. 
- Metrics are useful for identifying trends and generating alerts.

### Traces
- Traces offer a detailed record of the journey of a request as it traverses through your distributed architecture. 
- They provide visibility into how services interact and process requests, along with causal ordering to pinpoint issues in complex systems. 
- Traces are indispensable for troubleshooting and pinpointing issues.

### Logs
- Logs are print statements in a structured format that capture important events and actions in your system. 
- They offer a chronological view of system activities at a granular level. 
- Logs are timestamped and immutable records that help create audit trails.
- They are very useful in providing context regarding an event.

![metrics-logs-traces](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ziz1orgwgjk5tegfc92z.jpg)

Instrumenting your code to generate and collect these telemetry data types from your system components is a fundamental step toward achieving application observability.

But to effectively utilize your observability data, you need tools and platforms that can store, analyze, and visualize it in a meaningful way.

Some of the tools you can use for telemetry data collection:
- Metrics: [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/), [Memir](https://grafana.com/docs/mimir/latest/get-started/)
- Traces: [Jaegar](https://www.jaegertracing.io/docs/1.49/getting-started/), [Zipkin](https://zipkin.io/pages/quickstart.html), [Tempo](https://grafana.com/docs/tempo/latest/getting-started/)
- Logs: [Logstash](https://www.elastic.co/getting-started), [Loki](https://grafana.com/docs/loki/latest/get-started/), [Serilog](https://serilog.net/)

For analytics and visualization: [Grafana](https://grafana.com/grafana/), [Kibana](https://www.elastic.co/kibana)

![observability tools](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsigbrktembxyxu99c1q.jpg)

While some tools specialize in specific areas, such as metric collection, log management, or tracing, managing various tools for these purposes can be overwhelming.

To address this challenge, the concept of full-stack observability platforms has emerged. These platforms provide end-to-end visibility into your system's behavior and performance. They come equipped with their own agents that you install within your code or applications to gather all the telemetry data effectively.

Notable examples of full-stack observability platforms include:
- [Dynatrace](https://www.dynatrace.com/)
- [New Relic](https://newrelic.com/)
- [Splunk](https://www.splunk.com/)
- [Datadog](https://www.datadoghq.com/)
- [Elastic Stack](https://www.elastic.co/)
- [Grafana LGTM Stack](https://grafana.com/)

These full-stack observability platforms streamline the observability process by unifying telemetry data generation, storage, and visualization.

---


## How do you get started with Observability?

Chances are, you're already dabbling in observability, perhaps with a few `console.log` or **print** statements scattered throughout your code. These initial steps are indeed a form of observability, providing some insights into your system's behavior. 
But why stop there? Observability can be taken to a whole new level by embracing structured and comprehensive tools and practices.

You can start by choosing an observability platform or tool that suits your needs and budget. You can also explore the open-source options like Prometheus, Jaeger, Elastic, Grafana stack etc.

You should not stop at getting started as observability is not a one-time endeavor. It's an ongoing process that requires continuous learning and adaptation. As your system evolves, so should your observability strategy and practices. 

Take your observability game a step further by adopting an approach known as Observability-Driven Development (ODD). ODD encourages a cultural shift from reactive to proactive problem-solving by empowering developers to take ownership of observability. Instead of thinking about observability when issues arise, weave it into your code from the very start of development.

**_In today's AI-driven world, collecting data from your system is crucial to creating AI models that can help automate and streamline your operational workflows. Hence, if you want to unlock the full potential of AIOPs (Artificial Intelligence for IT Operations), observability is not an optional feature; it’s an essential requirement._**

---

## References
https://dev.longy.cloud/whats-the-difference-between-observability-and-monitoring
https://dev.to/argonaut/top-20-observability-tools-every-startup-should-know-about-in-2022-29nf