@elastic/synthetics 1.0.0-beta.2 → 1.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +228 -0
- package/NOTICE.txt +250 -0
- package/README.md +2 -1
- package/dist/cli.js +80 -49
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +77 -10
- package/dist/common_types.d.ts.map +1 -1
- package/dist/config.d.ts +2 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/expect.d.ts +177 -0
- package/dist/core/expect.d.ts.map +1 -0
- package/dist/core/expect.js +33 -0
- package/dist/core/expect.js.map +1 -0
- package/dist/core/gatherer.d.ts +4 -7
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +33 -9
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +0 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +2 -15
- package/dist/core/logger.js.map +1 -1
- package/dist/core/runner.d.ts +54 -45
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +173 -63
- package/dist/core/runner.js.map +1 -1
- package/dist/dsl/journey.d.ts +13 -4
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +40 -1
- package/dist/dsl/journey.js.map +1 -1
- package/dist/formatter/javascript.d.ts +73 -0
- package/dist/formatter/javascript.d.ts.map +1 -0
- package/dist/formatter/javascript.js +274 -0
- package/dist/formatter/javascript.js.map +1 -0
- package/dist/helpers.d.ts +33 -12
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +100 -46
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/parse_args.d.ts +5 -2
- package/dist/parse_args.d.ts.map +1 -1
- package/dist/parse_args.js +59 -16
- package/dist/parse_args.js.map +1 -1
- package/dist/plugins/browser-console.d.ts +5 -8
- package/dist/plugins/browser-console.d.ts.map +1 -1
- package/dist/plugins/browser-console.js +26 -7
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/network.d.ts +20 -20
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +110 -108
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +5 -5
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js +5 -5
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +11 -11
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +40 -24
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.d.ts +10 -25
- package/dist/plugins/tracing.d.ts.map +1 -1
- package/dist/plugins/tracing.js +40 -26
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/reporters/base.d.ts +0 -1
- package/dist/reporters/base.d.ts.map +1 -1
- package/dist/reporters/base.js +22 -23
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/json.d.ts +43 -7
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +181 -35
- package/dist/reporters/json.js.map +1 -1
- package/dist/sdk/lh-trace-processor.d.ts +304 -0
- package/dist/sdk/lh-trace-processor.d.ts.map +1 -0
- package/dist/sdk/lh-trace-processor.js +832 -0
- package/dist/sdk/lh-trace-processor.js.map +1 -0
- package/dist/sdk/trace-metrics.d.ts +61 -0
- package/dist/sdk/trace-metrics.d.ts.map +1 -0
- package/dist/sdk/trace-metrics.js +252 -0
- package/dist/sdk/trace-metrics.js.map +1 -0
- package/dist/sdk/trace-processor.d.ts +106 -0
- package/dist/sdk/trace-processor.d.ts.map +1 -0
- package/dist/sdk/trace-processor.js +74 -0
- package/dist/sdk/trace-processor.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1575
- package/package.json +24 -13
- package/src/cli.ts +68 -45
- package/src/common_types.ts +92 -10
- package/src/config.ts +2 -5
- package/src/core/expect.ts +187 -0
- package/src/core/gatherer.ts +44 -23
- package/src/core/index.ts +6 -6
- package/src/core/logger.ts +1 -12
- package/src/core/runner.ts +259 -112
- package/src/dsl/journey.ts +28 -6
- package/src/formatter/javascript.ts +330 -0
- package/src/helpers.ts +114 -24
- package/src/index.ts +7 -6
- package/src/parse_args.ts +97 -22
- package/src/plugins/browser-console.ts +30 -13
- package/src/plugins/network.ts +137 -144
- package/src/plugins/performance.ts +7 -7
- package/src/plugins/plugin-manager.ts +47 -36
- package/src/plugins/tracing.ts +43 -54
- package/src/reporters/base.ts +24 -23
- package/src/reporters/json.ts +251 -41
- package/src/sdk/lh-trace-processor.ts +1033 -0
- package/src/sdk/trace-metrics.ts +287 -0
- package/src/sdk/trace-processor.ts +147 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/reporters/json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/reporters/json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAMH,OAAO,YAAY,MAAM,QAAQ,CAAC;AASlC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,WAAW,EACX,MAAM,EACN,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC,aAAK,UAAU,GACX,qBAAqB,GACrB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;CACZ,CAAC;AAEF,aAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ,CAAC;AAiFF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCvD;AAkCD,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM;;;;GAoD3D;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,iBAa9C;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,YAAY;IACpD,kBAAkB;IA+KZ,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU;IAyBpE,YAAY,CACV,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,WAAW;IAuB1C,SAAS,CAAC,EACR,GAAG,EACH,OAAO,EACP,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,GAAG,GACJ,EAAE,YAAY;CAgBhB"}
|
package/dist/reporters/json.js
CHANGED
|
@@ -27,7 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.formatNetworkFields = void 0;
|
|
30
|
+
exports.gatherScreenshots = exports.getScreenshotBlocks = exports.formatNetworkFields = void 0;
|
|
31
|
+
const fs_1 = require("fs");
|
|
32
|
+
const path_1 = require("path");
|
|
33
|
+
const sharp_1 = __importDefault(require("sharp"));
|
|
34
|
+
const crypto_1 = require("crypto");
|
|
31
35
|
const base_1 = __importDefault(require("./base"));
|
|
32
36
|
const helpers_1 = require("../helpers");
|
|
33
37
|
const snakecase_keys_1 = __importDefault(require("snakecase-keys"));
|
|
@@ -154,6 +158,7 @@ function journeyInfo(journey, type, status) {
|
|
|
154
158
|
return {
|
|
155
159
|
name: journey.name,
|
|
156
160
|
id: journey.id,
|
|
161
|
+
tags: journey.tags,
|
|
157
162
|
status: type === 'journey/end' ? status : undefined,
|
|
158
163
|
};
|
|
159
164
|
}
|
|
@@ -165,20 +170,97 @@ function stepInfo(step, type, status) {
|
|
|
165
170
|
name: step.name,
|
|
166
171
|
index: step.index,
|
|
167
172
|
status: type === 'step/end' ? status : undefined,
|
|
173
|
+
duration: step.duration,
|
|
168
174
|
};
|
|
169
175
|
}
|
|
176
|
+
async function getScreenshotBlocks(screenshot) {
|
|
177
|
+
const img = sharp_1.default(screenshot, { sequentialRead: true });
|
|
178
|
+
const { width, height } = await img.metadata();
|
|
179
|
+
/**
|
|
180
|
+
* Chop the screenshot image (1280*720) which is the default
|
|
181
|
+
* viewport size in to 64 equal blocks for a given image
|
|
182
|
+
* which can be acheived by keeping the division to 8
|
|
183
|
+
*
|
|
184
|
+
* Changing division to 16 would yield us 256 smaller blocks, but it is not
|
|
185
|
+
* optimal for caching in the ES and proved out to be bad, so we stick to 8
|
|
186
|
+
*/
|
|
187
|
+
const divisions = 8;
|
|
188
|
+
const blockWidth = Math.floor(width / divisions);
|
|
189
|
+
const blockHeight = Math.floor(height / divisions);
|
|
190
|
+
const reference = {
|
|
191
|
+
width,
|
|
192
|
+
height,
|
|
193
|
+
blocks: [],
|
|
194
|
+
};
|
|
195
|
+
const blocks = [];
|
|
196
|
+
for (let row = 0; row < divisions; row++) {
|
|
197
|
+
const top = row * blockHeight;
|
|
198
|
+
for (let col = 0; col < divisions; col++) {
|
|
199
|
+
const left = col * blockWidth;
|
|
200
|
+
const buf = await img
|
|
201
|
+
.extract({ top, left, width: blockWidth, height: blockHeight })
|
|
202
|
+
.jpeg()
|
|
203
|
+
.toBuffer();
|
|
204
|
+
const hash = crypto_1.createHash('sha1').update(buf).digest('hex');
|
|
205
|
+
blocks.push({
|
|
206
|
+
blob: buf.toString('base64'),
|
|
207
|
+
id: hash,
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* We dont write the width, height of individual blocks on the
|
|
211
|
+
* reference as we use similar sized blocks for each extraction,
|
|
212
|
+
* we would need to send the width and height here if we decide to
|
|
213
|
+
* go with dynamic block extraction.
|
|
214
|
+
*/
|
|
215
|
+
reference.blocks.push({
|
|
216
|
+
hash,
|
|
217
|
+
top,
|
|
218
|
+
left,
|
|
219
|
+
width: blockWidth,
|
|
220
|
+
height: blockHeight,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return { blocks, reference, blob_mime: 'image/jpeg' };
|
|
225
|
+
}
|
|
226
|
+
exports.getScreenshotBlocks = getScreenshotBlocks;
|
|
227
|
+
/**
|
|
228
|
+
* Get all the screenshots from the cached screenshot location
|
|
229
|
+
* at the end of each journey and construct equally sized blocks out
|
|
230
|
+
* of the individual screenshot image.
|
|
231
|
+
*/
|
|
232
|
+
async function gatherScreenshots(screenshotsPath, callback) {
|
|
233
|
+
if (helpers_1.isDirectory(screenshotsPath)) {
|
|
234
|
+
await helpers_1.totalist(screenshotsPath, async (_, absPath) => {
|
|
235
|
+
try {
|
|
236
|
+
const content = fs_1.readFileSync(absPath, 'utf8');
|
|
237
|
+
const screenshot = JSON.parse(content);
|
|
238
|
+
await callback(screenshot);
|
|
239
|
+
}
|
|
240
|
+
catch (_) {
|
|
241
|
+
// TODO: capture progarammatic synthetic errors under different type
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.gatherScreenshots = gatherScreenshots;
|
|
170
247
|
class JSONReporter extends base_1.default {
|
|
171
248
|
_registerListeners() {
|
|
172
249
|
/**
|
|
173
250
|
* report the number of journeys that exists on a suite which
|
|
174
251
|
* could be used for better sharding
|
|
175
252
|
*/
|
|
176
|
-
this.runner.on('start', ({ numJourneys }) => {
|
|
253
|
+
this.runner.on('start', ({ numJourneys, networkConditions }) => {
|
|
177
254
|
this.writeJSON({
|
|
178
255
|
type: 'synthetics/metadata',
|
|
179
256
|
root_fields: {
|
|
180
257
|
num_journeys: numJourneys,
|
|
181
258
|
},
|
|
259
|
+
payload: networkConditions
|
|
260
|
+
? {
|
|
261
|
+
network_conditions: networkConditions,
|
|
262
|
+
}
|
|
263
|
+
: undefined,
|
|
182
264
|
});
|
|
183
265
|
});
|
|
184
266
|
this.runner.on('journey:register', ({ journey }) => {
|
|
@@ -195,33 +277,69 @@ class JSONReporter extends base_1.default {
|
|
|
195
277
|
payload: { params, source: journey.callback.toString() },
|
|
196
278
|
});
|
|
197
279
|
});
|
|
198
|
-
this.runner.on('step:end', ({ journey, step, start, end, error,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
280
|
+
this.runner.on('step:end', ({ journey, step, start, end, error, url, status, pagemetrics, traces, metrics, filmstrips, }) => {
|
|
281
|
+
this.writeMetrics(journey, step, 'relative_trace', traces);
|
|
282
|
+
this.writeMetrics(journey, step, 'experience', metrics);
|
|
283
|
+
if (filmstrips) {
|
|
284
|
+
// Write each filmstrip separately so that we don't get documents that are too large
|
|
285
|
+
filmstrips.forEach((strip, index) => {
|
|
286
|
+
this.writeJSON({
|
|
287
|
+
type: 'step/filmstrips',
|
|
288
|
+
journey,
|
|
289
|
+
step,
|
|
290
|
+
payload: { index },
|
|
291
|
+
root_fields: {
|
|
292
|
+
browser: { relative_trace: { start: strip.start } },
|
|
293
|
+
},
|
|
294
|
+
blob: strip.blob,
|
|
295
|
+
blob_mime: strip.mime,
|
|
296
|
+
});
|
|
206
297
|
});
|
|
207
298
|
}
|
|
208
299
|
this.writeJSON({
|
|
209
300
|
type: 'step/end',
|
|
210
301
|
journey,
|
|
211
|
-
step
|
|
302
|
+
step: {
|
|
303
|
+
...step,
|
|
304
|
+
duration: {
|
|
305
|
+
us: helpers_1.getDurationInUs(end - start),
|
|
306
|
+
},
|
|
307
|
+
},
|
|
212
308
|
url,
|
|
213
309
|
error,
|
|
214
310
|
payload: {
|
|
215
311
|
source: step.callback.toString(),
|
|
216
|
-
start,
|
|
217
|
-
end,
|
|
218
312
|
url,
|
|
219
313
|
status,
|
|
220
|
-
|
|
314
|
+
pagemetrics,
|
|
221
315
|
},
|
|
222
316
|
});
|
|
223
317
|
});
|
|
224
|
-
this.runner.on('journey:end', ({ journey, start, end,
|
|
318
|
+
this.runner.on('journey:end', async ({ journey, timestamp, start, end, networkinfo, browserconsole, status, error, options, }) => {
|
|
319
|
+
const { ssblocks, screenshots } = options;
|
|
320
|
+
const writeScreenshots = screenshots === 'on' ||
|
|
321
|
+
(screenshots === 'only-on-failure' && status === 'failed');
|
|
322
|
+
if (writeScreenshots) {
|
|
323
|
+
await gatherScreenshots(path_1.join(helpers_1.CACHE_PATH, 'screenshots'), async (screenshot) => {
|
|
324
|
+
const { data, timestamp, step } = screenshot;
|
|
325
|
+
if (!data) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (ssblocks) {
|
|
329
|
+
await this.writeScreenshotBlocks(journey, screenshot);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
this.writeJSON({
|
|
333
|
+
type: 'step/screenshot',
|
|
334
|
+
timestamp,
|
|
335
|
+
journey,
|
|
336
|
+
step,
|
|
337
|
+
blob: data,
|
|
338
|
+
blob_mime: 'image/jpeg',
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
225
343
|
if (networkinfo) {
|
|
226
344
|
networkinfo.forEach(ni => {
|
|
227
345
|
const { ecs, payload } = formatNetworkFields(ni);
|
|
@@ -235,37 +353,25 @@ class JSONReporter extends base_1.default {
|
|
|
235
353
|
});
|
|
236
354
|
});
|
|
237
355
|
}
|
|
238
|
-
if (filmstrips) {
|
|
239
|
-
// Write each filmstrip separately so that we don't get documents that are too large
|
|
240
|
-
filmstrips.forEach((strip, index) => {
|
|
241
|
-
this.writeJSON({
|
|
242
|
-
type: 'journey/filmstrips',
|
|
243
|
-
journey,
|
|
244
|
-
payload: {
|
|
245
|
-
index,
|
|
246
|
-
...{
|
|
247
|
-
startTime: strip.startTime,
|
|
248
|
-
ts: strip.ts,
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
blob: strip.snapshot,
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
356
|
if (browserconsole) {
|
|
256
|
-
browserconsole.forEach(({ timestamp, text, type, step }) => {
|
|
357
|
+
browserconsole.forEach(({ timestamp, text, type, step, error }) => {
|
|
257
358
|
this.writeJSON({
|
|
258
359
|
type: 'journey/browserconsole',
|
|
259
360
|
journey,
|
|
260
361
|
timestamp,
|
|
261
362
|
step,
|
|
262
|
-
|
|
363
|
+
error,
|
|
364
|
+
payload: {
|
|
365
|
+
text,
|
|
366
|
+
type,
|
|
367
|
+
},
|
|
263
368
|
});
|
|
264
369
|
});
|
|
265
370
|
}
|
|
266
371
|
this.writeJSON({
|
|
267
372
|
type: 'journey/end',
|
|
268
373
|
journey,
|
|
374
|
+
timestamp,
|
|
269
375
|
error,
|
|
270
376
|
payload: {
|
|
271
377
|
start,
|
|
@@ -273,6 +379,45 @@ class JSONReporter extends base_1.default {
|
|
|
273
379
|
status,
|
|
274
380
|
},
|
|
275
381
|
});
|
|
382
|
+
process.nextTick(() => this.runner.emit('journey:end:reported', {}));
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
async writeScreenshotBlocks(journey, screenshot) {
|
|
386
|
+
const { blob_mime, blocks, reference } = await getScreenshotBlocks(Buffer.from(screenshot.data, 'base64'));
|
|
387
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
388
|
+
const block = blocks[i];
|
|
389
|
+
this.writeJSON({
|
|
390
|
+
type: 'screenshot/block',
|
|
391
|
+
timestamp: screenshot.timestamp,
|
|
392
|
+
_id: block.id,
|
|
393
|
+
blob: block.blob,
|
|
394
|
+
blob_mime,
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
this.writeJSON({
|
|
398
|
+
type: 'step/screenshot_ref',
|
|
399
|
+
timestamp: screenshot.timestamp,
|
|
400
|
+
journey,
|
|
401
|
+
step: screenshot.step,
|
|
402
|
+
root_fields: {
|
|
403
|
+
screenshot_ref: reference,
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
writeMetrics(journey, step, type, events) {
|
|
408
|
+
const metrics = Array.isArray(events) ? events : [events];
|
|
409
|
+
metrics.forEach(event => {
|
|
410
|
+
event &&
|
|
411
|
+
this.writeJSON({
|
|
412
|
+
type: 'step/metrics',
|
|
413
|
+
journey,
|
|
414
|
+
step,
|
|
415
|
+
root_fields: {
|
|
416
|
+
browser: {
|
|
417
|
+
[type]: event,
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
});
|
|
276
421
|
});
|
|
277
422
|
}
|
|
278
423
|
// Writes a structured synthetics event
|
|
@@ -280,9 +425,10 @@ class JSONReporter extends base_1.default {
|
|
|
280
425
|
// it before passing it into this function!
|
|
281
426
|
// The payload field is an un-indexed field with no ES mapping, so users can put arbitary structured
|
|
282
427
|
// stuff in there
|
|
283
|
-
writeJSON({ journey, type, timestamp, step, root_fields, error, payload, blob, blob_mime, url, }) {
|
|
428
|
+
writeJSON({ _id, journey, type, timestamp, step, root_fields, error, payload, blob, blob_mime, url, }) {
|
|
284
429
|
this.write({
|
|
285
430
|
type,
|
|
431
|
+
_id,
|
|
286
432
|
'@timestamp': timestamp || helpers_1.getTimestamp(),
|
|
287
433
|
journey: journeyInfo(journey, type, payload === null || payload === void 0 ? void 0 : payload.status),
|
|
288
434
|
step: stepInfo(step, type, payload === null || payload === void 0 ? void 0 : payload.status),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/reporters/json.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,kDAAkC;AAClC,wCAAuD;AAEvD,oEAA2C;AAK3C,uDAAuD;AACvD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAuCxD,SAAS,WAAW;IAClB,OAAO;QACL,EAAE,EAAE;YACF,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B;QACD,OAAO,EAAE;YACP,IAAI;YACJ,OAAO;SACR;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,QAA4B;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO;KACR;IACD,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,QAAQ,KAAK,UAAU,EAAE;QAClC,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,QAAQ,KAAK,UAAU,EAAE;QAClC,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACpC,OAAO,CAAC,CAAC;KACV;AACH,CAAC;AAED,SAAS,aAAa,CAAC,OAAiC;;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,OAAO;QACL,GAAG,OAAO;QACV,IAAI,EA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,OAAO,CAAE,MAAM,CAAC;YACpD,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC;YAC3C,WAAW,EAAE,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,EAAE;YACzD,OAAO;YACP,IAAI;YACJ,SAAS;YACT,KAAK,EAAE,qBAAW,CAAC,KAAK,CAAC;YACzB,GAAG;YACH,eAAe,EAAE,OAAO;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AAhQD,+BAgQC"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
declare class TraceProcessor {
|
|
2
|
+
static get TIMESPAN_MARKER_ID(): string;
|
|
3
|
+
/**
|
|
4
|
+
* @return {Error}
|
|
5
|
+
*/
|
|
6
|
+
static createNoNavstartError(): Error;
|
|
7
|
+
/**
|
|
8
|
+
* @return {Error}
|
|
9
|
+
*/
|
|
10
|
+
static createNoResourceSendRequestError(): Error;
|
|
11
|
+
/**
|
|
12
|
+
* @return {Error}
|
|
13
|
+
*/
|
|
14
|
+
static createNoTracingStartedError(): Error;
|
|
15
|
+
/**
|
|
16
|
+
* @return {Error}
|
|
17
|
+
*/
|
|
18
|
+
static createNoFirstContentfulPaintError(): Error;
|
|
19
|
+
/**
|
|
20
|
+
* @return {Error}
|
|
21
|
+
*/
|
|
22
|
+
static createNoLighthouseMarkerError(): Error;
|
|
23
|
+
/**
|
|
24
|
+
* Returns true if the event is a navigation start event of a document whose URL seems valid.
|
|
25
|
+
*
|
|
26
|
+
* @param {LH.TraceEvent} event
|
|
27
|
+
*/
|
|
28
|
+
static _isNavigationStartOfInterest(event: any): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* This method sorts a group of trace events that have the same timestamp. We want to...
|
|
31
|
+
*
|
|
32
|
+
* 1. Put E events first, we finish off our existing events before we start new ones.
|
|
33
|
+
* 2. Order B/X events by their duration, we want parents to start before child events.
|
|
34
|
+
* 3. If we don't have any of this to go on, just use the position in the original array (stable sort).
|
|
35
|
+
*
|
|
36
|
+
* Note that the typical group size with the same timestamp will be quite small (<10 or so events),
|
|
37
|
+
* and the number of groups typically ~1% of total trace, so the same ultra-performance-sensitive consideration
|
|
38
|
+
* given to functions that run on entire traces does not necessarily apply here.
|
|
39
|
+
*
|
|
40
|
+
* @param {number[]} tsGroupIndices
|
|
41
|
+
* @param {number[]} timestampSortedIndices
|
|
42
|
+
* @param {number} indexOfTsGroupIndicesStart
|
|
43
|
+
* @param {LH.TraceEvent[]} traceEvents
|
|
44
|
+
* @return {number[]}
|
|
45
|
+
*/
|
|
46
|
+
static _sortTimestampEventGroup(tsGroupIndices: any, timestampSortedIndices: any, indexOfTsGroupIndicesStart: any, traceEvents: any): any[];
|
|
47
|
+
/**
|
|
48
|
+
* Sorts and filters trace events by timestamp and respecting the nesting structure inherent to
|
|
49
|
+
* parent/child event relationships.
|
|
50
|
+
*
|
|
51
|
+
* @param {LH.TraceEvent[]} traceEvents
|
|
52
|
+
* @param {(e: LH.TraceEvent) => boolean} filter
|
|
53
|
+
*/
|
|
54
|
+
static filteredTraceSort(traceEvents: any, filter: any): any[];
|
|
55
|
+
/**
|
|
56
|
+
* There should *always* be at least one top level event, having 0 typically means something is
|
|
57
|
+
* drastically wrong with the trace and we should just give up early and loudly.
|
|
58
|
+
*
|
|
59
|
+
* @param {LH.TraceEvent[]} events
|
|
60
|
+
*/
|
|
61
|
+
static assertHasToplevelEvents(events: any): void;
|
|
62
|
+
/**
|
|
63
|
+
* Calculate duration at specified percentiles for given population of
|
|
64
|
+
* durations.
|
|
65
|
+
* If one of the durations overlaps the end of the window, the full
|
|
66
|
+
* duration should be in the duration array, but the length not included
|
|
67
|
+
* within the window should be given as `clippedLength`. For instance, if a
|
|
68
|
+
* 50ms duration occurs 10ms before the end of the window, `50` should be in
|
|
69
|
+
* the `durations` array, and `clippedLength` should be set to 40.
|
|
70
|
+
* @see https://docs.google.com/document/d/1b9slyaB9yho91YTOkAQfpCdULFkZM9LqsipcX3t7He8/preview
|
|
71
|
+
* @param {!Array<number>} durations Array of durations, sorted in ascending order.
|
|
72
|
+
* @param {number} totalTime Total time (in ms) of interval containing durations.
|
|
73
|
+
* @param {!Array<number>} percentiles Array of percentiles of interest, in ascending order.
|
|
74
|
+
* @param {number=} clippedLength Optional length clipped from a duration overlapping end of window. Default of 0.
|
|
75
|
+
* @return {!Array<{percentile: number, time: number}>}
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
78
|
+
static _riskPercentiles(durations: any, totalTime: any, percentiles: any, clippedLength?: number): any[];
|
|
79
|
+
/**
|
|
80
|
+
* Calculates the maximum queueing time (in ms) of high priority tasks for
|
|
81
|
+
* selected percentiles within a window of the main thread.
|
|
82
|
+
* @see https://docs.google.com/document/d/1b9slyaB9yho91YTOkAQfpCdULFkZM9LqsipcX3t7He8/preview
|
|
83
|
+
* @param {Array<ToplevelEvent>} events
|
|
84
|
+
* @param {number} startTime Start time (in ms relative to timeOrigin) of range of interest.
|
|
85
|
+
* @param {number} endTime End time (in ms relative to timeOrigin) of range of interest.
|
|
86
|
+
* @param {!Array<number>=} percentiles Optional array of percentiles to compute. Defaults to [0.5, 0.75, 0.9, 0.99, 1].
|
|
87
|
+
* @return {!Array<{percentile: number, time: number}>}
|
|
88
|
+
*/
|
|
89
|
+
static getRiskToResponsiveness(events: any, startTime: any, endTime: any, percentiles?: number[]): any[];
|
|
90
|
+
/**
|
|
91
|
+
* Provides durations in ms of all main thread top-level events
|
|
92
|
+
* @param {Array<ToplevelEvent>} topLevelEvents
|
|
93
|
+
* @param {number} startTime Optional start time (in ms relative to timeOrigin) of range of interest. Defaults to 0.
|
|
94
|
+
* @param {number} endTime Optional end time (in ms relative to timeOrigin) of range of interest. Defaults to trace end.
|
|
95
|
+
* @return {{durations: Array<number>, clippedLength: number}}
|
|
96
|
+
*/
|
|
97
|
+
static getMainThreadTopLevelEventDurations(topLevelEvents: any, startTime?: number, endTime?: number): {
|
|
98
|
+
durations: any[];
|
|
99
|
+
clippedLength: number;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Provides the top level events on the main thread with timestamps in ms relative to timeOrigin.
|
|
103
|
+
* start.
|
|
104
|
+
* @param {LH.Artifacts.ProcessedTrace} trace
|
|
105
|
+
* @param {number=} startTime Optional start time (in ms relative to timeOrigin) of range of interest. Defaults to 0.
|
|
106
|
+
* @param {number=} endTime Optional end time (in ms relative to timeOrigin) of range of interest. Defaults to trace end.
|
|
107
|
+
* @return {Array<ToplevelEvent>}
|
|
108
|
+
*/
|
|
109
|
+
static getMainThreadTopLevelEvents(trace: any, startTime?: number, endTime?: number): any[];
|
|
110
|
+
/**
|
|
111
|
+
* @param {LH.TraceEvent[]} events
|
|
112
|
+
* @return {{pid: number, tid: number, frameId: string}}
|
|
113
|
+
*/
|
|
114
|
+
static findMainFrameIds(events: any): {
|
|
115
|
+
pid: any;
|
|
116
|
+
tid: any;
|
|
117
|
+
frameId: any;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @param {LH.TraceEvent} evt
|
|
121
|
+
* @return {boolean}
|
|
122
|
+
*/
|
|
123
|
+
static isScheduleableTask(evt: any): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* @param {LH.TraceEvent} evt
|
|
126
|
+
* @return {evt is LCPEvent}
|
|
127
|
+
*/
|
|
128
|
+
static isLCPEvent(evt: any): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* @param {LH.TraceEvent} evt
|
|
131
|
+
* @return {evt is LCPCandidateEvent}
|
|
132
|
+
*/
|
|
133
|
+
static isLCPCandidateEvent(evt: any): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the maximum LCP event across all frames in `events`.
|
|
136
|
+
* Sets `invalidated` flag if LCP of every frame is invalidated.
|
|
137
|
+
*
|
|
138
|
+
* LCP's trace event was first introduced in m78. We can't surface an LCP for older Chrome versions.
|
|
139
|
+
* LCP comes from a frame's latest `largestContentfulPaint::Candidate`, but it can be invalidated by a `largestContentfulPaint::Invalidate` event.
|
|
140
|
+
*
|
|
141
|
+
* @param {LH.TraceEvent[]} events
|
|
142
|
+
* @param {LH.TraceEvent} timeOriginEvent
|
|
143
|
+
* @return {{lcp: LCPEvent | undefined, invalidated: boolean}}
|
|
144
|
+
*/
|
|
145
|
+
static computeValidLCPAllFrames(events: any, timeOriginEvent: any): {
|
|
146
|
+
lcp: any;
|
|
147
|
+
invalidated: boolean;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* @param {Array<{id: string, url: string, parent?: string}>} frames
|
|
151
|
+
* @return {Map<string, string>}
|
|
152
|
+
*/
|
|
153
|
+
static resolveRootFrames(frames: any): Map<any, any>;
|
|
154
|
+
/**
|
|
155
|
+
* Finds key trace events, identifies main process/thread, and returns timings of trace events
|
|
156
|
+
* in milliseconds since the time origin in addition to the standard microsecond monotonic timestamps.
|
|
157
|
+
* @param {LH.Trace} trace
|
|
158
|
+
* @param {{timeOriginDeterminationMethod?: TimeOriginDeterminationMethod}} [options]
|
|
159
|
+
* @return {LH.Artifacts.ProcessedTrace}
|
|
160
|
+
*/
|
|
161
|
+
static processTrace(trace: any, options: any): {
|
|
162
|
+
frames: {
|
|
163
|
+
id: any;
|
|
164
|
+
url: any;
|
|
165
|
+
parent: any;
|
|
166
|
+
}[];
|
|
167
|
+
mainThreadEvents: any[];
|
|
168
|
+
frameEvents: any[];
|
|
169
|
+
frameTreeEvents: any[];
|
|
170
|
+
processEvents: any[];
|
|
171
|
+
mainFrameIds: {
|
|
172
|
+
pid: any;
|
|
173
|
+
tid: any;
|
|
174
|
+
frameId: any;
|
|
175
|
+
};
|
|
176
|
+
timeOriginEvt: any;
|
|
177
|
+
timings: {
|
|
178
|
+
timeOrigin: number;
|
|
179
|
+
traceEnd: number;
|
|
180
|
+
};
|
|
181
|
+
timestamps: {
|
|
182
|
+
timeOrigin: any;
|
|
183
|
+
traceEnd: number;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Finds key navigation trace events and computes timings of events in milliseconds since the time
|
|
188
|
+
* origin in addition to the standard microsecond monotonic timestamps.
|
|
189
|
+
* @param {LH.Artifacts.ProcessedTrace} processedTrace
|
|
190
|
+
* @return {LH.Artifacts.ProcessedNavigation}
|
|
191
|
+
*/
|
|
192
|
+
static processNavigation(processedTrace: any): {
|
|
193
|
+
timings: {
|
|
194
|
+
timeOrigin: any;
|
|
195
|
+
firstPaint: number;
|
|
196
|
+
firstContentfulPaint: number;
|
|
197
|
+
firstContentfulPaintAllFrames: number;
|
|
198
|
+
firstMeaningfulPaint: number;
|
|
199
|
+
largestContentfulPaint: number;
|
|
200
|
+
largestContentfulPaintAllFrames: number;
|
|
201
|
+
load: number;
|
|
202
|
+
domContentLoaded: number;
|
|
203
|
+
traceEnd: any;
|
|
204
|
+
};
|
|
205
|
+
timestamps: {
|
|
206
|
+
timeOrigin: any;
|
|
207
|
+
firstPaint: any;
|
|
208
|
+
firstContentfulPaint: any;
|
|
209
|
+
firstContentfulPaintAllFrames: any;
|
|
210
|
+
firstMeaningfulPaint: any;
|
|
211
|
+
largestContentfulPaint: any;
|
|
212
|
+
largestContentfulPaintAllFrames: any;
|
|
213
|
+
load: any;
|
|
214
|
+
domContentLoaded: any;
|
|
215
|
+
traceEnd: any;
|
|
216
|
+
};
|
|
217
|
+
firstPaintEvt: any;
|
|
218
|
+
firstContentfulPaintEvt: any;
|
|
219
|
+
firstContentfulPaintAllFramesEvt: any;
|
|
220
|
+
firstMeaningfulPaintEvt: any;
|
|
221
|
+
largestContentfulPaintEvt: any;
|
|
222
|
+
largestContentfulPaintAllFramesEvt: any;
|
|
223
|
+
loadEvt: any;
|
|
224
|
+
domContentLoadedEvt: any;
|
|
225
|
+
fmpFellBack: boolean;
|
|
226
|
+
lcpInvalidated: boolean;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Computes the last observable timestamp in a set of trace events.
|
|
230
|
+
*
|
|
231
|
+
* @param {Array<LH.TraceEvent>} events
|
|
232
|
+
* @param {LH.TraceEvent} timeOriginEvt
|
|
233
|
+
* @return {{timing: number, timestamp: number}}
|
|
234
|
+
*/
|
|
235
|
+
static computeTraceEnd(events: any, timeOriginEvt: any): {
|
|
236
|
+
timestamp: number;
|
|
237
|
+
timing: number;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Computes the time origin using the specified method.
|
|
241
|
+
*
|
|
242
|
+
* - firstResourceSendRequest
|
|
243
|
+
* Uses the time that the very first network request is sent in the main frame.
|
|
244
|
+
* Eventually should be used in place of lastNavigationStart as the default for navigations.
|
|
245
|
+
* This method includes the cost of all redirects when evaluating a navigation (which matches lantern behavior).
|
|
246
|
+
* The only difference between firstResourceSendRequest and the first `navigationStart` is
|
|
247
|
+
* the unload time of `about:blank` (which is a Lighthouse implementation detail and shouldn't be included).
|
|
248
|
+
*
|
|
249
|
+
* - lastNavigationStart
|
|
250
|
+
* Uses the time of the last `navigationStart` event in the main frame.
|
|
251
|
+
* The historical time origin of Lighthouse from 2016-Present.
|
|
252
|
+
* This method excludes the cost of client-side redirects when evaluating a navigation.
|
|
253
|
+
* Can also be skewed by several hundred milliseconds or even seconds when the browser takes a long
|
|
254
|
+
* time to unload `about:blank`.
|
|
255
|
+
*
|
|
256
|
+
* @param {{keyEvents: Array<LH.TraceEvent>, frameEvents: Array<LH.TraceEvent>, mainFrameIds: {frameId: string}}} traceEventSubsets
|
|
257
|
+
* @param {TimeOriginDeterminationMethod} method
|
|
258
|
+
* @return {LH.TraceEvent}
|
|
259
|
+
*/
|
|
260
|
+
static computeTimeOrigin(traceEventSubsets: any, method: any): any;
|
|
261
|
+
/**
|
|
262
|
+
* Computes timings of trace events of key trace events in milliseconds since the time origin
|
|
263
|
+
* in addition to the standard microsecond monotonic timestamps.
|
|
264
|
+
* @param {Array<LH.TraceEvent>} frameEvents
|
|
265
|
+
* @param {{timeOriginEvt: LH.TraceEvent}} options
|
|
266
|
+
*/
|
|
267
|
+
static computeNavigationTimingsForFrame(frameEvents: any, options: any): {
|
|
268
|
+
timings: {
|
|
269
|
+
timeOrigin: number;
|
|
270
|
+
firstPaint: number;
|
|
271
|
+
firstContentfulPaint: number;
|
|
272
|
+
firstMeaningfulPaint: number;
|
|
273
|
+
largestContentfulPaint: number;
|
|
274
|
+
load: number;
|
|
275
|
+
domContentLoaded: number;
|
|
276
|
+
};
|
|
277
|
+
timestamps: {
|
|
278
|
+
timeOrigin: any;
|
|
279
|
+
firstPaint: any;
|
|
280
|
+
firstContentfulPaint: any;
|
|
281
|
+
firstMeaningfulPaint: any;
|
|
282
|
+
largestContentfulPaint: any;
|
|
283
|
+
load: any;
|
|
284
|
+
domContentLoaded: any;
|
|
285
|
+
};
|
|
286
|
+
timeOriginEvt: any;
|
|
287
|
+
firstPaintEvt: any;
|
|
288
|
+
firstContentfulPaintEvt: any;
|
|
289
|
+
firstMeaningfulPaintEvt: any;
|
|
290
|
+
largestContentfulPaintEvt: any;
|
|
291
|
+
loadEvt: any;
|
|
292
|
+
domContentLoadedEvt: any;
|
|
293
|
+
fmpFellBack: boolean;
|
|
294
|
+
lcpInvalidated: boolean;
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
export default TraceProcessor;
|
|
298
|
+
/**
|
|
299
|
+
* @typedef ToplevelEvent
|
|
300
|
+
* @prop {number} start
|
|
301
|
+
* @prop {number} end
|
|
302
|
+
* @prop {number} duration
|
|
303
|
+
*/
|
|
304
|
+
//# sourceMappingURL=lh-trace-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lh-trace-processor.d.ts","sourceRoot":"","sources":["../../src/sdk/lh-trace-processor.ts"],"names":[],"mappings":"AAyCA,cAAM,cAAc;IAClB,MAAM,KAAK,kBAAkB,WAE5B;IAED;;OAEG;IACH,MAAM,CAAC,qBAAqB;IAI5B;;OAEG;IACH,MAAM,CAAC,gCAAgC;IAIvC;;OAEG;IACH,MAA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