Created
June 2, 2016 17:12
-
-
Save nmilford/a11cc9ce35c1d77fb008e615e74cbd7d to your computer and use it in GitHub Desktop.
Splash metric collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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