Compute Project Stats

  • This notebook uses the GitHub GraphQL API to compute the number of open and closed bugs pertaining to Kubeflow GitHub Projects
    • Stats are broken down by labels
  • Results are plotted using plotly
    • Plots are currently published on plot.ly for sharing; they are publicly vieable by anyone

Setup GitHub

  • You will need a GitHub personal access token in order to use the GitHub API
  • See these instructions for creating a personal access token
    • You will need the scopes:
      • repo
      • read:org
  • Set the environment variable GITHUB_TOKEN to pass your token to the code

Setup Plot.ly Online

  • In order to use plot.ly to publish the plot you need to create a plot.ly account and get an API key
  • Follow plot.ly's getting started guide
  • Store your API key in ~/.plotly/.credentials

In [7]:
# Use plotly cufflinks to plot data frames
# https://plot.ly/ipython-notebooks/cufflinks/
# instructions for offline plotting
# https://plot.ly/python/getting-started/#initialization-for-offline-plotting
#
# Follow the instructions for online plotting:
# https://plot.ly/python/getting-started/
# You will need to setup an account
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
import cufflinks as cf
#from importlib import reload
import itertools

In [8]:
import project_stats
#reload(project_stats)

In [9]:
c = project_stats.ProjectStats(project="0.6.0")
#c = project_stats.ProjectStats(project="0.7.0")
c.main()

Make plots showing different groups of labels

  • Columns are multi level indexes
  • See here for instructions on multilevel indexes
    • We specify a list of tuples where each tuple specifies the item to select at the corresponding level in the index

In [10]:
counts = ["open", "total"]
#labels = ["cuj/build-train-deploy", "cuj/multi-user", "area/katib"]
labels = ["priority/p0", "priority/p1", "priority/p2"]
columns = [(a,b) for (a,b) in itertools.product(counts, labels)]

import datetime
start=datetime.datetime(2019, 1, 1)

i = c.stats.index > start
#c.stats.iloc[i]
c.stats.loc[i, columns].iplot(kind='scatter', width=5, filename='project-stats', title='{0} Issue Count'.format(c.project))


Out[10]:

In [11]:
c.stats.iloc[-1][columns]


Out[11]:
       label      
open   priority/p0      7
       priority/p1     13
       priority/p2      7
total  priority/p0     46
       priority/p1    139
       priority/p2     38
Name: 2019-08-04 23:42:23, dtype: int64

In [12]:
import datetime
start=datetime.datetime(2019, 1, 1)

i = c.stats.index > start
c.stats.iloc[i]


Out[12]:
open ... total
label addition/feature area/0.3.0 area/0.4.0 area/0.5.0 area/1.0.0 area/bootstrap area/build-release area/centraldashboard area/deployment area/design ... lifecycle/stale nolabels platform/aws platform/gcp platform/minikube platform/other priority/p0 priority/p1 priority/p2 release/v0.6
time
2019-01-03 19:45:38 0 1 3 5 1 6 1 0 0 0 ... 29 0 0 8 1 0 4 22 14 1
2019-01-04 02:34:32 0 1 3 5 1 6 2 0 0 0 ... 29 0 0 8 1 0 4 22 15 1
2019-01-04 02:35:17 0 1 3 5 1 6 3 0 0 0 ... 30 0 0 8 1 0 4 22 16 1
2019-01-06 21:51:20 0 1 3 5 1 6 3 0 0 0 ... 31 0 0 8 1 0 4 22 17 1
2019-01-07 15:06:42 0 1 3 5 1 6 3 0 0 1 ... 31 0 0 8 1 0 4 23 17 1
2019-01-08 21:01:44 0 1 3 5 1 6 3 0 0 1 ... 31 0 0 8 1 0 4 23 18 1
2019-01-11 23:45:09 0 1 3 5 1 6 3 0 0 1 ... 31 0 0 8 1 0 4 24 18 1
2019-01-14 00:44:31 0 1 3 5 1 6 3 0 0 1 ... 32 0 0 8 1 0 4 25 18 1
2019-01-24 19:03:53 0 1 3 5 1 6 3 0 0 1 ... 33 0 0 8 1 0 4 25 18 1
2019-01-28 08:40:04 0 1 3 5 1 6 3 0 0 1 ... 33 0 0 8 1 0 4 25 18 1
2019-01-28 16:25:53 0 1 3 5 1 6 3 0 0 1 ... 34 0 0 8 1 0 4 26 18 1
2019-02-06 09:10:57 0 1 3 5 1 6 3 0 0 1 ... 34 0 0 8 1 0 4 26 19 1
2019-02-06 18:32:12 0 1 3 5 1 6 3 0 0 1 ... 34 0 0 8 1 0 4 27 19 1
2019-02-06 20:26:02 0 1 3 5 1 6 3 0 0 1 ... 34 0 0 8 1 0 4 28 19 1
2019-02-10 23:05:29 0 1 3 5 1 6 3 0 0 1 ... 34 0 0 8 1 0 4 28 20 1
2019-02-11 02:52:18 0 1 3 5 1 6 3 0 0 1 ... 34 0 0 8 1 0 4 29 20 1
2019-02-15 19:08:13 0 1 3 5 1 6 3 0 0 1 ... 35 0 0 8 1 0 4 30 20 1
2019-02-21 04:14:19 0 1 3 5 1 6 3 0 0 1 ... 36 0 0 8 1 0 4 30 20 1
2019-02-22 16:24:01 0 1 3 5 1 6 3 0 0 1 ... 36 0 0 8 1 0 4 31 20 1
2019-02-23 17:15:33 0 1 3 5 1 6 3 0 0 1 ... 36 0 0 8 1 0 4 32 20 1
2019-02-23 21:04:27 0 1 3 5 1 6 3 0 0 1 ... 36 0 0 8 1 0 4 32 21 1
2019-02-25 21:50:44 0 1 3 5 1 6 3 0 0 1 ... 36 0 0 9 1 0 4 32 22 1
2019-02-27 00:39:02 0 1 3 5 1 6 3 0 0 1 ... 37 0 0 9 1 0 4 33 22 1
2019-02-27 03:25:15 0 1 3 5 1 6 3 0 0 1 ... 37 0 0 9 1 0 4 34 22 1
2019-02-27 13:04:28 0 1 3 5 1 6 3 0 0 1 ... 38 0 0 9 1 0 4 34 23 1
2019-02-27 17:17:57 0 1 3 5 1 6 3 0 0 1 ... 38 0 0 9 1 0 4 35 23 1
2019-02-27 17:47:04 0 1 3 5 1 6 3 0 0 1 ... 38 0 0 9 1 0 4 36 23 1
2019-02-27 21:06:34 0 1 3 5 1 6 3 0 0 1 ... 38 0 0 9 1 0 4 37 23 1
2019-02-28 23:03:24 0 1 3 5 1 6 3 0 0 1 ... 39 0 0 9 1 0 4 37 24 1
2019-02-28 23:17:02 0 1 3 5 1 6 3 0 0 1 ... 40 0 0 10 1 0 4 38 24 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2019-07-22 01:57:27 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 42 136 38 3
2019-07-22 03:06:52 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 42 136 38 3
2019-07-22 04:52:19 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 42 136 38 3
2019-07-22 17:21:47 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 42 136 38 3
2019-07-22 18:30:58 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 42 136 38 3
2019-07-22 18:59:30 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 42 136 38 3
2019-07-22 19:13:30 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 43 136 38 3
2019-07-23 02:05:03 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-23 04:13:35 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-23 19:13:51 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-23 22:06:16 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-23 22:16:37 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-24 12:44:59 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-24 18:15:32 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-24 21:45:52 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 136 38 3
2019-07-25 23:40:10 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 137 38 3
2019-07-26 06:10:55 1 0 0 1 0 0 0 1 2 0 ... 53 2 2 24 1 1 44 138 38 3
2019-07-26 19:20:07 1 0 0 1 0 0 0 1 2 0 ... 53 2 3 24 1 1 45 138 38 3
2019-07-26 22:10:50 1 0 0 1 0 0 0 1 2 0 ... 53 2 3 24 1 1 45 138 38 3
2019-07-27 03:10:37 1 0 0 1 0 0 0 1 2 0 ... 53 2 3 24 1 1 45 138 38 3
2019-07-28 16:49:54 1 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 45 138 38 3
2019-07-28 22:59:43 1 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 45 138 38 3
2019-07-29 14:25:39 1 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 45 139 38 3
2019-07-31 00:33:27 2 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3
2019-07-31 21:24:15 2 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3
2019-08-01 18:30:22 2 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3
2019-08-03 15:19:37 2 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3
2019-08-03 19:29:51 1 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3
2019-08-04 22:56:38 0 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3
2019-08-04 23:42:23 0 0 0 0 0 0 0 1 2 0 ... 53 2 3 24 1 1 46 139 38 3

421 rows × 106 columns