Module slog_extlog::stats
source · Expand description
Statistics generator for slog
.
This crate allows for statistics - counters, gauges, and bucket counters - to be automatically
calculated and reported based on logged events. The logged events MUST implement the
ExtLoggable
trait.
To support this, the slog-extlog-derive
crate can be used to link logs to a specific
statistic. This generates fast, compile-time checking for statistics updates at the point
of logging.
Users should use the define_stats
macro to list their statistics. They can then pass the
list (along with stats from any dependencies) to a StatisticsLogger
wrapping an
slog::Logger
. The statistics trigger function on the ExtLoggable
objects then triggers
statistic updates based on logged values.
Library users should export the result of define_stats!
, so that binary developers can
track the set of stats from all dependent crates in a single tracker.
Triggers should be added to ExtLoggable
objects using the slog-extlog-derive
crate.
Structs
- A set of numerical buckets together with a method for sorting values into them.
- Structure to use for the default implementation of
StatisticsLogFormatter
. - A stat definition, possibly filtered with some specific tag values.
- Data and callback type for actually generating the log.
- A snapshot of the current values for a particular stat.
- A snapshot of a current (possibly grouped) value for a stat.
- A logger with statistics tracking.
- A builder to allow customization of stats config. This gives flexibility when the other methods are insufficient.
- An object that tracks statistics and can be asked to log them
Enums
- Used to represent the upper limit of a bucket.
- Used to determine which buckets to update when a BucketCounter stat is updated
- Types of changes made to a statistic.
- The values contained in a
StatSnapshot
for each stat type. - Types of statistics. Automatically determined from the
StatDefinition
.
Constants
- The default period between logging all statistics.
Statics
- The log identifier for the default formatter.
Traits
- A configured statistic, defined in terms of the external logs that trigger it to change.
- A trait indicating that this log can be used to trigger a statistics change.
- A trait object to allow users to customise the format of stats when logged.
Type Aliases
- Type alias for the return of
define_stats
.