Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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,502 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.