sitespeed.io 34.1.2 → 34.2.0

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.
@@ -71,9 +71,9 @@ jobs:
71
71
  - name: Run test without a CLI
72
72
  run: xvfb-run node test/runWithoutCli.js
73
73
  - name: Run test with Influx 1.8
74
- run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --xvfb --logToFile
74
+ run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --xvfb --logToFile --resultBaseUrl https://result.sitespeed.io --influxdb.annotationScreenshot=true
75
75
  - name: Run test with Influx 2.6.1
76
- run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --influxdb.port 8087 --influxdb.version 2 --influxdb.organisation sitespeed --influxdb.token sitespeed --xvfb
76
+ run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --influxdb.port 8087 --influxdb.version 2 --influxdb.organisation sitespeed --influxdb.token sitespeed --xvfb --resultBaseUrl https://result.sitespeed.io --influxdb.annotationScreenshot=true
77
77
  - name: Run Chrome test with config
78
78
  run: node bin/sitespeed.js --config test/exampleConfig.json http://127.0.0.1:3001/simple/ --xvfb
79
79
  - name: Run Chrome test using compare plugin
@@ -12,7 +12,7 @@ jobs:
12
12
  if: ${{ !contains(github.event.head_commit.message, 'docs:') }}
13
13
  strategy:
14
14
  matrix:
15
- node-version: [18.x, 20.x]
15
+ node-version: [18.x, 20.x, 22.x]
16
16
  steps:
17
17
  - uses: actions/checkout@v4
18
18
  - name: Use Node.js ${{ matrix.node-version }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # CHANGELOG - sitespeed.io (we use [semantic versioning](https://semver.org))
2
2
 
3
+ ## 34.2.0 - 2024-06-14
4
+
5
+ ### Added
6
+ * Updated to Browsertime 22.5.0 [#4187](https://github.com/sitespeedio/sitespeed.io/pull/4187).
7
+ * Updated to Firefox 127 and Chrome/Chromedriver 126 [#4185](https://github.com/sitespeedio/sitespeed.io/pull/4185)
8
+
9
+ ### Fixed
10
+ * Fix for InfluxDBv2 to send annotations. Thank you [pavel bairov](https://github.com/Amerousful) for PR [#4175](https://github.com/sitespeedio/sitespeed.io/pull/4175).
11
+
12
+ * Fix log output when using `--preWarmServer`, thank you [ThimoCap](https://github.com/ThimoCap) for PR [#4183](https://github.com/sitespeedio/sitespeed.io/pull/4183)
13
+
3
14
  ## 34.1.2 - 2024-06-12
4
15
  ### Fixed
5
16
  * Using `--preWarmServer` resulted in trying to use an Android phone to prewarm. Fixed in [#4182](https://github.com/sitespeedio/sitespeed.io/pull/4182).
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM sitespeedio/webbrowsers:chrome-125.0-firefox-126.0-edge-124.0
1
+ FROM sitespeedio/webbrowsers:chrome-126.0-firefox-127.0-edge-125.0
2
2
 
3
3
  ARG TARGETPLATFORM=linux/amd64
4
4
 
@@ -59,7 +59,7 @@ async function preWarmServer(urls, options, scriptOrMultiple) {
59
59
  const engine = new BrowsertimeEngine(preWarmOptions);
60
60
 
61
61
  await engine.start();
62
- log.info('Start pre-testing/warming' + urls);
62
+ log.info('Start pre-testing/warming ' + urls);
63
63
  await (scriptOrMultiple
64
64
  ? engine.runMultiple(urls, {})
65
65
  : engine.run(urls, {}));
@@ -5,7 +5,8 @@ import dayjs from 'dayjs';
5
5
  import { SitespeedioPlugin } from '@sitespeed.io/plugin';
6
6
  import { InfluxDBSender as Sender } from './sender.js';
7
7
  import { InfluxDB2Sender as SenderV2 } from './senderV2.js';
8
- import { send } from './send-annotation.js';
8
+ import { sendV1 } from './send-annotation.js';
9
+ import { sendV2 } from './send-annotationV2.js';
9
10
  import { InfluxDBDataGenerator as DataGenerator } from './data-generator.js';
10
11
  import { throwIfMissing } from '../../support/util.js';
11
12
 
@@ -137,18 +138,31 @@ export default class InfluxDBPlugin extends SitespeedioPlugin {
137
138
  );
138
139
  this.receivedTypesThatFireAnnotations[message.url] = 0;
139
140
 
140
- return send(
141
- message.url,
142
- message.group,
143
- absolutePagePath,
144
- this.useScreenshots,
145
- this.screenshotType,
146
- // Browsertime pass on when the first run was done for that URL
147
- message.runTime,
148
- this.alias,
149
- this.usingBrowsertime,
150
- this.options
151
- );
141
+ return this.options.influxdb.version == 2
142
+ ? sendV2(
143
+ message.url,
144
+ message.group,
145
+ absolutePagePath,
146
+ this.useScreenshots,
147
+ this.screenshotType,
148
+ // Browsertime pass on when the first run was done for that URL
149
+ message.runTime,
150
+ this.alias,
151
+ this.usingBrowsertime,
152
+ this.options
153
+ )
154
+ : sendV1(
155
+ message.url,
156
+ message.group,
157
+ absolutePagePath,
158
+ this.useScreenshots,
159
+ this.screenshotType,
160
+ // Browsertime pass on when the first run was done for that URL
161
+ message.runTime,
162
+ this.alias,
163
+ this.usingBrowsertime,
164
+ this.options
165
+ );
152
166
  }
153
167
  });
154
168
  } else {
@@ -13,7 +13,7 @@ import {
13
13
 
14
14
  const log = intel.getLogger('sitespeedio.plugin.influxdb');
15
15
 
16
- export function send(
16
+ export function sendV1(
17
17
  url,
18
18
  group,
19
19
  absolutePagePath,
@@ -0,0 +1,101 @@
1
+ import http from 'node:http';
2
+ import https from 'node:https';
3
+
4
+ import intel from 'intel';
5
+ import dayjs from 'dayjs';
6
+
7
+ import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
8
+ import {
9
+ getAnnotationMessage,
10
+ getTagsAsString
11
+ } from '../../support/annotationsHelper.js';
12
+
13
+ const log = intel.getLogger('sitespeedio.plugin.influxdb');
14
+
15
+ export function sendV2(
16
+ url,
17
+ group,
18
+ absolutePagePath,
19
+ screenShotsEnabledInBrowsertime,
20
+ screenshotType,
21
+ runTime,
22
+ alias,
23
+ usingBrowsertime,
24
+ options
25
+ ) {
26
+ // The tags make it possible for the dashboard to use the
27
+ // templates to choose which annotations that will be showed.
28
+ // That's why we need to send tags that matches the template
29
+ // variables in Grafana.
30
+ const connectivity = getConnectivity(options);
31
+ const browser = options.browser;
32
+ const urlAndGroup = getURLAndGroup(
33
+ options,
34
+ group,
35
+ url,
36
+ options.influxdb.includeQueryParams,
37
+ alias
38
+ ).split('.');
39
+ let tags = [connectivity, browser, urlAndGroup[0], urlAndGroup[1]];
40
+
41
+ if (options.slug) {
42
+ tags.push(options.slug);
43
+ }
44
+
45
+ const message = getAnnotationMessage(
46
+ absolutePagePath,
47
+ screenShotsEnabledInBrowsertime,
48
+ screenshotType,
49
+ undefined,
50
+ usingBrowsertime,
51
+ options
52
+ );
53
+ const timestamp = runTime
54
+ ? Math.round(dayjs(runTime) / 1000)
55
+ : Math.round(dayjs() / 1000);
56
+ // if we have a category, let us send that category too
57
+ if (options.influxdb.tags) {
58
+ for (let row of options.influxdb.tags.split(',')) {
59
+ const keyAndValue = row.split('=');
60
+ tags.push(keyAndValue[1]);
61
+ }
62
+ }
63
+ const influxDBTags = getTagsAsString(tags);
64
+ const postData = `events title="Sitespeed.io",text="${message}",tags=${influxDBTags} ${timestamp}`;
65
+ const postOptions = {
66
+ hostname: options.influxdb.host,
67
+ port: options.influxdb.port,
68
+ path: `/api/v2/write?org=${options.influxdb.organisation}&bucket=${options.influxdb.database}&precision=s`,
69
+ method: 'POST',
70
+ headers: {
71
+ 'Content-Type': 'application/x-www-form-urlencoded',
72
+ 'Content-Length': Buffer.byteLength(postData),
73
+ Authorization: `Token ${options.influxdb.token}`
74
+ }
75
+ };
76
+
77
+ return new Promise((resolve, reject) => {
78
+ log.debug('Send annotation to Influx: %j', postData);
79
+ // not perfect but maybe work for us
80
+ const library = options.influxdb.protocol === 'https' ? https : http;
81
+ const request = library.request(postOptions, res => {
82
+ if (res.statusCode === 204) {
83
+ res.setEncoding('utf8');
84
+ log.debug('Sent annotation to InfluxDB');
85
+ resolve();
86
+ } else {
87
+ const e = new Error(
88
+ `Got ${res.statusCode} from InfluxDB when sending annotation ${res.statusMessage}`
89
+ );
90
+ log.warn(e.message);
91
+ reject(e);
92
+ }
93
+ });
94
+ request.on('error', error => {
95
+ log.error('Got error from InfluxDB when sending annotation', error);
96
+ reject(error);
97
+ });
98
+ request.write(postData);
99
+ request.end();
100
+ });
101
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "sitespeed.io",
3
- "version": "34.1.2",
3
+ "version": "34.2.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "sitespeed.io",
9
- "version": "34.1.2",
9
+ "version": "34.2.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-s3": "3.564.0",
@@ -15,7 +15,7 @@
15
15
  "@sitespeed.io/plugin": "0.0.6",
16
16
  "@tgwf/co2": "0.14.4",
17
17
  "axe-core": "4.9.1",
18
- "browsertime": "22.4.0",
18
+ "browsertime": "22.5.0",
19
19
  "cli-color": "2.0.4",
20
20
  "coach-core": "8.0.2",
21
21
  "concurrent-queue": "7.0.2",
@@ -2063,9 +2063,9 @@
2063
2063
  }
2064
2064
  },
2065
2065
  "node_modules/@sitespeed.io/chromedriver": {
2066
- "version": "125.0.6422-60",
2067
- "resolved": "https://registry.npmjs.org/@sitespeed.io/chromedriver/-/chromedriver-125.0.6422-60.tgz",
2068
- "integrity": "sha512-UxAxq8eJ5H11nzQScLn7yoce9tTa+E2MOn+yRuDO+gEph+r5JUJkc5f7jKBeSN2dlCUD8Fp3RHLRaWqOX4PeRQ==",
2066
+ "version": "126.0.6478-55",
2067
+ "resolved": "https://registry.npmjs.org/@sitespeed.io/chromedriver/-/chromedriver-126.0.6478-55.tgz",
2068
+ "integrity": "sha512-+TLK/AFaEcbajJrDSmq+xbVdkcegC9HDhD1m447km1kgvzeukfVpuIAZbWQEuJyX+VUB2McbRB58AcOay4FfYQ==",
2069
2069
  "hasInstallScript": true,
2070
2070
  "dependencies": {
2071
2071
  "node-downloader-helper": "2.1.9",
@@ -3536,13 +3536,13 @@
3536
3536
  }
3537
3537
  },
3538
3538
  "node_modules/browsertime": {
3539
- "version": "22.4.0",
3540
- "resolved": "https://registry.npmjs.org/browsertime/-/browsertime-22.4.0.tgz",
3541
- "integrity": "sha512-UdJh7OTXWHiCeP56lGDd76vGUOT5VadQ5YUJmlhA1mwpsocAqhtM4qoMWwbh0FZq4IjF9Jct8qEQx6sWC5XMww==",
3539
+ "version": "22.5.0",
3540
+ "resolved": "https://registry.npmjs.org/browsertime/-/browsertime-22.5.0.tgz",
3541
+ "integrity": "sha512-lr2xFJJs95L3Uq3vyfDIbHO+GX5ZmGegZnumQWCoa2m82AyICppm/10PGgBVa4YHWjW/qkXLMk+aHhYqpXibPg==",
3542
3542
  "dependencies": {
3543
3543
  "@cypress/xvfb": "1.2.4",
3544
3544
  "@devicefarmer/adbkit": "3.2.6",
3545
- "@sitespeed.io/chromedriver": "125.0.6422-60",
3545
+ "@sitespeed.io/chromedriver": "126.0.6478-55",
3546
3546
  "@sitespeed.io/edgedriver": "125.0.2535-47",
3547
3547
  "@sitespeed.io/geckodriver": "0.34.0",
3548
3548
  "@sitespeed.io/throttle": "5.0.0",
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "sitespeed.io": "./bin/sitespeed.js",
6
6
  "sitespeed.io-wpr": "./bin/browsertimeWebPageReplay.js"
7
7
  },
8
- "version": "34.1.2",
8
+ "version": "34.2.0",
9
9
  "description": "sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.",
10
10
  "keywords": [
11
11
  "performance",
@@ -85,7 +85,7 @@
85
85
  "@tgwf/co2": "0.14.4",
86
86
  "@aws-sdk/client-s3": "3.564.0",
87
87
  "axe-core": "4.9.1",
88
- "browsertime": "22.4.0",
88
+ "browsertime": "22.5.0",
89
89
  "coach-core": "8.0.2",
90
90
  "cli-color": "2.0.4",
91
91
  "concurrent-queue": "7.0.2",