OpenTelemetry Metrics

Status: Experimental

Overview

Design Goals

Given there are many well-established metrics solutions that exist today, it is important to understand the goals of OpenTelemetry’s metrics effort:

  • Being able to connect metrics to other signals. For example, metrics and traces can be correlated via exemplars, and metrics attributes can be enriched via Baggage and Context. Additionally, Resource can be applied to logs/metrics/traces in a consistent way.

  • Providing a path for OpenCensus customers to migrate to OpenTelemetry. This was the original goal of OpenTelemetry - converging OpenCensus and OpenTracing. We will focus on providing the semantics and capability, instead of doing a 1-1 mapping of the APIs.

  • Working with existing metrics instrumentation protocols and standards. The minimum goal is to provide full support for Prometheus and StatsD - users should be able to use OpenTelemetry clients and Collector to collect and export metrics, with the ability to achieve the same functionality as their native clients.

Concepts

API

The OpenTelemetry Metrics API (“the API” hereafter) serves two purposes:

  • Capturing raw measurements efficiently and simultaneously.
  • Decoupling the instrumentation from the SDK, allowing the SDK to be specified/included in the application.

When no SDK is explicitly included/enabled in the application, no telemetry data will be collected. Please refer to the overall OpenTelemetry API concept and API and Minimal Implementation for more information.

SDK

The OpenTelemetry Metrics SDK (“the SDK” hereafter) implements the API, providing functionality and extensibility such as configuration, aggregation, processors and exporters.

OpenTelemetry requires a separation of the API from the SDK, so that different SDKs can be configured at run time. Please refer to the overall OpenTelemetry SDK concept for more information.

Programming Model

+------------------+
| MeterProvider    |                 +-----------------+             +--------------+
|   Meter A        | Measurements... |                 | Metrics...  |              |
|     Instrument X +-----------------> In-memory state +-------------> MetricReader |
|     Instrument Y |                 |                 |             |              |
|   Meter B        |                 +-----------------+             +--------------+
|     Instrument Z |
|     ...          |                 +-----------------+             +--------------+
|     ...          | Measurements... |                 | Metrics...  |              |
|     ...          +-----------------> In-memory state +-------------> MetricReader |
|     ...          |                 |                 |             |              |
|     ...          |                 +-----------------+             +--------------+
+------------------+

Specifications

References

  • Scenarios for Metrics API/SDK Prototyping (OTEP 146)