🟦 Manual Instrumentation - Metrics
OpenTelemetry have the API and the SDK.
- Metrics API provides the interfaces
- OpenTelemetry SDK have MeterProvider that implements the logic of the metrics signal.
- First obtain a Meter which is used to create different types of instruments that report measurements
- After producing data, we must define a strategy for how metrics are sent downstream.
- A MetricReader collects the measurements of associated instruments.
- The paired MetricExporter is responsible for getting the data to the destination.
🟩 Metrics
Meter produce a set of instruments . An instrument reports measurements. which represent a data point reflecting the state of metric at a particular point in time. A data point are the aggregated values of measurements over a period of time.
Create and use synchronous/asynchronous instruments. Instruments are generally created once at the module or class level and then used inline with business logic.
Metric Signal. Ref: Linux Foundation course OpenTelemetry

Different instruments (Synch or Asynch)
- Creating and using synchronous instruments, used inline with application/business processing logic, like when handling a request or calling another service.
- Creating and using asynchronous instruments, give the user a way to register callback functions, which are invoked on demand to make measurements.
Instrument Types
- Counter: Used for increasing values monotonically. ExL Total no of requests
- UpAndDownCounters: Track values for both increase or decrease. Ex: no of active connection to database
- Gauge: state of a value at a given time
- Histogram: used to analyze the distribution of how frequently a value occurs, which can help identify trends or anomalies in the data. Ex: analyze the latency as latency for a service is important and easy that calculating latency for each span. Ideally Histogram is ideal for Latency.
Note: Each type of instruments except histogram have both Synchronous and Asynchronous variant.
Creating Instruments
Meters produce a set of instruments, which reports measurements represents a data input reflecting the state of a metric at a particular point in time.
Golden Signals
The 4 golden signals according to Google (SRE) - Latency, Traffic, Errors & Saturations. Ref: Google SRE
✅ Next Chapter: Sampling
✅ Main Page: Click Here