Aurinko.Telemetry (Aurinko v0.2.1)

Copy Markdown View Source

Telemetry instrumentation for Aurinko.

Events emitted

EventMeasurementsMetadata
[:aurinko, :request, :start]system_timemethod, path
[:aurinko, :request, :stop]durationmethod, path, result, cached
[:aurinko, :request, :retry]countmethod, path, reason
[:aurinko, :circuit_breaker, :opened]countcircuit, reason
[:aurinko, :circuit_breaker, :closed]countcircuit
[:aurinko, :circuit_breaker, :rejected]countcircuit
[:aurinko, :sync, :complete]updated, deleted, duration_msresource

Attach default structured logger

Aurinko.Telemetry.attach_default_logger(:info)

TelemetryMetrics definitions for reporters

def metrics do
  Aurinko.Telemetry.metrics()
end

Summary

Functions

Attach a structured logger for all Aurinko telemetry events.

Returns a specification to start this module under a supervisor.

Detach the default logger.

All telemetry event names emitted by Aurinko.

Telemetry.Metrics definitions for reporters (Prometheus, StatsD, etc.).

Functions

attach_default_logger(level \\ :info)

@spec attach_default_logger(Logger.level()) :: :ok | {:error, :already_exists}

Attach a structured logger for all Aurinko telemetry events.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

detach_default_logger()

@spec detach_default_logger() :: :ok | {:error, :not_found}

Detach the default logger.

events()

@spec events() :: [
  [
    :aurinko
    | :circuit_breaker
    | :closed
    | :complete
    | :opened
    | :rejected
    | :request
    | :retry
    | :start
    | :stop
    | :sync,
    ...
  ],
  ...
]

All telemetry event names emitted by Aurinko.

metrics()

@spec metrics() :: [Telemetry.Metrics.t()]

Telemetry.Metrics definitions for reporters (Prometheus, StatsD, etc.).

Add to your Phoenix Telemetry module:

def metrics do
  [...your_metrics..., Aurinko.Telemetry.metrics()]
  |> List.flatten()
end

start_link(opts \\ [])