statsd.connection

class statsd.connection.Connection(host=None, port=None, sample_rate=None, disabled=None)[source]

Statsd Connection

Parameters:
  • host (str) – The statsd host to connect to, defaults to localhost
  • port (int) – The statsd port to connect to, defaults to 8125
  • sample_rate (int) – The sample rate, defaults to 1 (meaning always)
  • disabled (bool) – Turn off sending UDP packets, defaults to False
send(data, sample_rate=None)[source]

Send the data over UDP while taking the sample_rate in account

The sample rate should be a number between 0 and 1 which indicates the probability that a message will be sent. The sample_rate is also communicated to statsd so it knows what multiplier to use.

Parameters:
  • data (dict) – The data to send
  • sample_rate (int) – The sample rate, defaults to 1 (meaning always)