statsd mock server based on gevent
Project description
Based entirely on - studio-ousia/gevent-statsd-moc with python-statsd dependency changed to pystatsd and gevent.server.DatagramServer used to handle the server portion
Installation
$ pip install mock-statd
Basic Usage
In this sample we use pystatsd for client library
>>> from statsdmock import StatsdMockServer
>>> server = StatsdMockServer()
>>> server.start()
>>> import statsd
>>> c = statsd.StatsClient(prefix='bigtag')
>>> c.gauge('subtag', 10)
>>> server.wait('bigtag.subtag', n=1)
>>> data = list(server.metrics['bigtag.subtag'])
>>> assert data[0] == {'value': '10', 'type': 'gauge', 'rate': 1.0, 'timestamp': None}
>>> server.stop()
>>> del server
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
statsdmock-0.0.3.tar.gz
(3.7 kB
view details)
File details
Details for the file statsdmock-0.0.3.tar.gz
.
File metadata
- Download URL: statsdmock-0.0.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ee935e0b96a31acc145bb8211ca0a116519880b9373098eed0859f23df75c91 |
|
MD5 | a387584ea84c1d2bcd8a91d14feacacf |
|
BLAKE2b-256 | 916b1b164bad7b118a5f0117e97ee580445e47acaa457692d052bc77ae4654ab |