autopush.metrics

Metrics interface and implementations

Interface

class autopush.metrics.IMetrics(*args, **kwargs)[source]

Metrics interface

Each method except __init__() and start() must be implemented.

Additional kwargs may be recorded as additional metric tags for metric systems that support it, otherwise they should be ignored.

__init__(*args, **kwargs)[source]

Setup the metrics

start()[source]

Start any connection needed for metric transmission

increment(name, count=1, **kwargs)[source]

Increment a counter for a metric name

gauge(name, count, **kwargs)[source]

Record a gauge for a metric name

timing(name, duration, **kwargs)[source]

Record a timing in ms for a metric name

Implementations

class autopush.metrics.SinkMetrics(*args, **kwargs)[source]

Exists to ignore metrics when metrics are not active

increment(name, count=1, **kwargs)[source]

Increment a counter for a metric name

gauge(name, count, **kwargs)[source]

Record a gauge for a metric name

timing(name, duration, **kwargs)[source]

Record a timing in ms for a metric name