Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metrics/metric

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metrics/metric

The metric class definition which metric objects in the @metrics library is instansiated from

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
decreased by-23.49%
Maintainers
2
Weekly downloads
 
Created
Source

@metrics/metric

The metric class definition which metric objects is instansiated from.

Dependencies Build Status

Installation

$ npm install @metrics/metric

Example

const Metric = require('@metrics/metric');

const metric = new Metric({
    name: 'unique_metric_name',
    description: 'Description of metric being collected',
    value: 10,
});

Description

This module is the metric class definition which metric objects is instansiated from.

All modules in the @metric family which exchange data over the stream API exchange this object type. This object definition is intended to be static over time so modules who depend on a module in the @metric family can rely on exchanging data over time.

This class definition is prefered over object literals when exchanging data over the stream API because it will guarantee that all properties are available on the object. All undefined properties will have a null value, making sure they are kept when serialized to JSON.

Constructor

Create a new Metric instance.

const Metric = require('@metrics/metric');
const metric = new Metric(options);

options (required)

An object literal reflecting the properties of this class. The following properties is required:

  • name - String - The name of the metric.
  • value - String|Number - The value of the metric.

Properties

The instansiated object has the following properties:

name

The name of the metric.

  • Valid characters: a-z,A-Z,0-9,_.
  • Value is imutable.

value

The value of the metric.

  • Valid values: Number or String.
  • Value is imutable.

source

The source of the metric in terms of where it originated.

  • Valid characters: a-z,A-Z,0-9,_.
  • Value is mutable.

description

A human readable description of the metric.

  • Valid values: String.
  • Value is imutable.

timestamp

A timestamp of when the metric was created.

  • Valid values: Number.
  • Value is imutable.

time

N/A.

  • Valid values: Number.
  • Value is imutable.

meta

Available to be used to hold any misc data. In practice, meta can be used as a way to label metrics. Use each key of the meta object as the label name and the value as the label value.

  • Valid values: Object.
  • Value is imutable.

Keywords

FAQs

Package last updated on 31 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc