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

@freighthub/verdaccio-openmetrics

v1.0.1

Published

Verdaccio plugin exposing an OpenMetrics/Prometheus endpoint with health and traffic metrics

Downloads

7

Readme

@freighthub/verdaccio-openmetrics

Verdaccio plugin exposing an OpenMetrics/Prometheus endpoint with health and traffic metrics

This plugin, when installed and loaded, serves Prometheus/OpenMetrics metrics at a known path. This can then be scraped by your Prometheus installation, Datadog agent, etc.

By default, a second HTTP listener is used to keep metrics internal to your infrastructure more easily. The default metrics port is 9090. So, metrics will be available at :9090/metrics.

If you instead want to have your metrics available via Verdaccio's main API, set metrics_on_main: true and access /-/metrics on Verdaccio. This will disable the second HTTP listener unless you also pass metrics_port explicitly.

The primary metrics exposed are HTTP response latencies by request method and response status code. There's also an option to collect NodeJS runtime metrics (the defaults from the prom-client package). A further option will be to infrequently collect statistics about the database, however it's not clear yet what will be interesting to expose there.

plugin name

Note that this Verdaccio plugin is published within a package scope. To load the plugin from a Verdaccio config, specify the full name:

middlewares:
  '@freighthub/verdaccio-openmetrics':
    enabled: true

This works around the automatic verdaccio- prefix that Verdaccio expects.

config

If no extra config is given, HTTP request metrics will be exposed at :9090/metrics.

If you want additional metrics, for example runtime and database metrics:

middlewares:
  '@freighthub/verdaccio-openmetrics':
    enabled: true
    collect_runtime: true
    collect_database: true

All config keys and default values:

interface MetricsConfig {
  metrics_port: 9090; // Exposes metrics at /metrics on this alternate port
  metrics_on_main: false; // Exposes metrics at /-/metrics on Verdaccio
  default_labels: {}; // key/value tags attached to every metric

  collect_http: true; // Latency metrics for Verdaccio's API, by method and status code
  collect_database: false; // WIP metrics about Verdaccio's database, updated infrequently
  collect_up: false; // a fixed gauge of '1'
  collect_runtime: false; // the default Prometheus metrics for NodeJS processes
}

development

See the verdaccio contributing guide for instructions setting up your development environment. Note that yarn is being used in place of npm in this plugin. Once you have completed that, use the following yarn tasks.

  • yarn build

    Build a distributable archive

  • yarn test

    Run unit test

For more information about any of these commands run yarn ${task} -- --help.