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

@justeat/f-statistics

v0.7.0

Published

Javascript client for transporting statistics

Downloads

19

Readme

f-statistics

A service for publishing statistics from the client side


npm version CircleCI Coverage Status Known Vulnerabilities

This package is an MVP (not yet stable), if you want to use it contact the team first.

  • f-statistics is responsible for transporting statistics provided to it; for example response time statistics from f-http.

  • It is likely the transportation method may change.

Benefits (Now)

  • Hide away how statistics are transported from every day development.
  • Ability to be flexible with where our statistics are transported.
  • Ability for properties to be provided during initialisation, which are included in every publication.

Benefits (Soon)

  • Batching options - to decrease network usage
  • Sampling options - to increase scalability

Usage

Installation

yarn add @justeat/f-statistics

Usage

  • It is not possible to instantiate multiple versions of Just Log in a single website, so provide a prepared Just Log instance where you can, or initialise one yourself.
// Import the pre-requisite packages
import StatisticsModule from '@justeat/f-statistics';
import { justLog } from '@justeat/just-log';

// Initialise Just Log if one is not already available
justLog.forFeature({
    name: 'your website name',
    tenant: 'your tenant',
    version: 'your version number',
    environment: 'your environment name'
});

// Declare basic options
const statisticsConfiguration = {
    environment: 'your environment name',
    featureName: 'your website name',
    // optional batch logging config to overide the default values
    logsMaxByteSize: 2000,
    logsMaxLength: 5,
    logsIntervalTimer: 5000
};

// Optional (provide properties to publish with every statistic)
const baseProperties = {
  my_experiment_bucket: 'Bucket 1'
};

// Initialise a new instance of the statistics client
const statisticsClient = new StatisticsModule(justLog, statsConfiguration, baseProperties);

// Publish a statistic
statisticsClient.publish({
    measureOne: 'Test',
    measureTwo: 'test'
});

// Optionally (Nuxt) inject the statistics client into context
inject('statistics', statisticsClient);

Options

Options should be provided when initialising the statsModule Parameter | Required |Description | Type ------------- | ---- |------------- | ------------- environment | yes | The name of the environment being used | String featureName | yes | The name of your feature | String logsMaxByteSize | no | Total byte size of logs to store before triggering batch publishing | Number logsMaxLength | no | The number of logs to store before triggering batch publishing. Use 1 to publish immediately | Number logsIntervalTimer | no | Time in milliseconds to wait before publishing logs. Use 0 to disable batch publishing using timer | Number

Client Methods

These are all of the methods exposed by f-statistics

Method | Description | Parameters | Example ------------- | ------------- | ------------- | ------------- publish | Transports a message containing the payload provided | object | publish('This is a message', { measureOne: 'test', measureTwo: 'test' });