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 🙏

© 2026 – Pkg Stats / Ryan Hefner

k6-custom-metrics-dashboard

v0.1.3

Published

Real-time dashboard for k6 custom metrics. Automatically discovers and groups metrics by suffix.

Readme

k6 custom metrics dashboard

Real-time, zero-configuration, zero-dependency browser dashboard for k6 custom metrics.

TL;DR

Name your custom metrics with a shared suffix — the suffix becomes the chart, the prefix becomes the series. No configuration needed.

homepage_http_req_duration  ─┐
                             ├── chart: "http req duration" (series: homepage, user)
user_http_req_duration      ─┘

How it works

Run your k6 test with --out json=results.json. The dashboard tails the file in real time and creates charts on the fly.

homepage_http_req_duration  ─┐
user_http_req_duration      ─┤── chart: "http req duration" (series: homepage, user)

homepage_error_rate         ─┐
user_error_rate             ─┤── chart: "error rate" (series: homepage, user)

Metrics are grouped by their longest common suffix (split by _). The prefix becomes the series name within the chart. Metrics with a unique name get their own chart.

k6 built-in metrics (http_reqs, vus, iterations, etc.) are shown in charts by default but excluded from the summary table. Set K6_HIDE_BUILTIN=true to hide them from charts as well.

Install

npm install -g k6-custom-metrics-dashboard

Usage

# Start dashboard (watches results.json in the current directory)
k6-custom-metrics-dashboard

# Watch a specific file
k6-custom-metrics-dashboard path/to/output.json

# Custom port (default: 3000)
k6-custom-metrics-dashboard --port 8080

# Run alongside k6
k6-custom-metrics-dashboard & k6 run --out json=results.json test.js

Then open http://localhost:3000 in your browser.

k6 test setup

The dashboard works with any k6 test that outputs JSON. Add --out json=results.json to your k6 command:

k6 run --out json=results.json my-test.js

Example k6 script

import http from "k6/http";
import { Rate, Trend } from "k6/metrics";

// Define custom metrics with a shared suffix pattern
const homepageDuration = new Trend("homepage_http_req_duration");
const userDuration = new Trend("user_http_req_duration");
const homepageErrorRate = new Rate("homepage_error_rate");
const userErrorRate = new Rate("user_error_rate");

export default function () {
  const home = http.get("https://example.com/");
  homepageDuration.add(home.timings.duration);
  homepageErrorRate.add(home.status >= 400);

  const user = http.get("https://example.com/user/1");
  userDuration.add(user.timings.duration);
  userErrorRate.add(user.status >= 400);
}

The dashboard will automatically create:

  • A "http req duration" chart with homepage and user as series
  • An "error rate" chart with homepage and user as series

Features

  • Auto-discovery — no configuration needed. Charts are created dynamically as metrics appear.
  • Smart grouping — metrics sharing a common suffix are grouped into the same chart. The prefix becomes the series label.
  • Real-time updates — uses Server-Sent Events to push data to the browser as k6 writes to the JSON file.
  • Toggleable series — click series labels above each chart to show/hide individual series.
  • Summary table — shows count, average, P95, min, and max for every metric.
  • Dark mode — follows system preference automatically.
  • Zero dependencies — only uses Node.js built-ins. Chart.js and Tailwind CSS are loaded from CDN in the browser.

Environment variables

| Variable | Default | Description | | ----------------- | ------- | ----------------------------------------------------- | | DASHBOARD_PORT | 3000 | Port for the dashboard server | | K6_HIDE_BUILTIN | false | Set to true to hide k6 built-in metrics from charts |

Requirements

  • Node.js >= 18
  • k6 with --out json=results.json

License

MIT