Module logi_prometheus_sink

A logi sink for collecting prometheus metrics.

Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>

Behaviours: logi_sink_writer.

Description

A logi sink for collecting prometheus metrics.

This exposes metrics that count the number of log messages sent to a channel.

EXAMPLE

  %% Installs `metrics_sink` to the default channel.
  > Sink = logi_prometheus_sink:new(metrics_sink, [{registry, example_registry}]).
  > {ok, _} = logi_channel:install_sink(Sink, info).
 
  %% Logs a message.
  > logi:info("foo").
 
  %% Prints metrics.
  > io:format(prometheus_text_format:format(example_registry)).
  # TYPE logi_messages_total counter
  # HELP logi_messages_total Messages count
  logi_messages_total{sink="metrics_sink",severity="info",application="stdlib",module="erl_eval"} 1

Function Index

new/1Equivalent to new(Id, []).
new/2Creates a new sink instance.

Function Details

new/1

new(LoggerId::logi:logger_id()) -> logi_sink:sink()

Equivalent to new(Id, []).

new/2

new(LoggerId::logi:logger_id(), Options) -> logi_sink:sink()

Creates a new sink instance

OPTIONS

sink_id:
- The identifier of this sink.
- The default value is logi_prometheus_sink.

registry:
- The prometheus registry to which metrics will be registered.
- The default value is default.


Generated by EDoc, Oct 28 2017, 00:52:15.