Sovite.Core.Telemetry (sovite v0.2.0)

Copy Markdown View Source

The catalog of :telemetry events emitted by Sovite, and the default handler that turns them into log lines.

Components emit events named [:sovite, component, ...]. Durations are in :native time units, as with :telemetry.span/3.

EventMeasurementsMetadata
[:sovite, :listener, :connection, :start]system_timelistener, remote_ip, remote_port
[:sovite, :listener, :connection, :stop]durationlistener, remote_ip, remote_port
[:sovite, :listener, :connection, :rejected]listener, remote_ip, reason
[:sovite, :smtp, :server, :session, :start]system_timesession_id, remote_ip
[:sovite, :smtp, :server, :session, :stop]durationsession_id, remote_ip
[:sovite, :smtp, :server, :command, :stop]durationsession_id, remote_ip, command, argument, reply_code, reply
[:sovite, :smtp, :server, :tls, :stop]durationsession_id, remote_ip, protocol, cipher, sni, error
[:sovite, :auth, :success]session_id, remote_ip, mechanism, username
[:sovite, :auth, :failure]session_id, remote_ip, mechanism, username, reason
[:sovite, :abuse, :penalty, :banned]failurespenalty, key, ban_time
[:sovite, :tls, :certificate, :loaded]cert_file, names, not_after
[:sovite, :tls, :certificate, :error]cert_file, reason
[:sovite, :tls, :acme, :issued]domains, not_after
[:sovite, :tls, :acme, :failed]domains, reason
[:sovite, :queue, :message, :enqueued]size, recipientsqueue_id, session_id, sender
[:sovite, :queue, :message, :removed]queue_id, reason (delivered, bounced, expired)
[:sovite, :queue, :message, :deferred]attempts, recipientsqueue_id, next_attempt
[:sovite, :queue, :message, :corrupt]queue_id, reason
[:sovite, :queue, :notification, :sent]recipientsqueue_id, kind, to, notification_id
[:sovite, :queue, :notification, :discarded]recipientsqueue_id, kind, sender
[:sovite, :smtp, :client, :delivery, :start]system_timequeue_id, relay
[:sovite, :smtp, :client, :delivery, :stop]durationqueue_id, relay, recipient, status, reply
[:sovite, :smtp, :client, :delivery, :exception]durationqueue_id, relay, kind, reason

Delivery :stop events come once per recipient; status is :delivered, :deferred, or :failed. :notification events are about the original message: queue_id is its ID, and notification_id the ID of the queued notification.

Message lifecycle events (:queue, delivery :stop and :exception), successful logins, certificate loads and ACME issuance, failed TLS handshakes, and SMTP commands that got a 4xx or 5xx reply are logged at :info. Corrupt messages, discarded notifications, failed logins, bans, certificate errors, and failed ACME orders are logged at :warning. All other events are logged at :debug.

Failed logins are logged as auth.failure: mechanism=PLAIN, reason=invalid_credentials, username=alice with remote_ip in the metadata, ready for tools such as fail2ban.

Summary

Functions

Attaches the logging handler to every cataloged event. Safe to call repeatedly.

Detaches the logging handler.

Returns every event in the catalog.

Functions

attach_logger()

@spec attach_logger() :: :ok

Attaches the logging handler to every cataloged event. Safe to call repeatedly.

detach_logger()

@spec detach_logger() :: :ok

Detaches the logging handler.

events()

@spec events() :: [:telemetry.event_name()]

Returns every event in the catalog.