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

@opentelemetry/api

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/api - npm Package Compare versions

Comparing version 0.12.1-alpha.54 to 0.13.0

2

build/src/api/global-utils.d.ts

@@ -32,4 +32,4 @@ import { ContextManager } from '@opentelemetry/context-base';

*/
export declare const API_BACKWARDS_COMPATIBILITY_VERSION = 0;
export declare const API_BACKWARDS_COMPATIBILITY_VERSION = 2;
export {};
//# sourceMappingURL=global-utils.d.ts.map

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

*/
exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0;
exports.API_BACKWARDS_COMPATIBILITY_VERSION = 2;
//# sourceMappingURL=global-utils.js.map
import { Context } from '@opentelemetry/context-base';
import { GetterFunction } from '../context/propagation/getter';
import { TextMapPropagator } from '../context/propagation/TextMapPropagator';
import { SetterFunction } from '../context/propagation/setter';
import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../context/propagation/TextMapPropagator';
/**

@@ -25,3 +23,3 @@ * Singleton object which represents the entry point to the OpenTelemetry Propagation API

*/
inject<Carrier>(carrier: Carrier, setter?: SetterFunction<Carrier>, context?: Context): void;
inject<Carrier>(carrier: Carrier, setter?: TextMapSetter<Carrier>, context?: Context): void;
/**

@@ -34,3 +32,3 @@ * Extract context from a carrier

*/
extract<Carrier>(carrier: Carrier, getter?: GetterFunction<Carrier>, context?: Context): Context;
extract<Carrier>(carrier: Carrier, getter?: TextMapGetter<Carrier>, context?: Context): Context;
/** Remove the global propagator */

@@ -37,0 +35,0 @@ disable(): void;

@@ -19,5 +19,4 @@ "use strict";

exports.PropagationAPI = void 0;
var getter_1 = require("../context/propagation/getter");
var NoopTextMapPropagator_1 = require("../context/propagation/NoopTextMapPropagator");
var setter_1 = require("../context/propagation/setter");
var TextMapPropagator_1 = require("../context/propagation/TextMapPropagator");
var context_1 = require("./context");

@@ -59,3 +58,3 @@ var global_utils_1 = require("./global-utils");

PropagationAPI.prototype.inject = function (carrier, setter, context) {
if (setter === void 0) { setter = setter_1.defaultSetter; }
if (setter === void 0) { setter = TextMapPropagator_1.defaultTextMapSetter; }
if (context === void 0) { context = contextApi.active(); }

@@ -72,3 +71,3 @@ return this._getGlobalPropagator().inject(context, carrier, setter);

PropagationAPI.prototype.extract = function (carrier, getter, context) {
if (getter === void 0) { getter = getter_1.defaultGetter; }
if (getter === void 0) { getter = TextMapPropagator_1.defaultTextMapGetter; }
if (context === void 0) { context = contextApi.active(); }

@@ -75,0 +74,0 @@ return this._getGlobalPropagator().extract(context, carrier, getter);

@@ -8,7 +8,8 @@ import { Context } from '@opentelemetry/context-base';

/** Noop inject function does nothing */
inject(context: Context, carrier: unknown, setter: Function): void;
inject(_context: Context, _carrier: unknown): void;
/** Noop extract function does nothing and returns the input context */
extract(context: Context, carrier: unknown, getter: Function): Context;
extract(context: Context, _carrier: unknown): Context;
fields(): string[];
}
export declare const NOOP_TEXT_MAP_PROPAGATOR: NoopTextMapPropagator;
//# sourceMappingURL=NoopTextMapPropagator.d.ts.map

@@ -26,7 +26,10 @@ "use strict";

/** Noop inject function does nothing */
NoopTextMapPropagator.prototype.inject = function (context, carrier, setter) { };
NoopTextMapPropagator.prototype.inject = function (_context, _carrier) { };
/** Noop extract function does nothing and returns the input context */
NoopTextMapPropagator.prototype.extract = function (context, carrier, getter) {
NoopTextMapPropagator.prototype.extract = function (context, _carrier) {
return context;
};
NoopTextMapPropagator.prototype.fields = function () {
return [];
};
return NoopTextMapPropagator;

@@ -33,0 +36,0 @@ }());

import { Context } from '@opentelemetry/context-base';
import { SetterFunction } from './setter';
import { GetterFunction } from './getter';
/**

@@ -15,3 +13,3 @@ * Injects `Context` into and extracts it from carriers that travel

*/
export interface TextMapPropagator {
export interface TextMapPropagator<Carrier = any> {
/**

@@ -27,6 +25,6 @@ * Injects values from a given `Context` into a carrier.

* headers.
* @param setter a function which accepts a carrier, key, and value, which
* sets the key on the carrier to the value.
* @param setter an optional {@link TextMapSetter}. If undefined, values will be
* set by direct object assignment.
*/
inject(context: Context, carrier: unknown, setter: SetterFunction): void;
inject(context: Context, carrier: Carrier, setter: TextMapSetter<Carrier>): void;
/**

@@ -41,7 +39,52 @@ * Given a `Context` and a carrier, extract context values from a

* headers.
* @param getter a function which accepts a carrier and a key, and returns
* the value from the carrier identified by the key.
* @param getter an optional {@link TextMapGetter}. If undefined, keys will be all
* own properties, and keys will be accessed by direct object access.
*/
extract(context: Context, carrier: unknown, getter: GetterFunction): Context;
extract(context: Context, carrier: Carrier, getter: TextMapGetter<Carrier>): Context;
/**
* Return a list of all fields which may be used by the propagator.
*
* This list should be used to clear fields before calling inject if a carrier is
* used more than once.
*/
fields(): string[];
}
/**
* A setter is specified by the caller to define a specific method
* to set key/value pairs on the carrier within a propagator.
*/
export interface TextMapSetter<Carrier = any> {
/**
* Callback used to set a key/value pair on an object.
*
* Should be called by the propagator each time a key/value pair
* should be set, and should set that key/value pair on the propagator.
*
* @param carrier object or class which carries key/value pairs
* @param key string key to modify
* @param value value to be set to the key on the carrier
*/
set(carrier: Carrier, key: string, value: string): void;
}
/**
* A getter is specified by the caller to define a specific method
* to get the value of a key from a carrier.
*/
export interface TextMapGetter<Carrier = any> {
/**
* Get a list of all keys available on the carrier.
*
* @param carrier
*/
keys(carrier: Carrier): string[];
/**
* Get the value of a specific key from the carrier.
*
* @param carrier
* @param key
*/
get(carrier: Carrier, key: string): undefined | string | string[];
}
export declare const defaultTextMapGetter: TextMapGetter;
export declare const defaultTextMapSetter: TextMapSetter;
//# sourceMappingURL=TextMapPropagator.d.ts.map

@@ -18,2 +18,25 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultTextMapSetter = exports.defaultTextMapGetter = void 0;
exports.defaultTextMapGetter = {
get: function (carrier, key) {
if (carrier == null) {
return undefined;
}
return carrier[key];
},
keys: function (carrier) {
if (carrier == null) {
return [];
}
return Object.keys(carrier);
},
};
exports.defaultTextMapSetter = {
set: function (carrier, key, value) {
if (carrier == null) {
return;
}
carrier[key] = value;
},
};
//# sourceMappingURL=TextMapPropagator.js.map

@@ -5,6 +5,4 @@ export * from './common/Exception';

export * from './context/context';
export * from './context/propagation/getter';
export * from './context/propagation/TextMapPropagator';
export * from './context/propagation/NoopTextMapPropagator';
export * from './context/propagation/setter';
export * from './correlation_context/CorrelationContext';

@@ -11,0 +9,0 @@ export * from './correlation_context/EntryValue';

@@ -33,6 +33,4 @@ "use strict";

__exportStar(require("./context/context"), exports);
__exportStar(require("./context/propagation/getter"), exports);
__exportStar(require("./context/propagation/TextMapPropagator"), exports);
__exportStar(require("./context/propagation/NoopTextMapPropagator"), exports);
__exportStar(require("./context/propagation/setter"), exports);
__exportStar(require("./correlation_context/CorrelationContext"), exports);

@@ -39,0 +37,0 @@ __exportStar(require("./correlation_context/EntryValue"), exports);

import { BatchObserverResult } from './BatchObserverResult';
import { MetricOptions, Counter, ValueRecorder, ValueObserver, BatchObserver, BatchMetricOptions, UpDownCounter } from './Metric';
import { MetricOptions, Counter, ValueRecorder, ValueObserver, BatchObserver, BatchMetricOptions, UpDownCounter, SumObserver, UpDownSumObserver } from './Metric';
import { ObserverResult } from './ObserverResult';

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

/**
* Creates a new `SumObserver` metric.
* @param name the name of the metric.
* @param [options] the metric options.
* @param [callback] the observer callback
*/
createSumObserver(name: string, options?: MetricOptions, callback?: (observerResult: ObserverResult) => void): SumObserver;
/**
* Creates a new `UpDownSumObserver` metric.
* @param name the name of the metric.
* @param [options] the metric options.
* @param [callback] the observer callback
*/
createUpDownSumObserver(name: string, options?: MetricOptions, callback?: (observerResult: ObserverResult) => void): UpDownSumObserver;
/**
* Creates a new `BatchObserver` metric, can be used to update many metrics

@@ -54,0 +68,0 @@ * at the same time and when operations needs to be async

import { BatchObserverResult } from './BatchObserverResult';
import { Meter } from './Meter';
import { MetricOptions, UnboundMetric, Labels, Counter, ValueRecorder, ValueObserver, BatchObserver, UpDownCounter, BaseObserver } from './Metric';
import { MetricOptions, UnboundMetric, Labels, Counter, ValueRecorder, ValueObserver, BatchObserver, UpDownCounter, BaseObserver, UpDownSumObserver } from './Metric';
import { BoundValueRecorder, BoundCounter, BoundBaseObserver } from './BoundInstrument';

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

*/
createValueRecorder(name: string, options?: MetricOptions): ValueRecorder;
createValueRecorder(_name: string, _options?: MetricOptions): ValueRecorder;
/**

@@ -26,3 +26,3 @@ * Returns a constant noop counter.

*/
createCounter(name: string, options?: MetricOptions): Counter;
createCounter(_name: string, _options?: MetricOptions): Counter;
/**

@@ -33,3 +33,3 @@ * Returns a constant noop UpDownCounter.

*/
createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter;
createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter;
/**

@@ -41,4 +41,18 @@ * Returns constant noop value observer.

*/
createValueObserver(name: string, options?: MetricOptions, callback?: (observerResult: ObserverResult) => void): ValueObserver;
createValueObserver(_name: string, _options?: MetricOptions, _callback?: (observerResult: ObserverResult) => void): ValueObserver;
/**
* Returns constant noop sum observer.
* @param name the name of the metric.
* @param [options] the metric options.
* @param [callback] the sum observer callback
*/
createSumObserver(_name: string, _options?: MetricOptions, _callback?: (observerResult: ObserverResult) => void): ValueObserver;
/**
* Returns constant noop up down sum observer.
* @param name the name of the metric.
* @param [options] the metric options.
* @param [callback] the up down sum observer callback
*/
createUpDownSumObserver(_name: string, _options?: MetricOptions, _callback?: (observerResult: ObserverResult) => void): UpDownSumObserver;
/**
* Returns constant noop batch observer.

@@ -48,3 +62,3 @@ * @param name the name of the metric.

*/
createBatchObserver(name: string, callback: (batchObserverResult: BatchObserverResult) => void): BatchObserver;
createBatchObserver(_name: string, _callback: (batchObserverResult: BatchObserverResult) => void): BatchObserver;
}

@@ -61,3 +75,3 @@ export declare class NoopMetric<T> implements UnboundMetric<T> {

*/
bind(labels: Labels): T;
bind(_labels: Labels): T;
/**

@@ -67,3 +81,3 @@ * Removes the Binding from the metric, if it is present.

*/
unbind(labels: Labels): void;
unbind(_labels: Labels): void;
/**

@@ -89,9 +103,9 @@ * Clears all timeseries from the Metric.

export declare class NoopBoundCounter implements BoundCounter {
add(value: number): void;
add(_value: number): void;
}
export declare class NoopBoundValueRecorder implements BoundValueRecorder {
record(value: number, correlationContext?: CorrelationContext, spanContext?: SpanContext): void;
record(_value: number, _correlationContext?: CorrelationContext, _spanContext?: SpanContext): void;
}
export declare class NoopBoundBaseObserver implements BoundBaseObserver {
update(value: number): void;
update(_value: number): void;
}

@@ -98,0 +112,0 @@ export declare const NOOP_METER: NoopMeter;

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

*/
NoopMeter.prototype.createValueRecorder = function (name, options) {
NoopMeter.prototype.createValueRecorder = function (_name, _options) {
return exports.NOOP_VALUE_RECORDER_METRIC;

@@ -53,3 +53,3 @@ };

*/
NoopMeter.prototype.createCounter = function (name, options) {
NoopMeter.prototype.createCounter = function (_name, _options) {
return exports.NOOP_COUNTER_METRIC;

@@ -62,3 +62,3 @@ };

*/
NoopMeter.prototype.createUpDownCounter = function (name, options) {
NoopMeter.prototype.createUpDownCounter = function (_name, _options) {
return exports.NOOP_COUNTER_METRIC;

@@ -72,6 +72,24 @@ };

*/
NoopMeter.prototype.createValueObserver = function (name, options, callback) {
NoopMeter.prototype.createValueObserver = function (_name, _options, _callback) {
return exports.NOOP_VALUE_OBSERVER_METRIC;
};
/**
* Returns constant noop sum observer.
* @param name the name of the metric.
* @param [options] the metric options.
* @param [callback] the sum observer callback
*/
NoopMeter.prototype.createSumObserver = function (_name, _options, _callback) {
return exports.NOOP_SUM_OBSERVER_METRIC;
};
/**
* Returns constant noop up down sum observer.
* @param name the name of the metric.
* @param [options] the metric options.
* @param [callback] the up down sum observer callback
*/
NoopMeter.prototype.createUpDownSumObserver = function (_name, _options, _callback) {
return exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC;
};
/**
* Returns constant noop batch observer.

@@ -81,3 +99,3 @@ * @param name the name of the metric.

*/
NoopMeter.prototype.createBatchObserver = function (name, callback) {
NoopMeter.prototype.createBatchObserver = function (_name, _callback) {
return exports.NOOP_BATCH_OBSERVER_METRIC;

@@ -99,3 +117,3 @@ };

*/
NoopMetric.prototype.bind = function (labels) {
NoopMetric.prototype.bind = function (_labels) {
return this._instrument;

@@ -107,3 +125,3 @@ };

*/
NoopMetric.prototype.unbind = function (labels) {
NoopMetric.prototype.unbind = function (_labels) {
return;

@@ -167,3 +185,3 @@ };

}
NoopBoundCounter.prototype.add = function (value) {
NoopBoundCounter.prototype.add = function (_value) {
return;

@@ -177,3 +195,3 @@ };

}
NoopBoundValueRecorder.prototype.record = function (value, correlationContext, spanContext) {
NoopBoundValueRecorder.prototype.record = function (_value, _correlationContext, _spanContext) {
return;

@@ -187,3 +205,3 @@ };

}
NoopBoundBaseObserver.prototype.update = function (value) { };
NoopBoundBaseObserver.prototype.update = function (_value) { };
return NoopBoundBaseObserver;

@@ -190,0 +208,0 @@ }());

export interface Attributes {
[attributeKey: string]: AttributeValue | undefined;
}
/**
* Attribute values may be any non-nullish primitive value except an object.
*
* null or undefined attribute values are invalid and will result in undefined behavior.
*/
export declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
//# sourceMappingURL=attributes.d.ts.map
import { Logger } from '../common/Logger';
/** No-op implementation of Logger */
export declare class NoopLogger implements Logger {
debug(message: string, ...args: unknown[]): void;
error(message: string, ...args: unknown[]): void;
warn(message: string, ...args: unknown[]): void;
info(message: string, ...args: unknown[]): void;
debug(_message: string, ..._args: unknown[]): void;
error(_message: string, ..._args: unknown[]): void;
warn(_message: string, ..._args: unknown[]): void;
info(_message: string, ..._args: unknown[]): void;
}
//# sourceMappingURL=NoopLogger.d.ts.map

@@ -24,27 +24,27 @@ "use strict";

// By default does nothing
NoopLogger.prototype.debug = function (message) {
var args = [];
NoopLogger.prototype.debug = function (_message) {
var _args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
_args[_i - 1] = arguments[_i];
}
};
// By default does nothing
NoopLogger.prototype.error = function (message) {
var args = [];
NoopLogger.prototype.error = function (_message) {
var _args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
_args[_i - 1] = arguments[_i];
}
};
// By default does nothing
NoopLogger.prototype.warn = function (message) {
var args = [];
NoopLogger.prototype.warn = function (_message) {
var _args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
_args[_i - 1] = arguments[_i];
}
};
// By default does nothing
NoopLogger.prototype.info = function (message) {
var args = [];
NoopLogger.prototype.info = function (_message) {
var _args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
_args[_i - 1] = arguments[_i];
}

@@ -51,0 +51,0 @@ };

@@ -16,12 +16,12 @@ import { Exception } from '../common/Exception';

context(): SpanContext;
setAttribute(key: string, value: unknown): this;
setAttributes(attributes: Attributes): this;
addEvent(name: string, attributes?: Attributes): this;
setStatus(status: Status): this;
updateName(name: string): this;
end(endTime?: TimeInput): void;
setAttribute(_key: string, _value: unknown): this;
setAttributes(_attributes: Attributes): this;
addEvent(_name: string, _attributes?: Attributes): this;
setStatus(_status: Status): this;
updateName(_name: string): this;
end(_endTime?: TimeInput): void;
isRecording(): boolean;
recordException(exception: Exception, time?: TimeInput): void;
recordException(_exception: Exception, _time?: TimeInput): void;
}
export declare const NOOP_SPAN: NoopSpan;
//# sourceMappingURL=NoopSpan.d.ts.map

@@ -35,23 +35,23 @@ "use strict";

// By default does nothing
NoopSpan.prototype.setAttribute = function (key, value) {
NoopSpan.prototype.setAttribute = function (_key, _value) {
return this;
};
// By default does nothing
NoopSpan.prototype.setAttributes = function (attributes) {
NoopSpan.prototype.setAttributes = function (_attributes) {
return this;
};
// By default does nothing
NoopSpan.prototype.addEvent = function (name, attributes) {
NoopSpan.prototype.addEvent = function (_name, _attributes) {
return this;
};
// By default does nothing
NoopSpan.prototype.setStatus = function (status) {
NoopSpan.prototype.setStatus = function (_status) {
return this;
};
// By default does nothing
NoopSpan.prototype.updateName = function (name) {
NoopSpan.prototype.updateName = function (_name) {
return this;
};
// By default does nothing
NoopSpan.prototype.end = function (endTime) { };
NoopSpan.prototype.end = function (_endTime) { };
// isRecording always returns false for noopSpan.

@@ -62,3 +62,3 @@ NoopSpan.prototype.isRecording = function () {

// By default does nothing
NoopSpan.prototype.recordException = function (exception, time) { };
NoopSpan.prototype.recordException = function (_exception, _time) { };
return NoopSpan;

@@ -65,0 +65,0 @@ }());

@@ -10,5 +10,5 @@ import { Span, SpanOptions, Tracer } from '..';

withSpan<T extends (...args: unknown[]) => ReturnType<T>>(span: Span, fn: T): ReturnType<T>;
bind<T>(target: T, span?: Span): T;
bind<T>(target: T, _span?: Span): T;
}
export declare const NOOP_TRACER: NoopTracer;
//# sourceMappingURL=NoopTracer.d.ts.map

@@ -33,9 +33,8 @@ "use strict";

NoopTracer.prototype.startSpan = function (name, options, context) {
var _a;
var parent = options === null || options === void 0 ? void 0 : options.parent;
var parentFromContext = context && ((_a = context_1.getActiveSpan(context)) === null || _a === void 0 ? void 0 : _a.context());
if (isSpanContext(parent) && spancontext_utils_1.isSpanContextValid(parent)) {
return new NoopSpan_1.NoopSpan(parent);
var root = Boolean(options === null || options === void 0 ? void 0 : options.root);
if (root) {
return NoopSpan_1.NOOP_SPAN;
}
else if (isSpanContext(parentFromContext) &&
var parentFromContext = context && context_1.getParentSpanContext(context);
if (isSpanContext(parentFromContext) &&
spancontext_utils_1.isSpanContextValid(parentFromContext)) {

@@ -51,3 +50,3 @@ return new NoopSpan_1.NoopSpan(parentFromContext);

};
NoopTracer.prototype.bind = function (target, span) {
NoopTracer.prototype.bind = function (target, _span) {
return target;

@@ -54,0 +53,0 @@ };

@@ -1,6 +0,6 @@

import { SpanContext } from './span_context';
import { SpanKind } from './span_kind';
import { Context } from '@opentelemetry/context-base';
import { Attributes } from './attributes';
import { Link } from './link';
import { SamplingResult } from './SamplingResult';
import { SpanKind } from './span_kind';
/**

@@ -15,4 +15,3 @@ * This interface represent a sampler. Sampling is a mechanism to control the

*
* @param parentContext Parent span context. Typically taken from the wire.
* Can be null.
* @param context Parent Context which may contain a span.
* @param traceId of the span to be created. It can be different from the

@@ -28,3 +27,3 @@ * traceId in the {@link SpanContext}. Typically in situations when the

*/
shouldSample(parentContext: SpanContext | undefined, traceId: string, spanName: string, spanKind: SpanKind, attributes: Attributes, links: Link[]): SamplingResult;
shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: Attributes, links: Link[]): SamplingResult;
/** Returns the sampler name or short description with the configuration. */

@@ -31,0 +30,0 @@ toString(): string;

@@ -32,3 +32,4 @@ import { Exception } from '../common/Exception';

* @param key the key for this attribute.
* @param value the value for this attribute.
* @param value the value for this attribute. Setting a value null or
* undefined is invalid and will result in undefined behavior.
*/

@@ -40,2 +41,4 @@ setAttribute(key: string, value?: AttributeValue): this;

* @param attributes the attributes that will be added.
* null or undefined attribute values
* are invalid and will result in undefined behavior.
*/

@@ -55,3 +58,3 @@ setAttributes(attributes: Attributes): this;

* Sets a status to the span. If used, this will override the default Span
* status. Default is {@link CanonicalCode.OK}. SetStatus overrides the value
* status. Default is {@link StatusCode.UNSET}. SetStatus overrides the value
* of previous calls to SetStatus on the Span.

@@ -58,0 +61,0 @@ *

import { Attributes } from './attributes';
import { Link } from './link';
import { SpanKind } from './span_kind';
import { Span } from './span';
import { SpanContext } from './span_context';
/**

@@ -19,18 +17,7 @@ * Options needed for span creation

links?: Link[];
/**
* This option is NOT RECOMMENDED for normal use and should ONLY be used
* if your application manages context manually without the global context
* manager, or you are trying to override the parent extracted from context.
*
* A parent `SpanContext` (or `Span`, for convenience) that the newly-started
* span will be the child of. This overrides the parent span extracted from
* the currently active context.
*
* A null value here should prevent the SDK from extracting a parent from
* the current context, forcing the new span to be a root span.
*/
parent?: Span | SpanContext | null;
/** A manually specified start time for the created `Span` object. */
startTime?: number;
/** The new span should be a root span. (Ignore parent from context). */
root?: boolean;
}
//# sourceMappingURL=SpanOptions.d.ts.map
export interface Status {
/** The canonical code of this message. */
code: CanonicalCode;
/** The status code of this message. */
code: StatusCode;
/** A developer-facing error message. */

@@ -8,137 +8,19 @@ message?: string;

/**
* An enumeration of canonical status codes.
* An enumeration of status codes.
*/
export declare enum CanonicalCode {
export declare enum StatusCode {
/**
* Not an error; returned on success
* The operation has been validated by an Application developer or
* Operator to have completed successfully.
*/
OK = 0,
/**
* The operation was cancelled (typically by the caller).
* The default status.
*/
CANCELLED = 1,
UNSET = 1,
/**
* Unknown error. An example of where this error may be returned is
* if a status value received from another address space belongs to
* an error-space that is not known in this address space. Also
* errors raised by APIs that do not return enough error information
* may be converted to this error.
* The operation contains an error.
*/
UNKNOWN = 2,
/**
* Client specified an invalid argument. Note that this differs
* from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
* that are problematic regardless of the state of the system
* (e.g., a malformed file name).
*/
INVALID_ARGUMENT = 3,
/**
* Deadline expired before operation could complete. For operations
* that change the state of the system, this error may be returned
* even if the operation has completed successfully. For example, a
* successful response from a server could have been delayed long
* enough for the deadline to expire.
*/
DEADLINE_EXCEEDED = 4,
/**
* Some requested entity (e.g., file or directory) was not found.
*/
NOT_FOUND = 5,
/**
* Some entity that we attempted to create (e.g., file or directory)
* already exists.
*/
ALREADY_EXISTS = 6,
/**
* The caller does not have permission to execute the specified
* operation. PERMISSION_DENIED must not be used for rejections
* caused by exhausting some resource (use RESOURCE_EXHAUSTED
* instead for those errors). PERMISSION_DENIED must not be
* used if the caller can not be identified (use UNAUTHENTICATED
* instead for those errors).
*/
PERMISSION_DENIED = 7,
/**
* Some resource has been exhausted, perhaps a per-user quota, or
* perhaps the entire file system is out of space.
*/
RESOURCE_EXHAUSTED = 8,
/**
* Operation was rejected because the system is not in a state
* required for the operation's execution. For example, directory
* to be deleted may be non-empty, an rmdir operation is applied to
* a non-directory, etc.
*
* A litmus test that may help a service implementor in deciding
* between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
*
* - Use UNAVAILABLE if the client can retry just the failing call.
* - Use ABORTED if the client should retry at a higher-level
* (e.g., restarting a read-modify-write sequence).
* - Use FAILED_PRECONDITION if the client should not retry until
* the system state has been explicitly fixed. E.g., if an "rmdir"
* fails because the directory is non-empty, FAILED_PRECONDITION
* should be returned since the client should not retry unless
* they have first fixed up the directory by deleting files from it.
* - Use FAILED_PRECONDITION if the client performs conditional
* REST Get/Update/Delete on a resource and the resource on the
* server does not match the condition. E.g., conflicting
* read-modify-write on the same resource.
*/
FAILED_PRECONDITION = 9,
/**
* The operation was aborted, typically due to a concurrency issue
* like sequencer check failures, transaction aborts, etc.
*
* See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE.
*/
ABORTED = 10,
/**
* Operation was attempted past the valid range. E.g., seeking or
* reading past end of file.
*
* Unlike INVALID_ARGUMENT, this error indicates a problem that may
* be fixed if the system state changes. For example, a 32-bit file
* system will generate INVALID_ARGUMENT if asked to read at an
* offset that is not in the range [0,2^32-1], but it will generate
* OUT_OF_RANGE if asked to read from an offset past the current
* file size.
*
* There is a fair bit of overlap between FAILED_PRECONDITION and
* OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
* error) when it applies so that callers who are iterating through
* a space can easily look for an OUT_OF_RANGE error to detect when
* they are done.
*/
OUT_OF_RANGE = 11,
/**
* Operation is not implemented or not supported/enabled in this service.
*/
UNIMPLEMENTED = 12,
/**
* Internal errors. Means some invariants expected by underlying
* system has been broken. If you see one of these errors,
* something is very broken.
*/
INTERNAL = 13,
/**
* The service is currently unavailable. This is a most likely a
* transient condition and may be corrected by retrying with
* a backoff.
*
* See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE.
*/
UNAVAILABLE = 14,
/**
* Unrecoverable data loss or corruption.
*/
DATA_LOSS = 15,
/**
* The request does not have valid authentication credentials for the
* operation.
*/
UNAUTHENTICATED = 16
ERROR = 2
}
//# sourceMappingURL=status.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CanonicalCode = void 0;
exports.StatusCode = void 0;
/**
* An enumeration of canonical status codes.
* An enumeration of status codes.
*/
var CanonicalCode;
(function (CanonicalCode) {
var StatusCode;
(function (StatusCode) {
/**
* Not an error; returned on success
* The operation has been validated by an Application developer or
* Operator to have completed successfully.
*/
CanonicalCode[CanonicalCode["OK"] = 0] = "OK";
StatusCode[StatusCode["OK"] = 0] = "OK";
/**
* The operation was cancelled (typically by the caller).
* The default status.
*/
CanonicalCode[CanonicalCode["CANCELLED"] = 1] = "CANCELLED";
StatusCode[StatusCode["UNSET"] = 1] = "UNSET";
/**
* Unknown error. An example of where this error may be returned is
* if a status value received from another address space belongs to
* an error-space that is not known in this address space. Also
* errors raised by APIs that do not return enough error information
* may be converted to this error.
* The operation contains an error.
*/
CanonicalCode[CanonicalCode["UNKNOWN"] = 2] = "UNKNOWN";
/**
* Client specified an invalid argument. Note that this differs
* from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
* that are problematic regardless of the state of the system
* (e.g., a malformed file name).
*/
CanonicalCode[CanonicalCode["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT";
/**
* Deadline expired before operation could complete. For operations
* that change the state of the system, this error may be returned
* even if the operation has completed successfully. For example, a
* successful response from a server could have been delayed long
* enough for the deadline to expire.
*/
CanonicalCode[CanonicalCode["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED";
/**
* Some requested entity (e.g., file or directory) was not found.
*/
CanonicalCode[CanonicalCode["NOT_FOUND"] = 5] = "NOT_FOUND";
/**
* Some entity that we attempted to create (e.g., file or directory)
* already exists.
*/
CanonicalCode[CanonicalCode["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS";
/**
* The caller does not have permission to execute the specified
* operation. PERMISSION_DENIED must not be used for rejections
* caused by exhausting some resource (use RESOURCE_EXHAUSTED
* instead for those errors). PERMISSION_DENIED must not be
* used if the caller can not be identified (use UNAUTHENTICATED
* instead for those errors).
*/
CanonicalCode[CanonicalCode["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED";
/**
* Some resource has been exhausted, perhaps a per-user quota, or
* perhaps the entire file system is out of space.
*/
CanonicalCode[CanonicalCode["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED";
/**
* Operation was rejected because the system is not in a state
* required for the operation's execution. For example, directory
* to be deleted may be non-empty, an rmdir operation is applied to
* a non-directory, etc.
*
* A litmus test that may help a service implementor in deciding
* between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
*
* - Use UNAVAILABLE if the client can retry just the failing call.
* - Use ABORTED if the client should retry at a higher-level
* (e.g., restarting a read-modify-write sequence).
* - Use FAILED_PRECONDITION if the client should not retry until
* the system state has been explicitly fixed. E.g., if an "rmdir"
* fails because the directory is non-empty, FAILED_PRECONDITION
* should be returned since the client should not retry unless
* they have first fixed up the directory by deleting files from it.
* - Use FAILED_PRECONDITION if the client performs conditional
* REST Get/Update/Delete on a resource and the resource on the
* server does not match the condition. E.g., conflicting
* read-modify-write on the same resource.
*/
CanonicalCode[CanonicalCode["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION";
/**
* The operation was aborted, typically due to a concurrency issue
* like sequencer check failures, transaction aborts, etc.
*
* See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE.
*/
CanonicalCode[CanonicalCode["ABORTED"] = 10] = "ABORTED";
/**
* Operation was attempted past the valid range. E.g., seeking or
* reading past end of file.
*
* Unlike INVALID_ARGUMENT, this error indicates a problem that may
* be fixed if the system state changes. For example, a 32-bit file
* system will generate INVALID_ARGUMENT if asked to read at an
* offset that is not in the range [0,2^32-1], but it will generate
* OUT_OF_RANGE if asked to read from an offset past the current
* file size.
*
* There is a fair bit of overlap between FAILED_PRECONDITION and
* OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
* error) when it applies so that callers who are iterating through
* a space can easily look for an OUT_OF_RANGE error to detect when
* they are done.
*/
CanonicalCode[CanonicalCode["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE";
/**
* Operation is not implemented or not supported/enabled in this service.
*/
CanonicalCode[CanonicalCode["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED";
/**
* Internal errors. Means some invariants expected by underlying
* system has been broken. If you see one of these errors,
* something is very broken.
*/
CanonicalCode[CanonicalCode["INTERNAL"] = 13] = "INTERNAL";
/**
* The service is currently unavailable. This is a most likely a
* transient condition and may be corrected by retrying with
* a backoff.
*
* See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE.
*/
CanonicalCode[CanonicalCode["UNAVAILABLE"] = 14] = "UNAVAILABLE";
/**
* Unrecoverable data loss or corruption.
*/
CanonicalCode[CanonicalCode["DATA_LOSS"] = 15] = "DATA_LOSS";
/**
* The request does not have valid authentication credentials for the
* operation.
*/
CanonicalCode[CanonicalCode["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED";
})(CanonicalCode = exports.CanonicalCode || (exports.CanonicalCode = {}));
StatusCode[StatusCode["ERROR"] = 2] = "ERROR";
})(StatusCode = exports.StatusCode || (exports.StatusCode = {}));
//# sourceMappingURL=status.js.map
export interface TraceState {
/**
* Adds or updates the TraceState that has the given `key` if it is
* present. The new State will always be added in the front of the
* list of states.
* Create a new TraceState which inherits from this TraceState and has the
* given key set.
* The new entry will always be added in the front of the list of states.
*

@@ -10,9 +10,10 @@ * @param key key of the TraceState entry.

*/
set(key: string, value: string): void;
set(key: string, value: string): TraceState;
/**
* Removes the TraceState Entry that has the given `key` if it is present.
* Return a new TraceState which inherits from this TraceState but does not
* contain the given key.
*
* @param key the key for the TraceState Entry to be removed.
* @param key the key for the TraceState entry to be removed.
*/
unset(key: string): void;
unset(key: string): TraceState;
/**

@@ -19,0 +20,0 @@ * Returns the value to which the specified key is mapped, or `undefined` if

"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=trace_state.js.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.12.1-alpha.54+3f72613a";
export declare const VERSION = "0.13.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.12.1-alpha.54+3f72613a';
exports.VERSION = '0.13.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/api",
"version": "0.12.1-alpha.54+3f72613a",
"version": "0.13.0",
"description": "Public API for OpenTelemetry",

@@ -55,13 +55,13 @@ "main": "build/src/index.js",

"dependencies": {
"@opentelemetry/context-base": "^0.12.1-alpha.54+3f72613a"
"@opentelemetry/context-base": "^0.13.0"
},
"devDependencies": {
"@types/mocha": "8.0.2",
"@types/node": "14.0.27",
"@types/sinon": "9.0.5",
"@types/webpack-env": "1.15.2",
"codecov": "3.7.2",
"@types/mocha": "8.0.4",
"@types/node": "14.14.10",
"@types/sinon": "9.0.9",
"@types/webpack-env": "1.16.0",
"codecov": "3.8.1",
"gts": "2.0.2",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "5.1.1",
"karma": "5.2.3",
"karma-chrome-launcher": "3.1.0",

@@ -72,13 +72,13 @@ "karma-coverage-istanbul-reporter": "3.0.3",

"karma-webpack": "4.0.2",
"linkinator": "2.1.1",
"linkinator": "2.4.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"sinon": "9.0.3",
"ts-loader": "8.0.2",
"ts-mocha": "7.0.0",
"typedoc": "0.18.0",
"sinon": "9.2.1",
"ts-loader": "8.0.11",
"ts-mocha": "8.0.0",
"typedoc": "0.19.2",
"typescript": "3.9.7",
"webpack": "4.44.1"
"webpack": "4.44.2"
},
"gitHead": "3f72613a36b6f97555a0fa7481755cf8b6cce1a7"
"gitHead": "86cbd6798f9318c5920f9d9055f289a1c3f26500"
}

@@ -109,3 +109,3 @@ # OpenTelemetry API for JavaScript

```javascript
const { B3Propagator } = require("@opentelemetry/core");
const { B3Propagator } = require("@opentelemetry/propagator-b3");

@@ -172,3 +172,3 @@ tracerProvider.register({

// use an appropriate status code here
code: api.CanonicalCode.INTERNAL,
code: api.StatusCode.ERROR,
message: err.message,

@@ -175,0 +175,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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