HTTP server that consumes numbers at preset intervals and returns summary statistics.
Inspired by a need to make sense of constant stream of hundreads of measurements, and do it in automated and self adjusting way. The name is inspired by StatsD.
This is a prototype. Hence Bash, AWK and 100-Python-lines server.
A prototype is an early sample, model, or release of a product built to test a concept or process or to act as a thing to be replicated or learned from.
1. git clone ...
2. cd statsz
3. python server.py
4. https://localhost:8083/?name=foo&value=7&datetime=1416854891
response
{
"before": {
"count": 0
},
"after": {
"count": 1,
"mean": 7,
"p2": 7,
"p9": 7,
"p25": 7,
"median": 7,
"p75": 7,
"p91": 7,
"p98": 7,
"min": 7,
"max": 7
}
}
... repeat
5. https://localhost:8083/?name=foo&value=7&datetime=1416854891
response
{
"before": {
"count": 9,
"mean": 6.11111,
"p2": 5,
"p9": 5,
"p25": 6,
"median": 6,
"p75": 7,
"p91": 7,
"p98": 7,
"min": 5,
"max": 7
},
"after": {
"count": 10,
"mean": 6.2,
"p2": 5,
"p9": 5,
"p25": 6,
"median": 6,
"p75": 7,
"p91": 7,
"p98": 7,
"min": 5,
"max": 7
}
}
... repeat
http://en.wikipedia.org/wiki/Seven-number_summary
http://www.acmesystems.it/python_httpserver
http://pymotw.com/2/BaseHTTPServer/
http://www.piware.de/2011/01/creating-an-https-server-in-python/