API Reference¶
-
class
FakeStatsDClient(prefix='')[source]¶ Bases:
perfmetrics.statsd.StatsdClientA mock statsd client that tracks sent statsd metrics in memory rather than pushing them over a socket. This class is a drop in replacement for
perfmetrics.statsd.StatsdClientthat collects statsd packets andMetricthat are sent through the client.-
iter_metrics()¶ Iterates the
Metricsprovided to this statsd client.
-
-
METRIC_COUNTER_KIND= 'c'¶ The statsd metric kind for Counters
-
METRIC_GAUGE_KIND= 'g'¶ The statsd metric kind for Gauges
-
METRIC_SET_KIND= 's'¶ The statsd metric kind for Sets
-
METRIC_TIMER_KIND= 'ms'¶ The statsd metric kind for Timers
-
class
Metric(name, value, kind, sampling_rate=None)[source]¶ Bases:
objectThe representation of a single statsd metric.
-
kind= None¶ The statsd code for the type of metric. e.g. one of the
METRIC_*_KINDconstants
-
classmethod
make(packet)[source]¶ Creates a metric from the provided statsd packet.
Raises: ValueError – if packet is a multi metric packet or otherwise invalid.
-
classmethod
make_all(packet)[source]¶ Makes a list of metrics from the provided statsd packet.
Like
makebut supports multi metric packets
-
name= None¶ The metric name
-
sampling_rate= None¶ The rate with which this event has been sampled from (optional)
-
value= None¶ The value provided for the metric
-