instrument_gauge (instrument v1.0.0)

View Source

Gauge metric implementation for point-in-time measurements.

A gauge represents a single numerical value that can arbitrarily go up and down. Gauges are typically used for measured values like temperature, current memory usage, or the number of concurrent requests.

Gauges use NIF-based atomic operations for high-performance concurrent updates without locks.

Example

  Gauge = instrument_gauge:new_gauge(temperature, <<"Current temperature">>),
  instrument_gauge:set_gauge(Gauge, 23.5),       % Set to specific value
  instrument_gauge:inc_gauge(Gauge),             % Increment by 1
  instrument_gauge:dec_gauge(Gauge, 0.5),        % Decrement by 0.5
  Value = instrument_gauge:get_gauge(Gauge).

See also: instrument.

Summary

Functions

collect(Info, Ref)

dec_gauge(Metric)

dec_gauge(Metric, Val)

get_gauge(Metric)

inc_gauge(Metric)

inc_gauge(Metric, Val)

new_gauge(Name, Help)

set_gauge(Metric, Val)

with_gauge(Gauge, F)

with_gauge(Gauge, F, V)