-
Notifications
You must be signed in to change notification settings - Fork 0
/
chartoptions.js
327 lines (314 loc) · 7.56 KB
/
chartoptions.js
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
"use strict";
var minDate = new Date(2014, 4, 12);
function changesetToPinFileURL(changeset) {
return "https://hg.mozilla.org/mozilla-central/file/" +
changeset +
"/security/manager/boot/src/StaticHPKPins.h";
}
// To simplify things, just say everything before 9 June 2014 was 32,
// and everything after is 33. We'll have to update this in the future.
function buildDateToVersion(timeInMillis) {
var mergeDate = new Date("9 June 2014");
var date = new Date(timeInMillis);
return date < mergeDate ? "32" : "33";
}
var buildDateToChangesetCache = {};
function buildDateToChangeset(timeInMillis) {
var date = new Date(timeInMillis);
if (buildDateToChangesetCache[date]) {
return buildDateToChangesetCache[date];
}
// This is fragile (for example, it doesn't handle Aurora builds yet).
// I'm told bug 487036 will implement what we actually want here.
var versionString = buildDateToVersion(timeInMillis);
var preURL = "http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/";
var postURL = "-mozilla-central-debug/firefox-" + versionString +
".0a1.en-US.debug-linux-i686.txt";
// JSON format appears to be YYYY-MM-DDTHH:MM:SS.MMMZ,
// where "-", "T", ":", ".", and "Z" are literals.
// We just want YYYY-MM-DD.
var dateString = date.toJSON().split("T")[0];
var url = preURL + dateString + postURL;
var req = new XMLHttpRequest();
try {
req.open("GET", url, false); // asynchronous for now
req.send();
var changesetURL = req.responseText.split("\n")[1];
// changesetURL now looks like this:
// https://hg.mozilla.org/mozilla-central/rev/xxxxxxxxxxxx
var changeset = changesetURL.split("/").slice(-1);
buildDateToChangesetCache[date] = changeset;
return changeset;
} catch (e) {
// probably 404
return null;
}
}
// Highcharts options.
var commonTooltip = {
useHTML: true,
hideDelay: 1000,
formatter: function() {
var changeset = buildDateToChangeset(this.x);
var pinFileURL = changesetToPinFileURL(changeset);
var s = "<b>" + Highcharts.dateFormat("%A, %b %e", this.x) + "</b>";
if (changeset) {
s += "<br/>Changeset: <a href='" + pinFileURL +
"' target='_blank'>" + changeset + "</a>";
}
$.each(this.points, function(i, point) {
var y = point.y;
if (point.y < 1) {
y = y.toFixed(6);
}
s += "<br/>" + point.series.name + ": " + y;
});
return s;
},
positioner: function(labelWidth, labelHeight, point) {
return { x: point.plotX - (labelWidth / 2), y: point.plotY - 10 };
}
};
// Events for hosts for which we don't have per-host violations.
var flag_data = {
nightly: [
{
x: Date.UTC(2014, 4, 24),
title: 'Twitter production',
text: 'Twitter moved to production'
},
{
x: Date.UTC(2014, 4, 24),
title: 'Google root PEMs',
text: 'Google switched to root PEMs'
},
{
x: Date.UTC(2014, 4, 29),
title: 'Mozilla cdn, media production',
text: 'Mozilla cdn, media production'
},
{
x: Date.UTC(2014, 5, 12),
title: 'Google production',
text: 'Google moved to production'
},
{
x: Date.UTC(2014, 5, 19),
title: '*.twitter.com (test)',
text: '*.twitter.com (test)'
},
{
x: Date.UTC(2014, 6, 8),
title: '*.twitter.com (prod)',
text: '*.twitter.com (prod)'
},
{
x: Date.UTC(2014, 6, 8),
title: 'dropbox (test)',
text: 'dropbox (test)'
},
{
x: Date.UTC(2014, 7, 7),
title: 'dropbox (prod)',
text: 'dropbox (prod)'
},
{
x: Date.UTC(2014, 7, 28),
title: 'facebook (test)',
text: 'facebook (test)'
},
{
x: Date.UTC(2014, 10, 2),
title: 'switch facebook (test)',
text: 'switch facebook (test)'
},
],
aurora: [
{
x: Date.UTC(2014, 5, 9),
title: 'Twitter, cdn, media production',
text: 'Twitter moved to production'
},
{
x: Date.UTC(2014, 5, 9),
title: 'Google (test)',
text: 'Google (test)'
},
]
};
var flags = {
type: 'flags',
showInLegend: false
};
// Events for mozilla hosts for which we have per-host violations.
var moz_flags = {
type: 'flags',
showInLegend: false,
data: [
{
x: Date.UTC(2014, 5, 5),
title: 'AMO production',
text: 'AMO production'
},
{
x: Date.UTC(2014, 5, 8),
title: 'FxA test',
text: 'FxA test'
},
{
x: Date.UTC(2014, 6, 3),
title: 'api.FxA test',
text: 'api.FxA test'
},
{
x: Date.UTC(2014, 6, 16),
title: 'FxA prod',
text: 'FxA prod'
},
{
x: Date.UTC(2014, 9, 11),
title: 'services test',
text: 'services test'
}
]
};
$(function() {
Highcharts.setOptions({
tooltip: commonTooltip,
chart: {
type: 'spline'
},
title: {
x: -20 //center
},
xAxis: {
type: 'datetime',
minTickInterval: 24 * 3600 * 1000,
// Why is this breaking?
// min: minDate.getTime()
},
yAxis: {
min: 0
},
})
});
var tsChart;
var tsOptions = {
legend: {
enabled: true,
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 2
},
chart: {
renderTo: 'timeseries'
},
title: {
text: 'Pinning violation rates'
},
yAxis: {
title: {
text: 'Pinning violation rate'
},
},
series: [{ name: 'Test mode' },
{ name: 'Production mode' },
{ name: 'Mozilla test mode' },
{ name: 'Mozilla production mode' },
flags
]
};
var volumeChart;
var volumeOptions = {
legend: {
enabled: true,
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 2
},
chart: {
renderTo: 'volume'
},
title: {
text: 'Pinning volumes'
},
yAxis: {
title: {
text: 'Pinning volumes'
}
},
series: [{ name: 'Test mode' },
{ name: 'Production mode' },
{ name: 'Mozilla test mode' },
{ name: 'Mozilla production mode' },
flags
]
};
var hostChart;
var hostOptions = {
legend: {
enabled: true,
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 2
},
chart: {
renderTo: 'host'
},
title: {
text: 'Pinning violation rates for mozilla hosts'
},
yAxis: {
title: {
text: 'Pinning violation rates'
},
},
series: [
{ name: 'addons.mozilla.org (test)' },
{ name: 'addons.mozilla.org (prod)' },
{ name: 'aus4.mozilla.org (test)' },
{ name: 'accounts.firefox.com (test)' },
{ name: 'accounts.firefox.com (prod)' },
{ name: 'api.accounts.firefox.com (test)' },
{ name: 'api.accounts.firefox.com (prod)' },
{ name: 'services.mozilla.com (test)' },
{ name: 'services.mozilla.com (prod)' },
moz_flags
]
};
var hostVolumeChart;
var hostVolumeOptions = {
legend: {
enabled: true,
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 2
},
chart: {
renderTo: 'hostVolume'
},
title: {
text: 'Pinning volumes for mozilla hosts'
},
yAxis: {
title: {
text: 'Pinning volumes'
},
},
series: [
{ name: 'addons.mozilla.org (test)' },
{ name: 'addons.mozilla.org (prod)' },
{ name: 'aus4.mozilla.org (test)' },
{ name: 'accounts.firefox.com (test)' },
{ name: 'accounts.firefox.com (prod)' },
{ name: 'api.accounts.firefox.com (test)' },
{ name: 'api.accounts.firefox.com (prod)' },
{ name: 'services.mozilla.com (test)' },
{ name: 'services.mozilla.com (prod)' },
moz_flags
]
};