No Description

root bf03022b76 Merge branch 'master' of https://github.com/MClarkDev/GrafOverflow.git 4 years ago
.gitignore e8b9aaab28 First commit of stats collection script. 6 years ago
README.md 170feae4fa Update README.md 4 years ago
config.sample.js 9fa3ffd8eb Added multi site support. 6 years ago
grafana_dashboard.json fd660e39d0 Changes to all. 6 years ago
stackstats.js a60fd7c9b4 Changes. 5 years ago

README.md

GrafOverflow

A metric collection script for the StackOverflow API.

View Some Realtime Stats

Here is a link for you to view some stats in real* time.

GrafOverflow

Screenshot of Dasboard

*Stats are collected every 5 minutes, and smoothed to a 30 minute average ( on query ) to account for API caching.

About

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:

  • Total Votes
  • Total Questions
  • Total Answers
  • Total Comments
  • Total Accepted
  • Accepted Percentage
  • Total Users
  • Total Badges

All per minute stats shown in Grafana are calculated by applying time function transformations to the total counts.

Download

The script source can be found on GitHub.

Following in the path of StackExchange, this is published under the MIT License.

Requirements

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.

Configuration & Usage

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 &

Contact

Created by:
  Matthew Clark
  matt@mclarkdev.com