liveBook · Manning

OpenTelemetry

As explained in Secure APIs

OpenTelemetry is an open-source, vendor-neutral observability framework that defines APIs, SDKs, and conventions for generating, collecting, and exporting telemetry.

OpenTelemetry (OTel) is an open-source, vendor-neutral observability framework for generating, collecting, and exporting telemetry. Its signals—logs, traces, and metrics—make API behavior easier to understand, diagnose, and monitor for threats. section 11.2 section 11.7

Use each signal for a different kind of operational question:

  • Logs record individual events, such as incoming requests and raised errors. section 11.2
  • Traces connect the processing steps and logs belonging to one request through a shared trace ID. section 11.2
  • Metrics aggregate behavior, such as request counts and response latency, revealing unusual trends and endpoint-abuse patterns. section 11.6 section 11.7

Counting repeated calls to an endpoint

A FastAPI service can create an OTel meter and counter for GET /books, then increment the counter on each request. Comparing requests per minute with normal activity can reveal scraping or enumeration; investigate an alert before applying rate limiting. section 11.6

Figure 11.2 Every step in processing an API request may raise a log for our records. Without something to correlate the logs, it’s difficult to connect them all and get the full picture.
figure

Use the figure to see why separate request logs are difficult to interpret without correlation, and why traces provide a fuller processing picture. section 11.2

How Secure APIs covers it

How deep it goes
Defines OTel, distinguishes its signals, and demonstrates autoinstrumentation and custom metrics without descending into SDK internals.
Examples
Uses a FastAPI service, a GET /books counter, trace logs, and endpoint-abuse detection as concrete examples.
What it assumes
Assumes an API application and teaches logs, traces, metrics, and instrumentation as foundational observability concepts.
What you can do after
Apply it via OTel instrumentation to collect signals, correlate requests, measure endpoint use, and investigate suspicious activity.
How it connects
Connects observability with logs, traces, metrics, instrumentation, anomaly detection, and rate limiting.

Also explained in

Compare how 7 books explain OpenTelemetry →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secure APIs. The section links point to the parts of the book it draws on.