Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

IBM/github-traffic-stats-collector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

github-traffic-stats-collector

WORK IN PROGRESS

Architecture

Diagram

                          +---------------+
                          | +-----------+ |
                          | | Database  | | --------+
                          | +-----------+ | <-----+ |
                          |               |   GH  | | DB Processing
            Cron Trigger  |               | Stats | |    Trigger
+--------+ <------------- | +-----------+ | ------+ |
| GitHub |                | | OpenWhisk | | <-------+
+--------+ -------------> | +-----------+ | ------+
           Traffic Stats  |               |       |
                          |               |       | Update Dashboard
                          | +-----------+ |       |
                          | | Dashboard | | <-----+
                          | +-----------+ |
                          +---------------+

Chronology

  1. OpenWhisk cron trigger sends request for traffic statistics to GitHub
  2. GitHub Returns traffic statistics
  3. OpenWhisk sends GitHub Statistics to database
  • If database receives new statistics:
    1. Trigger OpenWhisk to process data
    2. Send newly processed data to dashboard
  1. Dashboard displays reports

Example

To use the sample python script, you will need to create a personal access token with public_repo access: personal_access_token_settings

Then, run example/gh_traffic.py, entering your personal access token and repo path when asked:

$ $(which python) example/gh_traffic.py
GitHub personal access token: ****************************************
GitHub repo (username_or_orgname/reponame): IBM/github-traffic-stats-collector
...
# Data Snippeted for concisity
...

NOTE:

  • Treat your personal access token like a password and keep it secure as such
  • You will be able to pull traffic statistics for any repository you are not an admin of
    • If you are not an admin, you are not able to pull traffic statistics