Socket
Socket
Sign inDemoInstall

@opentelemetry/api

Package Overview
Dependencies
1
Maintainers
5
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.2 to 0.6.0

9

build/src/metrics/Meter.d.ts

@@ -16,3 +16,3 @@ /*!

*/
import { Metric, MetricOptions, Labels, LabelSet } from './Metric';
import { Metric, MetricOptions } from './Metric';
import { BoundCounter, BoundMeasure, BoundObserver } from './BoundInstrument';

@@ -47,9 +47,2 @@ /**

createObserver(name: string, options?: MetricOptions): Metric<BoundObserver>;
/**
* Provide a pre-computed re-useable LabelSet by
* converting the unordered labels into a canonicalized
* set of labels with an unique identifier, useful for pre-aggregation.
* @param labels user provided unordered Labels.
*/
labels(labels: Labels): LabelSet;
}

34

build/src/metrics/Metric.d.ts

@@ -70,15 +70,14 @@ /*!

/**
* Returns a Instrument associated with specified LabelSet.
* Returns a Instrument associated with specified Labels.
* It is recommended to keep a reference to the Instrument instead of always
* calling this method for every operations.
* @param labels the canonicalized LabelSet used to associate with this
* metric instrument.
* @param labels key-values pairs that are associated with a specific metric
* that you want to record.
*/
bind(labels: LabelSet): T;
bind(labels: Labels): T;
/**
* Removes the Instrument from the metric, if it is present.
* @param labels the canonicalized LabelSet used to associate with this
* metric instrument.
* @param labels key-values pairs that are associated with a specific metric.
*/
unbind(labels: LabelSet): void;
unbind(labels: Labels): void;
/**

@@ -93,3 +92,3 @@ * Clears all timeseries from the Metric.

*/
add(value: number, labelSet: LabelSet): void;
add(value: number, labels: Labels): void;
/**

@@ -104,9 +103,9 @@ * Sets a callback where user can observe value for certain labels

*/
set(value: number, labelSet: LabelSet): void;
set(value: number, labels: Labels): void;
/**
* Records the given value to this measure.
*/
record(value: number, labelSet: LabelSet): void;
record(value: number, labelSet: LabelSet, correlationContext: CorrelationContext): void;
record(value: number, labelSet: LabelSet, correlationContext: CorrelationContext, spanContext: SpanContext): void;
record(value: number, labels: Labels): void;
record(value: number, labels: Labels, correlationContext: CorrelationContext): void;
record(value: number, labels: Labels, correlationContext: CorrelationContext, spanContext: SpanContext): void;
}

@@ -116,9 +115,4 @@ /**

*/
export declare type Labels = Record<string, string>;
/**
* Canonicalized labels with an unique string identifier.
*/
export interface LabelSet {
identifier: string;
labels: Labels;
}
export declare type Labels = {
[key: string]: string;
};

@@ -17,3 +17,3 @@ /*!

import { Meter } from './Meter';
import { MetricOptions, Metric, Labels, LabelSet, MetricUtils } from './Metric';
import { MetricOptions, Metric, Labels, MetricUtils } from './Metric';
import { BoundMeasure, BoundCounter, BoundObserver } from './BoundInstrument';

@@ -47,3 +47,2 @@ import { CorrelationContext } from '../correlation_context/CorrelationContext';

createObserver(name: string, options?: MetricOptions): Metric<BoundObserver>;
labels(labels: Labels): LabelSet;
}

@@ -54,15 +53,14 @@ export declare class NoopMetric<T> implements Metric<T> {

/**
* Returns a Bound Instrument associated with specified LabelSet.
* Returns a Bound Instrument associated with specified Labels.
* It is recommended to keep a reference to the Bound Instrument instead of
* always calling this method for every operations.
* @param labels the canonicalized LabelSet used to associate with this
* metric instrument.
* @param labels key-values pairs that are associated with a specific metric
* that you want to record.
*/
bind(labels: LabelSet): T;
bind(labels: Labels): T;
/**
* Removes the Binding from the metric, if it is present.
* @param labels the canonicalized LabelSet used to associate with this
* metric instrument.
* @param labels key-values pairs that are associated with a specific metric.
*/
unbind(labels: LabelSet): void;
unbind(labels: Labels): void;
/**

@@ -74,6 +72,6 @@ * Clears all timeseries from the Metric.

export declare class NoopCounterMetric extends NoopMetric<BoundCounter> implements Pick<MetricUtils, 'add'> {
add(value: number, labelSet: LabelSet): void;
add(value: number, labels: Labels): void;
}
export declare class NoopMeasureMetric extends NoopMetric<BoundMeasure> implements Pick<MetricUtils, 'record'> {
record(value: number, labelSet: LabelSet, correlationContext?: CorrelationContext, spanContext?: SpanContext): void;
record(value: number, labels: Labels, correlationContext?: CorrelationContext, spanContext?: SpanContext): void;
}

@@ -99,2 +97,1 @@ export declare class NoopObserverMetric extends NoopMetric<BoundObserver> implements Pick<MetricUtils, 'setCallback'> {

export declare const NOOP_OBSERVER_METRIC: NoopObserverMetric;
export declare const NOOP_LABEL_SET: LabelSet;

@@ -48,5 +48,2 @@ "use strict";

}
labels(labels) {
return exports.NOOP_LABEL_SET;
}
}

@@ -59,7 +56,7 @@ exports.NoopMeter = NoopMeter;

/**
* Returns a Bound Instrument associated with specified LabelSet.
* Returns a Bound Instrument associated with specified Labels.
* It is recommended to keep a reference to the Bound Instrument instead of
* always calling this method for every operations.
* @param labels the canonicalized LabelSet used to associate with this
* metric instrument.
* @param labels key-values pairs that are associated with a specific metric
* that you want to record.
*/

@@ -71,4 +68,3 @@ bind(labels) {

* Removes the Binding from the metric, if it is present.
* @param labels the canonicalized LabelSet used to associate with this
* metric instrument.
* @param labels key-values pairs that are associated with a specific metric.
*/

@@ -87,4 +83,4 @@ unbind(labels) {

class NoopCounterMetric extends NoopMetric {
add(value, labelSet) {
this.bind(labelSet).add(value);
add(value, labels) {
this.bind(labels).add(value);
}

@@ -94,11 +90,11 @@ }

class NoopMeasureMetric extends NoopMetric {
record(value, labelSet, correlationContext, spanContext) {
record(value, labels, correlationContext, spanContext) {
if (typeof correlationContext === 'undefined') {
this.bind(labelSet).record(value);
this.bind(labels).record(value);
}
else if (typeof spanContext === 'undefined') {
this.bind(labelSet).record(value, correlationContext);
this.bind(labels).record(value, correlationContext);
}
else {
this.bind(labelSet).record(value, correlationContext, spanContext);
this.bind(labels).record(value, correlationContext, spanContext);
}

@@ -135,3 +131,2 @@ }

exports.NOOP_OBSERVER_METRIC = new NoopObserverMetric(exports.NOOP_BOUND_OBSERVER);
exports.NOOP_LABEL_SET = {};
//# sourceMappingURL=NoopMeter.js.map

@@ -16,3 +16,3 @@ /*!

*/
import { LabelSet } from './Metric';
import { Labels } from './Metric';
/**

@@ -22,4 +22,4 @@ * Interface that is being used in function setCallback for Observer Metric

export interface ObserverResult {
observers: Map<LabelSet, Function>;
observe(callback: Function, labelSet: LabelSet): void;
observers: Map<Labels, Function>;
observe(callback: Function, labels: Labels): void;
}

@@ -16,2 +16,2 @@ /*!

*/
export declare const VERSION = "0.5.2";
export declare const VERSION = "0.6.0";

@@ -19,3 +19,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.5.2';
exports.VERSION = '0.6.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/api",
"version": "0.5.2",
"version": "0.6.0",
"description": "Public API for OpenTelemetry",

@@ -50,3 +50,3 @@ "main": "build/src/index.js",

"dependencies": {
"@opentelemetry/context-base": "^0.5.2"
"@opentelemetry/context-base": "^0.6.0"
},

@@ -68,3 +68,3 @@ "devDependencies": {

"mocha": "^6.1.0",
"nyc": "^14.1.1",
"nyc": "^15.0.0",
"ts-loader": "^6.0.4",

@@ -71,0 +71,0 @@ "ts-mocha": "^6.0.0",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc