forked from l7mp/image-pull-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
199 lines (187 loc) · 5.88 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0" />
<meta name="description" content="Image pull statistics of l7mp.io container images." />
<title>Image pull statistics</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script>
const csv_path = 'https://raw.githubusercontent.com/l7mp/stunner-vs-coturn-image-pull-stats/refs/heads/main/pull-stats.csv';
const config = {responsive: true};
const colors = {
stunnerd: 'rgb(66,133,244)',
stunnerGatewayOperator: 'rgb(234,67,53)',
stunnerAuthServer: 'rgb(255,188,5)',
netDebug: 'rgb(52,168,83)',
coturn: 'rgb(168,168,168)',
}
function getDifferences(values) {
return values.slice(1).map((value, index) => value - values[index]);
}
// total
Plotly.d3.csv(csv_path, function(data) {
var stunnerd = {
x: data.map(row => row['date'] + "T12:00"),
y: getDifferences(data.map(row => row['l7mp/stunnerd'])),
type: 'bar',
name: 'l7mp/stunnerd',
marker: {
color: colors.stunnerd,
size: 10
},
line: {
color: colors.stunnerd,
width: 2
}
};
var stunnerGatewayOperator = {
x: data.map(row => row['date'] + "T12:00"),
y: getDifferences(data.map(row => row['l7mp/stunner-gateway-operator'])),
type: 'bar',
name: 'l7mp/stunner-gateway-operator',
marker: {
color: colors.stunnerGatewayOperator,
size: 10
},
line: {
color: colors.stunnerGatewayOperator,
width: 2
}
};
var coTurn = {
x: data.map(row => row['date'] + "T12:00"),
y: getDifferences(data.map(row => row['coturn/coturn'])),
type: 'bar',
name: 'coturn/coturn',
marker: {
color: colors.coturn,
size: 10
},
line: {
color: colors.coturn,
width: 2
}
};
var layout = {
title: 'Image Pulls (Daily)',
};
Plotly.newPlot('daily',
[stunnerd, stunnerGatewayOperator, coTurn],
layout, config
);
});
// daily
Plotly.d3.csv(csv_path, function(data) {
var stunnerd = {
x: data.map(row => row['date'] + "T12:00"),
y: data.map(row => row['l7mp/stunnerd']),
type: 'lines+markers',
name: 'l7mp/stunnerd',
marker: {
color: colors.stunnerd,
size: 10
},
line: {
color: colors.stunnerd,
width: 2
}
};
var stunnerGatewayOperator = {
x: data.map(row => row['date'] + "T12:00"),
y: data.map(row => row['l7mp/stunner-gateway-operator']),
type: 'lines+markers',
name: 'l7mp/stunner-gateway-operator',
marker: {
color: colors.stunnerGatewayOperator,
size: 10
},
line: {
color: colors.stunnerGatewayOperator,
width: 2
}
};
var coTurn = {
x: data.map(row => row['date'] + "T12:00"),
y: data.map(row => row['coturn/coturn']),
type: 'lines+markers',
name: 'coturn/coturn',
marker: {
color: colors.coturn,
size: 10
},
line: {
color: colors.coturn,
width: 2
}
};
var layout = {
title: 'Image Pulls (Total)',
};
Plotly.newPlot('total',
[stunnerd, stunnerGatewayOperator, coTurn],
layout, config
);
});
function showPlot(evt, element) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(element).style.display = "block";
evt.currentTarget.className += " active";
window.dispatchEvent(new Event('resize'));
}
</script>
<style>
#total {
display: block;
}
#daily {
display: block;
}
.tablinks{
background-color: rgba(51, 51, 51, 0.05);
border-radius: 8px;
border-width: 0;
color: #333333;
cursor: pointer;
display: inline-block;
font-size: 14px;
font-weight: 500;
line-height: 20px;
list-style: none;
margin: 0;
padding: 10px 15px;
text-align: center;
vertical-align: baseline;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
</style>
</head>
<body>
<h2>Image pull statistics</h2>
<div class="tab">
<button id="dailyButton" class="tablinks" onclick="showPlot(event, 'daily')">Daily</button>
<button id="totalButton" class="tablinks" onclick="showPlot(event, 'total')">Total</button>
</div>
<div id="daily" class="tabcontent"></div>
<div id="total" class="tabcontent"></div>
<div>More info: <a href="https://github.com/l7mp/stunner-vs-coturn-image-pull-stats">github</a></div>
<script>
document.getElementById("dailyButton").click();
</script>
</body>
</html>