View Source TelemetryMetricsLogger (telemetry_metrics_logger v0.1.3)

A reporter that prints events to the Logger.

This module aggregates and prints metrics information at a configurable frequency.

For example, imagine the given metrics:

metrics = [
  last_value("vm.memory.binary", unit: :byte),
  counter("vm.memory.total"),
  summary("phoenix.endpoint.stop.duration", unit: {:native, :millisecond})
]

A this reporter can be started as a child of your supervision tree like this:

{TelemetryMetricsLogger, metrics: metrics, reporter_options: [interval: 60]}

Then, every sixty seconds, you will see a report like this:

12:31:54.492 [info]  Telemetry report 2020-11-09T17:48:00Z
  Event [:vm, :memory]
    Measurement "binary"
      Last value: 100 B
    Measurement "total"
      Counter: 1
  Event [:phoenix, :endpoint, :stop]
    Measurement "duration"
      Summary:
        Average: 101 ms
        Min: 52 ms
        Max: 127 ms

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

handle_event(event_name, measurements, metadata, config)

start_link(opts)