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

@mvf/metrics

v1.4.4

Published

## Usage

Readme

MVF Metrics

Usage

Provides a consistent way to log metrics in javascript applications.

To install the package

Run npm install @mvf/metrics

Configuration

Set the following environment variables in your project

  • DATADOG_HOST or DATADOG_HOST_ENVVAR if the datadog host is stored in another environment variable, for example, if datadog host is assigned to HOST env variable then you can set DATADOG_HOST_ENVVAR=HOST which will then load datadog host from HOST environment variable.
  • DATADOG_PORT or defaults to 8125 if not set.
  • DATADOG_MOCK should be set to true in development and testing environments. This will setup hot-shot Client in a mock mode.
  • DATADOG_PROJECT_NAME
  • DATADOG_SERVICE_NAME

More on DATADOG_PROJECT_NAME

This is the system name of your project, e.g. abbey, mercury, leads, etc. DATADOG_PROJECT_NAME is used as the default prefix of your metric name, for example if DATADOG_PROJECT_NAME is set to

DATADOG_PROJECT_NAME=abbey

in your environment and you run

histogram('my.metric', 5);

or any other metric function then the full metric name sent to datadog will be abbey.my.metric.

More on DATADOG_SERVICE_NAME

This is the type of service in your project, e.g. web, api, cron, consumer, worker, etc. DATADOG_SERVICE_NAME is attached to every metric as a tag and should be used to group metrics by the type of service, for example if DATADOG_SERVICE_NAME is set to

DATADOG_SERVICE_NAME=cron

in your environment and you run

histogram('my.metric', 5);

or any other metric function then that metric will have service:cron tag.

Decrement

To decrement index metric by 5 use the following

import { decrement } from '@mvf/metrics';

decrement('index', 5);

Gauge

To gauge index metric to 50 use the following

import { gauge } from '@mvf/metrics';

gauge('index', 5);

Histogram

To gauge index metric to 50 use the following

import { histogram } from '@mvf/metrics';

histogram('index', 5);

Increment

To increment index metric by 5 use the following

import { increment } from '@mvf/metrics';

increment('index', 5);

Time

This is used to time how long something took to run. There are 3 ways this function can be used.

Call with explicit value

To log 1000 milliseconds for calculateFavorites metric use the following

import { time } from '@mvf/metrics';

const milliseconds = 1000;
time('calculateFavorites', milliseconds);

Call with callback

To count how long something takes to run and log that time use the callback approach

import { time } from '@mvf/metrics';

const calculateFavorites = () => {
  // do something
};

time('calculateFavorites', calculateFavorites);

Call with async callback

If your callback is asynchronous you can use async function and await

import { time } from '@mvf/metrics';

const calculateFavorites = async () => {
  // do something
};

await time('calculateFavorites', calculateFavorites);

Return value from callback

Any value returned from the callback will be return by the time function, e.g.

sync callback

const data = time('calculateFavorites', () => 'data');

async callback

const data = await time('calculateFavorites', async () => 'data');

Unique

To log 50 for currentIndex metric use the following

import { unique } from '@mvf/metrics';

unique('currentIndex', 50);

Contributing

Setup

  • Run make to build the container
  • Run make shell to enter the container
  • Run npm install to install dependencies

Refer to package.json for commands

After merging

After you have merged a PR to master, you need to rebuild and publish your changes.

  1. Checkout master git checkout master && git pull
  2. Use one of the following make publish commands to publish changes:
    • make publish kind=patch - Use this if your change is a bug fix and is backwards compatible.
    • make publish kind=minor - Use this if your change adds new functionality and is backwards compatible.
    • make publish kind=major - Use this if your change is not backwards compatible.