exmetrics v1.1.0 Exmetrics.Histogram
Provides histograms based on hdr_histogram.
Use a histogram to track the distribution of a stream of values (e.g., the latency associated with HTTP requests).
Before loading data from a histogram, create a snapshot via Exmetrics.snapshot/0.
Summary
Functions
Specs
new(String.t, integer, integer) :: atom
Create a new histogram.
iex> Exmetrics.Histogram.new "sample_histogram", 1000000, 3
:ok
iex> Exmetrics.Gauge.get "sample_histogram.P50"
0.0
# Record some values
iex> Enum.each 0..100, &(Exmetrics.Histogram.record "sample_histogram", &1)
:ok
# A snapshot is required before histogram values are up to date
iex> Exmetrics.snapshot
iex> Exmetrics.Gauge.get "sample_histogram.P50"
50.0
Specs
record(String.t, integer) :: atom
Record a value in a histogram.
iex> Exmetrics.Histogram.new "h2", 1000, 3
:ok
iex> Exmetrics.Histogram.record "h2", 5
iex> Exmetrics.snapshot
iex> Exmetrics.Gauge.get "h2.Max"
5
Specs
remove(String.t) :: atom
Remove histogram and clear resources.
iex> Exmetrics.Histogram.new "h3", 1000, 3
:ok
iex> Exmetrics.Histogram.remove "h3"
:ok
iex> Exmetrics.Gauge.get "h3.Count"
nil