Skip to content

Commit 9b62797

Browse files
authored
Bot metric page. (#396)
* Move the metrics page to scientific Python * rerun prettier
1 parent 09c4872 commit 9b62797

File tree

4 files changed

+199
-0
lines changed

4 files changed

+199
-0
lines changed

config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ params:
4949
# url: https://learn.scientific-python.org/maintainers/
5050
- title: SPECs
5151
url: /specs/
52+
- title: BOT
53+
url: /bot/
5254

5355
hero:
5456
# Main hero title

content/bot/_index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: "Bots"
3+
---
4+
5+
# Scientific Python Maintain a few bots that makes maintainer life a bit easier.
6+
7+
Here is the statistics for our backport bot
8+
9+
{{< include-html "static/teams/bots-graphs.html" >}}
10+
11+
## Install on your repo
12+
13+
Head to https://github.com/apps/lumberbot-app and install on your favorite
14+
repositories, You can now either mention the bot, or modify a milestone or label
15+
description with commands like.
16+
17+
```
18+
on-merge: backport to 5.x
19+
```
20+
21+
And on PR merge the bot will for the repository, backport the branch and send a
22+
PR from it's fork.

netlify.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44

55
[[plugins]]
66
package = "netlify-plugin-checklinks"
7+
[plugins.inputs]
8+
skipPatterns = ['*bot*']

static/teams/bots-graphs.html

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<div class="chart" id="keen-example-chart"></div>
2+
<div class="chart" id="backport-success">auto</div>
3+
<div class="flex-container" style="height: 340px">
4+
<div class="item initial chart" id="keen-chart-2">auto</div>
5+
<div class="item auto chart" id="total-pr">auto</div>
6+
</div>
7+
<link
8+
href="https://d26b395fwzu5fz.cloudfront.net/keen-dataviz-1.1.3.css"
9+
rel="stylesheet"
10+
/>
11+
12+
<style>
13+
.flex-container {
14+
margin-left: 25px;
15+
resize: horizontal;
16+
overflow: hidden;
17+
display: flex;
18+
}
19+
20+
.initial {
21+
flex: initial;
22+
}
23+
24+
.auto {
25+
width: 30%;
26+
margin: 10px;
27+
flex: auto;
28+
}
29+
</style>
30+
<script
31+
src="https://d26b395fwzu5fz.cloudfront.net/keen-analysis-1.2.2.js"
32+
type="text/javascript"
33+
></script>
34+
<script
35+
src="https://d26b395fwzu5fz.cloudfront.net/keen-dataviz-1.1.3.js"
36+
type="text/javascript"
37+
></script>
38+
<script type="text/javascript">
39+
var client = new Keen({
40+
projectId: "59e6286dc9e77c0001097979",
41+
readKey:
42+
"3ED31C47C7576FB00C2150C4DFE176EC96B379CE631051B89F83243160668F201FF1FCE12B97A5B579B4ACDA4282CD71BE218EF858963B70E89ACDFAEFE80053E9B6900C2DA61BD277F107B05D3ED16240DC5527B3C9BCCA6895DA8CF479B9E3",
43+
});
44+
45+
var chart = new Keen.Dataviz()
46+
.el("#keen-example-chart")
47+
.height(320)
48+
.title("Activity / repository / week on a 52 week period")
49+
.type("bar")
50+
.stacked(true)
51+
.prepare();
52+
53+
client
54+
.query("count", {
55+
event_collection: "dispatch",
56+
filters: [
57+
{
58+
operator: "not_contains",
59+
property_name: "mention.repository",
60+
property_value: "/test1",
61+
},
62+
],
63+
group_by: ["mention.repository"],
64+
interval: "weekly",
65+
timeframe: "this_52_weeks",
66+
timezone: "US/Pacific",
67+
})
68+
.then(function (res) {
69+
chart.data(res).render();
70+
})
71+
.catch(function (err) {
72+
chart.message(err.message);
73+
});
74+
75+
var chart2 = new Keen.Dataviz()
76+
.el("#keen-chart-2")
77+
.height(340)
78+
.width("400px")
79+
.title("Number of backport/Year/Project.")
80+
.type("table")
81+
.prepare();
82+
83+
client
84+
.query("count", {
85+
event_collection: "dispatch",
86+
filters: [
87+
{
88+
operator: "contains",
89+
property_name: "mention.command",
90+
property_value: "backport",
91+
},
92+
],
93+
group_by: ["mention.organisation"],
94+
timeframe: "this_5_years",
95+
timezone: "US/Pacific",
96+
})
97+
.then(function (res) {
98+
var data = chart2.data(res);
99+
console.log(data);
100+
data.dataset = data.dataset.sortRows("desc", function (arr) {
101+
console.log(arr);
102+
return arr[1];
103+
});
104+
data.dataset.matrix[0] = ["Organisation", "Backports"];
105+
data.render();
106+
})
107+
.catch(function (err) {
108+
chart2.message(err.message);
109+
});
110+
111+
var chart3 = new Keen.Dataviz()
112+
.el("#total-pr")
113+
.height(340)
114+
.title("All attempted backports (excluding test repositories)")
115+
.type("metric")
116+
.prepare();
117+
118+
client
119+
.query("count", {
120+
event_collection: "dispatch",
121+
filters: [
122+
{
123+
operator: "contains",
124+
property_name: "mention.command",
125+
property_value: "backport",
126+
},
127+
{
128+
operator: "not_contains",
129+
property_name: "mention.repository",
130+
property_value: "test1",
131+
},
132+
],
133+
timeframe: "this_14_years",
134+
timezone: "US/Pacific",
135+
})
136+
.then(function (res) {
137+
chart3.data(res).render();
138+
})
139+
.catch(function (err) {
140+
chart3.message(err.message);
141+
});
142+
143+
var chart4 = new Keen.Dataviz()
144+
.el("#backport-success")
145+
.height(240)
146+
.title("Backport Success")
147+
.stacked(true)
148+
.type("columnchart")
149+
.prepare();
150+
151+
client
152+
.query("count", {
153+
event_collection: "backport_stats",
154+
filters: [
155+
{
156+
operator: "not_contains",
157+
property_name: "slug",
158+
property_value: "test1",
159+
},
160+
{ operator: "ne", property_name: "reason", property_value: "Sucess" },
161+
],
162+
group_by: ["reason"],
163+
interval: "weekly",
164+
timeframe: "this_52_weeks",
165+
timezone: "US/Pacific",
166+
})
167+
.then(function (res) {
168+
chart4.data(res).render();
169+
})
170+
.catch(function (err) {
171+
chart.message(err.message);
172+
});
173+
</script>

0 commit comments

Comments
 (0)