View Source InfluxTelemetryReporter (influx_telemetry_reporter v0.1.2)
A reporter that writes the events in the influx_writer.
- You have to bring your own InfluxDB writer when using this lib. We suggest fluxter.
- This Reporter ignores the metric type(summary, count and etc) and simply writes the report to influxdb.
This GenServer could be used in a Supervisor like:
defmodule MyApp.Telemetry do
use Supervisor
import Telemetry.Metrics
def start_link(arg) do
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
end
@impl true
def init(_arg) do
children = [
{InfluxTelemetryReporter, metrics: metrics(), influx_writer: &MyApp.Fluxter.write/3}
]
Supervisor.init(children, strategy: :one_for_one)
end
def metrics do
[
summary("vm.memory.total",
unit: {:byte, :kilobyte},
description: "measurement of the memory used by the Erlang VM"
)
]
end
by that it attaches itself to the events described in the metric and report the events to influxdb. Read more about metrics at https://hexdocs.pm/telemetry_metrics/Telemetry.Metrics.html
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Starts the GenServer and attaches to the telemetry events
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Starts the GenServer and attaches to the telemetry events
Expected options:
:influx_writer
: a function that implementsFluxter.write/3
callback:metrics
: list of metricsTelemetry.Metrics.t/0