Module slog_extlog::stats[][src]

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

Buckets

A set of numerical buckets together with a method for sorting values into them.

DefaultStatisticsLogFormatter

Structure to use for the default implementation of StatisticsLogFormatter.

StatDefinitionTagged

A stat definition, possibly filtered with some specific tag values.

StatLogData

Data and callback type for actually generating the log.

StatSnapshot

A snapshot of the current values for a particular stat.

StatSnapshotValue

A snapshot of a current (possibly grouped) value for a stat.

StatisticsLogger

A logger with statistics tracking.

StatsLoggerBuilder

A builder to allow customization of stats config. This gives flexibility when the other methods are insufficient.

StatsTracker

An object that tracks statistics and can be asked to log them

Enums

BucketLimit

Used to represent the upper limit of a bucket.

BucketMethod

Used to determine which buckets to update when a BucketCounter stat is updated

ChangeType

Types of changes made to a statistic.

StatSnapshotValues

The values contained in a StatSnapshot for each stat type.

StatType

Types of statistics. Automatically determined from the StatDefinition.

Constants

DEFAULT_LOG_INTERVAL_SECS

The default period between logging all statistics.

Statics

DEFAULT_LOG_ID

The log identifier for the default formatter.

Traits

StatDefinition

A configured statistic, defined in terms of the external logs that trigger it to change.

StatTrigger

A trait indicating that this log can be used to trigger a statistics change.

StatisticsLogFormatter

A trait object to allow users to customise the format of stats when logged.

Type Definitions

StatDefinitions

Type alias for the return of define_stats.