All Projects → oliviertassinari → Browser Metrics

oliviertassinari / Browser Metrics

A collection of metrics tools for measuring performance ⚡️

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Browser Metrics

Angular Performance Checklist
⚡ Cheatsheet for developing lightning fast progressive Angular applications
Stars: ✭ 3,725 (+3139.13%)
Mutual labels:  performance, pwa
Awesome Pagespeed Metrics
⚡Metrics to help understand page speed and user experience
Stars: ✭ 585 (+408.7%)
Mutual labels:  metrics, performance
Garie
Open source web performance
Stars: ✭ 484 (+320.87%)
Mutual labels:  metrics, performance
Hint
💡 A hinting engine for the web
Stars: ✭ 3,280 (+2752.17%)
Mutual labels:  performance, pwa
Pgtune
Pgtune - tuning PostgreSQL config by your hardware
Stars: ✭ 1,078 (+837.39%)
Mutual labels:  performance, pwa
React Shrine
"Shrine" Progressive Web App sample built with React
Stars: ✭ 322 (+180%)
Mutual labels:  performance, pwa
Swagger Stats
API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.
Stars: ✭ 559 (+386.09%)
Mutual labels:  metrics, performance
Snmpcollector
A full featured Generic SNMP data collector with Web Administration Interface for InfluxDB
Stars: ✭ 216 (+87.83%)
Mutual labels:  metrics, performance
Amplify Js
A declarative JavaScript library for application development using cloud services.
Stars: ✭ 8,539 (+7325.22%)
Mutual labels:  metrics, pwa
Browser Perf
Performance Metrics for Web Browsers
Stars: ✭ 930 (+708.7%)
Mutual labels:  metrics, performance
React Native Performance
Monitor and measure React Native performance
Stars: ✭ 269 (+133.91%)
Mutual labels:  metrics, performance
Lighthouse Batch
Run Lighthouse analysis over multiple sites in a single command
Stars: ✭ 83 (-27.83%)
Mutual labels:  performance, pwa
Wallace Cli
Pretty CSS analytics on the CLI
Stars: ✭ 281 (+144.35%)
Mutual labels:  metrics, performance
App perf
Open source application performance monitoring tool with emphasis on ease of setup and use. Providing similar functionality like NewRelic/AppNeta/Skylight etc.
Stars: ✭ 353 (+206.96%)
Mutual labels:  metrics, performance
Metered Rs
Fast, ergonomic metrics for Rust
Stars: ✭ 258 (+124.35%)
Mutual labels:  metrics, performance
Inspectit
inspectIT is the leading Open Source APM (Application Performance Management) tool for analyzing your Java (EE) applications.
Stars: ✭ 513 (+346.09%)
Mutual labels:  metrics, performance
Perfume.js
Web performance library for measuring all User-centric performance metrics
Stars: ✭ 2,533 (+2102.61%)
Mutual labels:  metrics, performance
Javamelody
JavaMelody : monitoring of JavaEE applications
Stars: ✭ 2,486 (+2061.74%)
Mutual labels:  metrics, performance
Pcp
Performance Co-Pilot
Stars: ✭ 716 (+522.61%)
Mutual labels:  metrics, performance
Pwmetrics
Progressive web metrics at your fingertipz
Stars: ✭ 1,243 (+980.87%)
Mutual labels:  metrics, performance

browser-metrics

A collection of metrics tools for measuring performance.

npm version npm downloads Build Status

Dependencies DevDependencies

Installation

npm install --save-dev browser-metrics

The problem solved

This module helps getting insight about how your app performs in production.

browsingMetrics

What does it do?

This function is intended to measure the following metrics:

  • Time to first byte (timeToFirstByte). It represents how long users have waited to get the first byte from the server
  • Time to first paint (timeToFirstPaint). It represents how long users have waited to get the first paint on their screen.
  • Time to interactive (timeToInteractive). This is the time elapsed between the beginning of the navigation and the call to the tool. When used in the componentDidMount hook of React, it can be used to get the time needed to get an interactive interface.

All the durations are in milliseconds and relative to the beginning of the navigation.

It takes advantage of the performance.timing model.

Example

load

Notices that research only show meaningful effect, at the product level, for the time to interaction metric. Until research shows otherwise, you should consider the other metrics as simple technical indicators. source

Usage

import browsingMetrics from 'browser-metrics/lib/browsingMetrics';
import React from 'react';

class App extends React.Component {
  componentDidMount() {
    browsingMetrics({
      trackTiming: (category, name, duration) => {
        // Now, we can send the metrics to a third party to keep track of them.
      },
      sampleRate: 20,
      log: false,
    });
  }

  render() {
    return <div>{'This is the root node of my app.'}</div>
  }
}

export default App;

API

browsingMetrics(object)

Arguments

  1. options (object)
  • trackTiming (Function): This callback property is called for each collected metrics with three arguments
    • category (string): Is load.
    • name (string): name of the metric being collected.
    • duration (number): duration measured for this metric.
  • [sampleRate=100] (number): It can be used to sample the data send to a third party. It's expressed in percentage. The data aren't sampled. E.g. when used with the timing API of Google Analytics, you might want to send a portion of the data.
  • [log=false] (boolean): When turned to true the collected data are displayed in the console.

Browser support

Metric IE Edge Firefox Chrome Safari
timeToFirstByte >= 10 >= 38 >= 25 x
timeToFirstPaint >= 10 x >= 12 x
timeToInteractive >= 10 >= 38 >= 25 x

Metric

What does it do?

This class is intended to help to measure the time spent in transactions. It's a simple helper around the User Timing API and the high resolution Performance.now() method.

For browsers that support the mark API, the transaction also appears in the DevTools. E.g. with Chrome:

dev tool

Usage

import Metric from 'browser-metrics/lib/Metric';

const metric = new Metric('ACCOUNT_DETAIL_FETCH');
metric.start();

// Do the CPU consuming work.

metric.end();
console.log(metric.duration); // 14.4 ms

API

Metric(Class)

duration(number)

Returns the duration of the timing metric or -1 if there a measurement has not been made.

start(Function)

Call to begin a measurement.

end(Function)

Call to end a measurement.

Browser support

Feature IE Edge Firefox Chrome Safari
performance.now >= 10 >= 15 >= 20 >= 8
performance.mark >= 10 >= 41 >= 43 x

reduxMetricsMiddelware

What does it do?

This is a redux middleware. Redux has a nice design property, actions are performed synchronously in a transaction. That allow us to measure the time spent in each action.

When used with react-redux and the current react-dom reconciliation algorithm the time also take into account the render calls down the virtual DOM tree.

Example

redux

Usage

import metricsMiddleware from 'browser-metrics/lib/reduxMetricsMiddleware';
import { createStore, applyMiddleware } from 'redux';
const rootReducer = (store) => store;

const store = createStore(
  rootReducer,
  applyMiddleware(metricsMiddleware({
    trackTiming: (category, name, duration) => {
      // Now, we can send the metrics to a third party to keep track of them.
    },
    minDuration: 50,
  }))
);

API

metricsMiddleware(object)

Arguments

  1. options (object)
  • trackTiming (Function): This callback property is called for each collected metrics with three arguments
    • category (string): Is redux.
    • name (string): name of the metric being collected.
    • duration (number): duration measured for this metric.
  • [minDuration=50] (number): It can be used to ignore non significant actions. An action must have a duration higher to minDuration to be reported.

Google Analytics

Metrics can be reported to Google Analytics using the User Timing section. E.g. with the analytics.js library.

// https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings
window.ga('send', {
  hitType: 'timing',
  timingCategory: category,
  timingVar: name,
  timingValue: duration,
});

Then, you can see the values in the UI.

Google Analytics

Notices the you shouldn't be using the mean as a performance indicator. Using the mediam (50th percentile) would be a much better indicator.

Ressources

Credit

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].