TelemetryMetricsLogger (telemetry_metrics_logger v0.1.0) View Source

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, 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

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

handle_event(event_name, measurements, metadata, config)

View Source