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

@libp2p/interface-metrics

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/interface-metrics - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

54

dist/src/index.d.ts

@@ -97,8 +97,58 @@ import type { PeerId } from '@libp2p/interface-peer-id';

}
/**
* Used to update a tracked metric. Value can either be a number, an object containing
* key/value pairs or an (optionally async) function to return a number or an object of
* key/value pairs.
*/
export interface ComponentMetricsUpdate {
/**
* Name of the system, e.g. libp2p, ipfs, etc
*/
system: string;
/**
* Name of the system component that contains the metric
*/
component: string;
/**
* Name of the metric being tracked
*/
metric: string;
value: number;
/**
* The value or function to calculate the value
*/
value: ComponentMetric | CalculateComponentMetric;
/**
* Optional label for the metric
*/
label?: string;
/**
* Optional help for the metric
*/
help?: string;
}
export declare type ComponentMetric = number | ComponentMetricsGroup;
/**
* Used to group related metrics together by label and value
*/
export declare type ComponentMetricsGroup = Record<string, number>;
/**
* Used to calculate metric values dynamically
*/
export interface CalculateComponentMetric {
(): Promise<ComponentMetric> | ComponentMetric;
}
export interface TrackedMetric {
/**
* In systems that support them, this label can help make graphs more interpretable
*/
label?: string;
/**
* In systems that support them, this help text can help make graphs more interpretable
*/
help?: string;
/**
* A function that returns a value or a group of values
*/
calculate: CalculateComponentMetric;
}
export interface ComponentMetricsTracker {

@@ -108,3 +158,3 @@ /**

*/
getComponentMetrics: () => Map<string, Map<string, Map<string, number>>>;
getComponentMetrics: () => Map<string, Map<string, Map<string, TrackedMetric>>>;
/**

@@ -111,0 +161,0 @@ * Update the stored metric value for the given system and component

2

package.json
{
"name": "@libp2p/interface-metrics",
"version": "1.0.3",
"version": "2.0.0",
"description": "Metrics interface for libp2p",

@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT",

@@ -117,9 +117,68 @@ import type { PeerId } from '@libp2p/interface-peer-id'

/**
* Used to update a tracked metric. Value can either be a number, an object containing
* key/value pairs or an (optionally async) function to return a number or an object of
* key/value pairs.
*/
export interface ComponentMetricsUpdate {
/**
* Name of the system, e.g. libp2p, ipfs, etc
*/
system: string
/**
* Name of the system component that contains the metric
*/
component: string
/**
* Name of the metric being tracked
*/
metric: string
value: number
/**
* The value or function to calculate the value
*/
value: ComponentMetric | CalculateComponentMetric
/**
* Optional label for the metric
*/
label?: string
/**
* Optional help for the metric
*/
help?: string
}
export type ComponentMetric = number | ComponentMetricsGroup
/**
* Used to group related metrics together by label and value
*/
export type ComponentMetricsGroup = Record<string, number>
/**
* Used to calculate metric values dynamically
*/
export interface CalculateComponentMetric { (): Promise<ComponentMetric> | ComponentMetric }
export interface TrackedMetric {
/**
* In systems that support them, this label can help make graphs more interpretable
*/
label?: string
/**
* In systems that support them, this help text can help make graphs more interpretable
*/
help?: string
/**
* A function that returns a value or a group of values
*/
calculate: CalculateComponentMetric
}
export interface ComponentMetricsTracker {

@@ -129,3 +188,3 @@ /**

*/
getComponentMetrics: () => Map<string, Map<string, Map<string, number>>>
getComponentMetrics: () => Map<string, Map<string, Map<string, TrackedMetric>>>

@@ -132,0 +191,0 @@ /**

Sorry, the diff of this file is not supported yet

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