snsary.utils.tracing.monitors

Module Contents

class snsary.utils.tracing.monitors.Monitor

Analyses Samples of the execution of some code.

abstract analyse(sample)
classmethod factory(**kwargs)
class snsary.utils.tracing.monitors.TimeSeriesAlert(*, history=None)

Bases: Monitor

Provides a History of Samples over time to support time series alerting. Each subclass is responsible for managing the history.

MAX_HISTORY = 300
class snsary.utils.tracing.monitors.LivenessAlert(*, history=None)

Bases: TimeSeriesAlert

Logs an error when a complete history of samples is nothing but failures.

The history is reset every time the monitor logs an error.

analyse(sample)
class snsary.utils.tracing.monitors.GapAlert(*, max_gaps=MAX_GAPS, **kwargs)

Bases: TimeSeriesAlert

Logs an error when there are too many gaps in SUCCESS samples. A gap is one or more FAILURE samples followed by a SUCCESS sample.

The history is reset every time the monitor logs an error.

MAX_GAPS = 30
analyse(sample)