MLServe.Telemetry.Logger (MLServe v0.1.0)

Copy Markdown View Source

Logs MLServe telemetry events, with no dependencies beyond Logger.

The fastest way to see what MLServe is doing. Attach it in application.ex while developing, or in production at :info to record model loads and unloads without wiring up a metrics backend:

MLServe.Telemetry.Logger.attach(level: :info, events: [:model])

For real observability use MLServe.Telemetry.Metrics with LiveDashboard or a StatsD/Prometheus reporter — logging every prediction in production is a way to spend your I/O budget on strings.

Options

  • :level — log level, defaulting to :debug
  • :events — which groups to log: :prediction, :model, :cache, :batch. Defaults to [:prediction, :model]; cache and batch events are high-volume.

Summary

Functions

Attaches the logger. Safe to call more than once.

Detaches the logger. Safe to call when not attached.

Functions

attach(opts \\ [])

@spec attach(keyword()) :: :ok

Attaches the logger. Safe to call more than once.

Examples

MLServe.Telemetry.Logger.attach()
MLServe.Telemetry.Logger.attach(level: :info, events: [:model])

detach()

@spec detach() :: :ok

Detaches the logger. Safe to call when not attached.