Jido.Telemetry.Config
(Jido v2.0.0-rc.4)
View Source
Configuration for Jido's telemetry logging system.
This module provides functions to check log levels, interestingness thresholds, and privacy settings for telemetry events.
Configuration
All configuration is read from application environment under :jido, :telemetry:
config :jido, :telemetry,
log_level: :debug, # :trace | :debug | :info | :warning | :error
slow_signal_threshold_ms: 10,
slow_directive_threshold_ms: 5,
interesting_signal_types: ["jido.strategy.init", "jido.strategy.complete"],
log_args: :keys_only # :keys_only | :full | :noneLog Levels
The telemetry system supports five log levels in order of verbosity:
:trace- Very verbose, logs every signal and directive:debug- Logs interesting events and slow operations:info- Logs significant lifecycle events:warning- Logs potential issues:error- Logs only errors
Examples
# Check if trace logging is enabled
if Jido.Telemetry.Config.trace_enabled?() do
# Log detailed per-signal information
end
# Check if an operation is slow
if duration_ms > Jido.Telemetry.Config.slow_signal_threshold_ms() do
# Log as interesting even at higher log levels
end
# Check argument logging settings
case Jido.Telemetry.Config.log_args?() do
:full -> log_full_args(args)
:keys_only -> log_keys(args)
:none -> :skip
end
Summary
Functions
Returns true if debug-level logging is enabled.
Returns true if the given signal type is considered "interesting".
Returns the list of signal types that are always considered "interesting".
Returns true if the given log level is enabled based on current configuration.
Returns the action/directive arguments logging mode.
Returns the current log level.
Returns the slow directive threshold in milliseconds.
Returns the slow signal threshold in milliseconds.
Returns true if trace-level logging is enabled.
Functions
@spec debug_enabled?() :: boolean()
Returns true if debug-level logging is enabled.
Examples
iex> Jido.Telemetry.Config.debug_enabled?()
true
Returns true if the given signal type is considered "interesting".
Examples
iex> Jido.Telemetry.Config.interesting_signal_type?("jido.strategy.init")
true
iex> Jido.Telemetry.Config.interesting_signal_type?("jido.some.random.signal")
false
@spec interesting_signal_types() :: [String.t()]
Returns the list of signal types that are always considered "interesting".
These signals are logged at debug level regardless of duration.
Default: ["jido.strategy.init", "jido.strategy.complete"]
Examples
iex> "jido.strategy.init" in Jido.Telemetry.Config.interesting_signal_types()
true
@spec level_enabled?(:trace | :debug | :info | :warning | :error) :: boolean()
Returns true if the given log level is enabled based on current configuration.
Examples
iex> Jido.Telemetry.Config.level_enabled?(:debug)
true
iex> Jido.Telemetry.Config.level_enabled?(:trace)
false
@spec log_args?() :: :keys_only | :full | :none
Returns the action/directive arguments logging mode.
:full- Log complete arguments:keys_only- Log only the keys of arguments (default):none- Do not log arguments
Default: :keys_only
Examples
iex> Jido.Telemetry.Config.log_args?()
:keys_only
@spec log_level() :: :trace | :debug | :info | :warning | :error
Returns the current log level.
Examples
iex> Jido.Telemetry.Config.log_level()
:debug
@spec slow_directive_threshold_ms() :: non_neg_integer()
Returns the slow directive threshold in milliseconds.
Directives taking longer than this are considered "interesting" and logged at debug level.
Default: 5ms
Examples
iex> Jido.Telemetry.Config.slow_directive_threshold_ms()
5
@spec slow_signal_threshold_ms() :: non_neg_integer()
Returns the slow signal threshold in milliseconds.
Signals taking longer than this are considered "interesting" and logged at debug level.
Default: 10ms
Examples
iex> Jido.Telemetry.Config.slow_signal_threshold_ms()
10
@spec trace_enabled?() :: boolean()
Returns true if trace-level logging is enabled.
Trace level is the most verbose, logging every signal and directive.
Examples
iex> Jido.Telemetry.Config.trace_enabled?()
false