macbre / phantomas

Headless Chromium-based web performance metrics collector and monitoring tool
https://www.npmjs.com/package/phantomas
BSD 2-Clause "Simplified" License
2.26k stars 141 forks source link
automation chromium css developer-tools dom domquery headless-chrome http2 http3 javascript jquery metrics phantomas puppeteer webperf webperformance

phantomas [npm]() Inline docs code style: prettier Coverage Status CodeFactor

Headless Chromium-based modular web performance metrics collector. And why phantomas? Well, because :)

Requirements

Installation

Via npm

latest

npm install phantomas

This will install a recent version of Chromium supported by puppeteer module.

Via Docker

You can use phantomas Docker image:

docker pull macbre/phantomas:latest

Or you can fetch from GitHub's Containers registry

docker pull ghcr.io/macbre/phantomas:latest

Support

Foo

You can get support for phantomas via xs:code.

Usage example

const phantomas = require('phantomas'),
    promise = phantomas('http://example.com/');

promise.
    then(results => {
        console.log('Metrics', results.getMetrics());
        console.log('Offenders', results.getAllOffenders());
    }).
    catch(res => {
        console.error(res);
    });

// events handling
promise.on('recv', response => {
    console.log('Response: %s %s [%s]', response.method, response.url, response.contentType);
});

// including the custom one emitted by phantomas modules
promise.on('domQuery', (type, query) => {
        console.log('DOM query by %s - "%s"', type, query);
});

Or run ./examples/index.js.

Development version

To get the latest development version of phantomas (and install all required dependencies):

git clone git@github.com:macbre/phantomas.git
npm install

Running tests

First you need to start a local nginx container that will serve static assets used by integration tests suite. Then simply run npm t:

./test/server-start.sh
npm t

All pull requests that are filed for this repository will have tests run via GitHub Actions.

Having problems?

Please refer to /Troubleshooting.md

Features

Contributors

All the contributors

Usage

phantomas comes as a CommonJS module (see API docs) that you can use in your nodejs projects.

You can also use it as a command line tool. Run phantomas -h for more details.

Metrics

Please refer to /docs/metrics.md file for a full, up-to-date list of all available modules and metrics that phantomas emits.

For developers

Let's make Web a bit faster!

Slides

Blogosphere

Introductions to phantomas and use cases:

Videos

Utilities

Use grunt to automate daily dev tasks, including your's application web performance, via these great tools:

Stargazers over time

Stargazers over time