- name: the instrument identifier, e.g.
http.requests_total. - unit: the measurement unit, e.g.
"1"for a simple count. - description: a human-readable explanation of what the instrument measures.

- Instrument name: identifies what is being measured (for example,
request_countorhttp.requests_total). - Kind: determines the instrument behavior (Counter, Gauge/ObservableGauge, Histogram, UpDownCounter, and their async counterparts).
- Unit and description: give context so humans and backends can interpret values correctly.
- Advisory hints: optional guidance such as explicit histogram bucket boundaries.

Asynchronous callbacks typically run without an active trace/span context. Do not rely on trace context inside asynchronous callbacks—design async metrics to be context-independent.
- Counter (synchronous)
- Records increases only (monotonic).
- Synchronous: can be associated with the current trace/span and context.
- Use for counting events such as completed orders, processed requests, or errors in real time.
- Aggregation: sum.

- Asynchronous Counter
- Callback-based: the SDK invokes a function at collection time to obtain a reported value.
- Monotonic: typically used to represent cumulative totals (depending on how the callback reports the metric).
- No guaranteed context association during callback execution.
- Use for metrics like total bytes transmitted since process start, where continuous synchronous updates are unnecessary.

- Histogram (synchronous)
- Records arbitrary values (not restricted to monotonic increases).
- Produces statistical summaries such as percentiles and distributions (backends compute percentiles from histogram aggregates).
- Useful for response times, payload sizes, or any measurement where distribution matters.
- Aggregation: histogram (bucketed distribution).

- Gauge (last-value snapshot)
- Represents a current state or snapshot (values can go up or down).
- Non-additive and typically uses last-value aggregation.
- In OpenTelemetry, gauges are commonly implemented as observable (asynchronous) instruments reported via callbacks (ObservableGauge). Some SDKs may also offer last-value synchronous instruments—behavior and context association depend on the SDK.
- Ideal for CPU usage, memory usage, queue length, active user counts, or any value representing current state.

-
Asynchronous Gauge
- Callback-based snapshot collected on demand (ObservableGauge).
- No guaranteed context association during callback execution.
- Use for periodically sampled readings such as disk space remaining, battery level, thread count, temperature, or humidity.
-
UpDownCounter (synchronous)
- Supports both increments and decrements (non-monotonic).
- Additive aggregation (sum), but values can go up or down.
- Synchronous version supports context association.
- Use for dynamic counts like queue sizes, active connections, or concurrent requests.

- Asynchronous UpDownCounter
- Callback-based, reports additive snapshots but values can increase or decrease (ObservableUpDownCounter).
- No guaranteed context association during callback execution.
- Use cases: number of running processes, open file descriptors, connected clients—metrics collected periodically via a callback.

| Instrument | Behavior | Aggregation | Typical use cases |
|---|---|---|---|
| Counter (sync) / Async Counter | Additive, monotonic. Sync is context-aware; async is callback-based. | Sum | Event counts, total requests, bytes transmitted |
| Histogram (sync) | Non-additive, non-monotonic; records distributions | Histogram (bucketed) | Latencies, payload sizes, response time distributions |
| Gauge (ObservableGauge) | Non-additive, non-monotonic; last-value snapshot | Last-value | CPU, memory, queue length, live counts |
| UpDownCounter (sync) / Async UpDownCounter | Additive but non-monotonic; sync supports context | Sum | Queue size, active connections, running processes |
Choose the instrument that matches how you want the metric to behave and how your backend will aggregate it:
- Counter: count occurrences over time (monotonic sum).
- UpDownCounter: counts that can increase or decrease (e.g., active sessions).
- Gauge / ObservableGauge: current-state snapshots (last-value).
- Histogram: distributions and percentiles (latencies, sizes).
- OpenTelemetry Metrics specification: https://opentelemetry.io/docs/reference/specification/metrics/
- OpenTelemetry Python metrics API: https://opentelemetry.io/docs/instrumentation/python/
- For aggregation and backend behavior, consult your metrics backend documentation (e.g., Prometheus, OTLP-compatible backends).