npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rum-client-js

v1.1.9

Published

A light weighted client side library to enable RUM(Real User Monitoring) for web applications

Downloads

15

Readme

A light weighted client side library to enable RUM(Real User Monitoring) for web applications.

Installation

Using npm:

$ npm i --save rum-client-js

Motivation

  1. How will you compare how my application is performing on different browsers and their versions.
  2. Which resources are blocking my main thread and increasing first paint/interaction time?
  3. Are my resources properly encoded and compressed before sending to client?
  4. How to monitor application performance post deployments? Many more..

Quick Start

// Load the script's in the head section of the page
<script src="./path-to-script/rum-client-js/dist/rum-client.min.js"></script>
<script type="application/javascript">
    let RUMObject = new TrackPerformance({
        trackUrl: `${window.location.origin}/api/track`, // Endpoint at which collected data is sent
        batchSize: 50, // max entry batch size sent to server
        threshold: 3000, // in ms
        includeHosts: [ // consider entries from these hosts only
            'myapp.com'
        ],
        excludeHosts: [ // skip entries from these hosts (only works if includeHosts is not given)
            'fonts.googleapis.com',
            'themes.googleusercontent.com',
            'fonts.gstatic.com',
            'googletagmanager.com',
            'google-analytics.com'
        ],
        parserCb: (entry) => {
            // if you want to edit/add extra parameters to each entry
            return entry;
        },
        filterCb: (entry) => {
            // if you want to skip entry collection based on some condition
            return true;
        },
        addAdditionalData: () => {
            // if you want to add common tags for all entries
            return {
                tags: {
                    "user-agent": navigator.userAgent,
                    "app-version": "1.0.0"
                }
            };
        },
        excludeKeys: ['nextHopProtocol', 'initiatorType'] // exclude keys from each entry
    });

    // If you want to stop tracking manually, use below code
    // RUMObject.stop();
</script>

Save Your Sweat

Library internally compute and expose below mentioned metrics for each entry.

    1. DNS Time - entry.dnsTime
    2. Connection time - entry.connectionTime
    3. TLS time - entry.tlsTime
    4. Time to First Byte (TTFB) - entry.ttfb
    5. Fetch Time - entry.fetchTime
    6. Worker Time - entry.workerTime
    7. Total Time entry.totalTime
    8. Download Time - entry.downloadTime
    9. Header Size - entry.headerSize
    10. Compression Ratio - entry.compressionRatio
    11. DOM Content Load Time - entry.DOMContentLoadTime // For entry.entryType === "navigation"
    12. Page Load Time - entry.pageLoadTime // For entry.entryType === "navigation"

Monitor Metrics

The collected data will be available at the configured URL (trackUrl). You can use the data points to create UI as per requirements. Below is one such implementation where I have piped the data points to a Data Source(Prometheus) and plotted the metrics against a UI(Grafana)

Metrics Metrics