Book Image

Cloud-Native Observability with OpenTelemetry

By : Alex Boten
Book Image

Cloud-Native Observability with OpenTelemetry

By: Alex Boten

Overview of this book

Cloud-Native Observability with OpenTelemetry is a guide to helping you look for answers to questions about your applications. This book teaches you how to produce telemetry from your applications using an open standard to retain control of data. OpenTelemetry provides the tools necessary for you to gain visibility into the performance of your services. It allows you to instrument your application code through vendor-neutral APIs, libraries and tools. By reading Cloud-Native Observability with OpenTelemetry, you’ll learn about the concepts and signals of OpenTelemetry - traces, metrics, and logs. You’ll practice producing telemetry for these signals by configuring and instrumenting a distributed cloud-native application using the OpenTelemetry API. The book also guides you through deploying the collector, as well as telemetry backends necessary to help you understand what to do with the data once it's emitted. You’ll look at various examples of how to identify application performance issues through telemetry. By analyzing telemetry, you’ll also be able to better understand how an observable application can improve the software development life cycle. By the end of this book, you’ll be well-versed with OpenTelemetry, be able to instrument services using the OpenTelemetry API to produce distributed traces, metrics and logs, and more.
Table of Contents (17 chapters)
1
Section 1: The Basics
3
Chapter 2: OpenTelemetry Signals – Traces, Metrics, and Logs
5
Section 2: Instrumenting an Application
10
Section 3: Using Telemetry Data

What this book covers

Chapter 1, The History and Concepts of Observability, provides an overview of the evolution of observability. It describes the challenges and fragmentation that ultimately created the need for an open standard. It provides an overview of both OpenTracing and OpenCensus. The last section of this chapter dives into OpenTelemetry, how it started, and how it got to where it is today. This concepts chapter will provide you with an overview of different concepts vital in understanding OpenTelemetry. This chapter introduces signals before going over the pipeline for generating, processing, and exporting telemetry. The resources section will describe the purpose of resources.

Chapter 2, OpenTelemetry Signals – Traces, Metrics, and Logs, describes the different signals that comprise OpenTelemetry: traces, metrics, and logs. It begins by giving you an understanding of the concepts of distributed tracing by defining spans, traces, and context propagation. The following section explores metrics by looking at the different measurements and the instruments OpenTelemetry offers to capture this information. The section on logging describes how logging fits in with the other signals in OpenTelemetry. Semantic conventions are also covered in this chapter to understand their significance and role in each signal.

Chapter 3, Auto-Instrumentation, explains the challenges of manual instrumentation and how the OpenTelemetry project sets out to solve those challenges. After that, you will dive into the mechanics of auto instrumentation in different languages.

Chapter 4, Distributed Tracing – Tracing Code Execution, begins by introducing the grocery store application we will instrument throughout the book. You will then start using the OpenTelemetry APIs to configure a tracing pipeline and its various components: the tracer provider, span processor, and exporter. After obtaining a tracer, you will instrument code to generate traces. The remainder of the chapter will discuss augmenting that tracing data with attributes, events, links, statuses, and exceptions.

Chapter 5, Metrics – Recording Measurements, teaches you how to capture application metrics. You will begin by configuring the components of a metrics pipeline: the meter provider, meter, and exporter. The chapter then describes the instruments available in OpenTelemetry to collect metrics before using each one in the context of the grocery store application.

Chapter 6, Logging – Capturing Events, covers logging, the last of the core signals of OpenTelemetry discussed in this book. The chapter walks you through configuring the components of the logging pipeline to emit telemetry. You will then use existing logging libraries to enhance logged events through correlation with OpenTelemetry.

Chapter 7, Instrumentation Libraries, teaches you how to use instrumentation libraries to instrument the grocery store application automatically after learning how to do so manually. Using auto instrumentation and environment variables supported by OpenTelemetry, this chapter shows you how to obtain telemetry from your code quickly.

Chapter 8, OpenTelemetry Collector, explores another core component that OpenTelemetry provides: the OpenTelemetry Collector. The Collector allows users to collect and aggregate data before transmitting it to various backends. This chapter describes the concepts present in the Collector, presents its use cases, and explains the challenges it solves. After learning about the OpenTelemetry Protocol (OTLP), you will modify the grocery store application to emit telemetry to the collector via OTLP.

Chapter 9, Deploying the Collector, puts the OpenTelemetry Collector to work in a Kubernetes environment in various deployment scenarios. You will use Kubernetes to deploy the Collector as a sidecar, agent, and gateway to collect application-level and system-level telemetry.

Chapter 10, Configuring Backends, teaches you about various open source telemetry backend options to store and visualize data. This chapter explores using OpenTelemetry with Zipkin, Jaeger, Prometheus, and Loki utilizing a local environment. You will configure exporters in application code and the OpenTelemetry Collector to emit data to these backends. After instrumenting and collecting all the telemetry from applications, it's finally time to start using this information to identify issues in a system.

Chapter 11, Diagnosing Problems, dives into techniques used to correlate data across the different OpenTelemetry signals to identify the root cause of common problems in production effectively. This chapter introduces you to chaos engineering and tools to generate synthetic loads and service interruptions to produce different scenarios.

Chapter 12, Sampling, explains the concept of sampling and how it applies to distributed tracing. Head, tail, and probability sampling strategies are introduced in this chapter. You will configure sampling using the OpenTelemetry APIs and the OpenTelemetry Collector, comparing the results of different sampling configurations.