|
4 years ago | |
---|---|---|
.gitignore | 6 years ago | |
README.md | 4 years ago | |
config.sample.js | 6 years ago | |
grafana_dashboard.json | 6 years ago | |
stackstats.js | 5 years ago |
A metric collection script for the StackOverflow API.
Here is a link for you to view some stats in real* time.
*Stats are collected every 5 minutes, and smoothed to a 30 minute average ( on query ) to account for API caching.
Data is beautiful, so why not draw some beautiful graphs about the site that helps so many.
This script is based around the carbon-cache metric storage backend, and is using Grafana for the UI.
To query the API, I wrote up a node.js script that will run a collection on a 5 minute interval; this then parses the JSON response from the SE API into a format parsable by the metric engine, opens a socket, and sends it.
In the above screenshot, you can see the result of simply collecting and graphing the data returned by the /info API endpoint.
The list of statistics collected and graphed:
All per minute stats shown in Grafana are calculated by applying time function transformations to the total counts.
The script source can be found on GitHub.
Following in the path of StackExchange, this is published under the MIT License.
The application is built in node.js and outputs data in the carbon plaintext protocol.
This applications requires an instance of carbon-cache or equivalent metric storage engine to properly store stats; in addition, it requires a front end viewer - in this example, I am using graphite-web and Grafana.
To configure the application, simply copy config.sample.js
to config.js
and adjust your desired parameters.
To start the application, simply run the main file with node.
cd $APP_HOME
node stackstats.js &>> log &
Created by:
Matthew Clark
matt@mclarkdev.com