statsd.client

class statsd.client.Client(name, connection=None)[source]

Statsd Client Object

Parameters:
  • name (str) – The name for this client
  • connection (Connection) – The connection to use, will be automatically created if not given
>>> client = Client('test')
>>> client
<Client:test@<Connection[localhost:8125] P(1.0)>>
>>> client.get_client('spam')
<Client:test.spam@<Connection[localhost:8125] P(1.0)>>
connection = None

The Connection to use, creates a new connection if no connection is given

get_average(name=None)[source]

Shortcut for getting an Average instance

Parameters:name (str) – See get_client()
get_client(name=None, class_=None)[source]

Get a (sub-)client with a separate namespace This way you can create a global/app based client with subclients per class/function

Parameters:
  • name (str) – The name to use, if the name for this client was spam and the name argument is eggs than the resulting name will be spam.eggs
  • class (Client) – The Client subclass to use (e.g. Timer or Counter)
get_counter(name=None)[source]

Shortcut for getting a Counter instance

Parameters:name (str) – See get_client()
get_gauge(name=None)[source]

Shortcut for getting a Gauge instance

Parameters:name (str) – See get_client()
get_raw(name=None)[source]

Shortcut for getting a Raw instance

Parameters:name (str) – See get_client()
get_timer(name=None)[source]

Shortcut for getting a Timer instance

Parameters:name (str) – See get_client()
name = None

The name of the client, everything sent from this client will be prefixed by name