Huginn.Clickhouse.Telemetry (Huginn v0.4.0)
View SourceTelemetry events emitted by Huginn, and an optional default logger.
Each request issued through Huginn.Clickhouse.Client (query/2, insert/3,
insert_stream/3) is wrapped in a :telemetry
span:
| Event | Measurements | Metadata |
|---|---|---|
[:huginn, :query, :start] | :system_time, :monotonic_time | :method, :sql, :query_id, :pool |
[:huginn, :query, :stop] | :duration, :monotonic_time | above + :rows, :stats (or :error) |
[:huginn, :query, :exception] | :duration, :monotonic_time | above + :kind, :reason, :stacktrace |
:method is one of :query, :insert, :insert_stream. Durations are in
:native time units (use System.convert_time_unit/3).
Default logger
Attach a ready-made handler that logs each completed request:
Huginn.attach_default_logger()
# or with a level
Huginn.attach_default_logger(:debug)Detach it with detach_default_logger/0.
Summary
Functions
Attaches a default Logger handler for Huginn query events.
Detaches the default logger attached by attach_default_logger/1.
Functions
@spec attach_default_logger(Logger.level()) :: :ok | {:error, :already_exists}
Attaches a default Logger handler for Huginn query events.
level is the log level used for successful queries (default: :info);
failures and exceptions are always logged at :error. Returns :ok, or
{:error, :already_exists} if already attached.
@spec detach_default_logger() :: :ok | {:error, :not_found}
Detaches the default logger attached by attach_default_logger/1.