Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@metrics/metric
Advanced tools
The metric class definition which metric objects in the @metrics library is instansiated from
The metric class definition which metric objects is instansiated from.
$ npm install @metrics/metric
const Metric = require('@metrics/metric');
const metric = new Metric({
name: 'unique_metric_name',
description: 'Description of metric being collected',
value: 10,
});
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.
The metric object aims to be compatible with the Open Metrics initiative.
Create a new Metric instance.
const Metric = require('@metrics/metric');
const metric = new Metric(options);
An object literal reflecting the properties of this class. The following properties is required:
String
- The name of the metric.String
- The description of the metric.Each property value is validated and will throw if a property value is found to be invalid.
The instansiated object has the following properties:
The name of the metric.
String
in the range of [a-zA-Z_][a-zA-Z0-9_]
.A human readable description of the metric.
String
.The value of the metric.
Integer
or null
.null
.A hint of what type of metric this is.
Integer
in the range of 0-7
.0
.Each numeric value reflect one of the following types:
0
represents unknown
.1
represents gauge
.2
represents counter
.3
represents state_set
.4
represents info
.5
represents cumulative histogram
.6
represents gauge histogram
.7
represents summary
.The source of the metric in terms of where it originated.
String
or null
.null
.A timestamp of when the metric was created.
Double
- epoc milliseconds.Date.now() / 1000
.An Array
of labeled values. Each item in the Array
must be a
Label
object. Please see the Labels section for further info.
Array
of Label
objects.Array
.Available to be used to hold any data. The input is not validated.
any
.null
.Is deprecated.
A Label
object is a object literal which have the following properties:
The name of the label.
String
in the range of [a-zA-Z0-9_]
.The value of the label.
Integer
, String
, Boolean
or null
.FAQs
The metric class definition which metric objects in the @metrics library is instansiated from
The npm package @metrics/metric receives a total of 1,818 weekly downloads. As such, @metrics/metric popularity was classified as popular.
We found that @metrics/metric demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.