sitespeedio / sitespeed.io

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.
https://www.sitespeed.io/
MIT License
4.75k stars 603 forks source link

My another question is I wanted do monitor my live website for some period of time ex - 10min. And wanted sitespeed performance result for that 10 min. So how can I achieve this form the sitespeed. #4155

Open MadhanIncred opened 5 months ago

MadhanIncred commented 5 months ago

Your question

This code I got from chatgpt. Lemme know is this correct. also after running this I'm facing some error as mentioned below.

import {run} from 'sitespeed.io'; import fs from 'fs'; import path from 'path';

const outputFolder1= 'demoresult'; if(!fs.existsSync(outputFolder1)) {
fs.mkdirSync(outputFolder1); }

// const { run } = require('sitespeed.io'); // Configuration options const options = { urls: ['https://qa-www.incred.com'], // URL(s) to monitor outputFolder: outputFolder1, // Directory to save results deep: 1, // Depth of URLs to fetch (1 for the specified URLs only) html: true, // Save HTML result files

// Configuration for Metrics
metrics: {
  timing: true, // Enable timing metrics (e.g., TTFB, FCP, TTI, etc.)
  custom: [], // Specify custom metrics to collect (optional)
},

budget: {
  "browsertime.alias": 200
},

reportCategories: ['performance'], // Specify categories of metrics to include in the reports

}; // Function to run Sitespeed.io and continuously monitor async function runAndMonitor() { try { // Run Sitespeed.io with the specified options await run(options); // Wait for a specific interval before running again (e.g., 5 minutes) await sleep(3000); // 300000 milliseconds = 5 minutes // Run Sitespeed.io again for continuous monitoring runAndMonitor(); } catch (error) { console.error('Error:', error); } } // Helper function to sleep for a specified duration (milliseconds) function sleep() { return new Promise(resolve => setTimeout(resolve, 300000)); } // Start the monitoring process runAndMonitor();

ERROR

2024-05-14 16:13:13] ERROR: TypeError: Cannot read properties of undefined (reading 'budget') at BudgetPlugin.processMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/plugins/budget/index.js:46:18) at file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:228:32 at drainItem (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:96:21) at Immediate.drain [as _onImmediate] (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:77:84) at process.processImmediate (node:internal/timers:476:21) [2024-05-14 16:13:13] ERROR: TypeError: Cannot read properties of undefined (reading 'budget') at BudgetPlugin.processMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/plugins/budget/index.js:46:18) at file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:228:32 at drainItem (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:96:21) at Immediate.drain [as _onImmediate] (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:77:84) at process.processImmediate (node:internal/timers:476:21) [2024-05-14 16:13:13] INFO: The server responded with a 403 status code for https://qa-www.incred.com/home/ [2024-05-14 16:13:13] INFO: The server responded with a 403 status code for https://qa-www.incred.com/home/ [2024-05-14 16:13:13] INFO: The server responded with a 403 status code for https://qa-www.incred.com/home/ [2024-05-14 16:13:13] ERROR: TypeError: Cannot read properties of undefined (reading 'budget') at BudgetPlugin.processMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/plugins/budget/index.js:46:18) at file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:228:32 at drainItem (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:96:21) at Immediate.drain [as _onImmediate] (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:77:84) at process.processImmediate (node:internal/timers:476:21) [2024-05-14 16:13:13] ERROR: Error: Multiple summary messages of type aggregateassets.summary and group total at validateSummaryMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:70:11) at validateMessageFormat (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:88:3) at QueueHandler.postMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:201:5) at AssetsPlugin.processMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/plugins/assets/index.js:56:19) at file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:228:32 at drainItem (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:96:21) at Immediate.drain [as _onImmediate] (/Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/concurrent-queue/index.js:77:84) at process.processImmediate (node:internal/timers:476:21) Waiting for the debugger to disconnect... file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:70 throw new Error( ^

Error: Multiple summary messages of type browsertime.summary and group total at validateSummaryMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:70:11) at validateMessageFormat (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:88:3) at QueueHandler.postMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/core/queueHandler.js:201:5) at BrowsertimePlugin.sendMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/node_modules/@sitespeed.io/plugin/plugin.js:110:23) at BrowsertimePlugin.processMessage (file:///Users/madhanumesh/Desktop/GitLoad/LoadTesting/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:614:19) at runNextTicks (node:internal/process/task_queues:60:5) at process.processImmediate (node:internal/timers:447:9)

soulgalore commented 5 months ago

If you are not used to Node it's better to use the pre made Docker container or sitespeed.io installed globally. For example you have some examples here: https://www.sitespeed.io/documentation/sitespeed.io/continuously-run-your-tests/

Else I would recommend to start simple by just try to run sitespeed.io and you can follow the instructions here: https://www.sitespeed.io/documentation/sitespeed.io/installation/ to get the correct things installed.