Skip to content

Instantly share code, notes, and snippets.

@nmilford
Created June 2, 2016 17:12
Show Gist options
  • Save nmilford/a11cc9ce35c1d77fb008e615e74cbd7d to your computer and use it in GitHub Desktop.
Save nmilford/a11cc9ce35c1d77fb008e615e74cbd7d to your computer and use it in GitHub Desktop.
Splash metric collection
#!/usr/bin/env python
from statsd import StatsClient
import requests
import json
statsd = StatsClient()
url = 'http://127.0.0.1:8050/_debug'
resp = requests.get(url=url)
metrics = json.loads(resp.text)
statsd.gauge('splash.queue_size', metrics['qsize'])
statsd.gauge('splash.argcache', metrics['argcache'])
statsd.gauge('splash.peak_memory', metrics['maxrss'])
statsd.gauge('splash.file_descriptors', metrics['fds'])
statsd.gauge('splash.active', len(metrics['active']))
for key, value in metrics['leaks'].iteritems():
metric = 'splash.leaks.%s' % key.lower().replace('_','')
statsd.gauge(metric, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment