instrument_counter (instrument v1.0.0)
View SourceCounter metric implementation with monotonically increasing semantics.
A counter is a cumulative metric that can only increase. It is typically used to count requests served, tasks completed, or errors occurred.
Counters use NIF-based atomic operations for high-performance concurrent updates without locks.
Example
Counter = instrument_counter:new_counter(requests, <<"Total requests">>),
instrument_counter:inc_counter(Counter), % Increment by 1
instrument_counter:inc_counter(Counter, 10), % Increment by 10
Value = instrument_counter:get_counter(Counter).See also: instrument.