Current section
Files
Jump to
Current section
Files
lib/vmstats_ex/sink.ex
defmodule VmstatsEx.Sink do
@behaviour :vmstats_sink
# From https://github.com/ferd/vmstats#vmstats_sink-behaviour
# -callback collect(Type :: counter | gauge | timing,
# Key :: iodata(),
# Value :: term()) -> ok.
def collect(type, key, value) when is_number(value) do
apply(VmstatsEx.Statix, translate_type(type), [key, value])
end
defp translate_type(:counter), do: :increment
defp translate_type(type), do: type
end