@opentelemetry/api
Advanced tools
Comparing version 1.0.0-rc.3 to 1.0.0
@@ -12,5 +12,7 @@ import { Context, ContextManager } from '../context/types'; | ||
/** | ||
* Set the current context manager. Returns the initialized context manager | ||
* Set the current context manager. | ||
* | ||
* @returns true if the context manager was successfully registered, else false | ||
*/ | ||
setGlobalContextManager(contextManager: ContextManager): ContextManager; | ||
setGlobalContextManager(contextManager: ContextManager): boolean; | ||
/** | ||
@@ -32,6 +34,6 @@ * Get the currently active context | ||
* | ||
* @param context context to bind to the event emitter or function. Defaults to the currently active context | ||
* @param target function or event emitter to bind | ||
* @param context context to bind to the event emitter or function. Defaults to the currently active context | ||
*/ | ||
bind<T>(target: T, context?: Context): T; | ||
bind<T>(context: Context, target: T): T; | ||
private _getContextManager; | ||
@@ -38,0 +40,0 @@ /** Disable and remove the global context manager */ |
@@ -17,8 +17,6 @@ "use strict"; | ||
*/ | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -46,7 +44,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Set the current context manager. Returns the initialized context manager | ||
* Set the current context manager. | ||
* | ||
* @returns true if the context manager was successfully registered, else false | ||
*/ | ||
ContextAPI.prototype.setGlobalContextManager = function (contextManager) { | ||
global_utils_1.registerGlobal(API_NAME, contextManager); | ||
return contextManager; | ||
return global_utils_1.registerGlobal(API_NAME, contextManager); | ||
}; | ||
@@ -73,3 +72,3 @@ /** | ||
} | ||
return (_a = this._getContextManager()).with.apply(_a, __spreadArrays([context, fn, thisArg], args)); | ||
return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args)); | ||
}; | ||
@@ -79,8 +78,7 @@ /** | ||
* | ||
* @param context context to bind to the event emitter or function. Defaults to the currently active context | ||
* @param target function or event emitter to bind | ||
* @param context context to bind to the event emitter or function. Defaults to the currently active context | ||
*/ | ||
ContextAPI.prototype.bind = function (target, context) { | ||
if (context === void 0) { context = this.active(); } | ||
return this._getContextManager().bind(target, context); | ||
ContextAPI.prototype.bind = function (context, target) { | ||
return this._getContextManager().bind(context, target); | ||
}; | ||
@@ -87,0 +85,0 @@ ContextAPI.prototype._getContextManager = function () { |
@@ -1,2 +0,2 @@ | ||
import { DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types'; | ||
import { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types'; | ||
/** | ||
@@ -21,5 +21,9 @@ * Singleton object which represents the entry point to the OpenTelemetry internal | ||
* @param logLevel - [Optional] The DiagLogLevel used to filter logs sent to the logger. If not provided it will default to INFO. | ||
* @returns The previously registered DiagLogger | ||
* @returns true if the logger was successfully registered, else false | ||
*/ | ||
setLogger: (logger: DiagLogger, logLevel?: DiagLogLevel) => void; | ||
setLogger: (logger: DiagLogger, logLevel?: DiagLogLevel) => boolean; | ||
/** | ||
* | ||
*/ | ||
createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger; | ||
verbose: DiagLogFunction; | ||
@@ -26,0 +30,0 @@ debug: DiagLogFunction; |
@@ -19,2 +19,3 @@ "use strict"; | ||
exports.DiagAPI = void 0; | ||
var ComponentLogger_1 = require("../diag/ComponentLogger"); | ||
var logLevelLogger_1 = require("../diag/internal/logLevelLogger"); | ||
@@ -50,3 +51,3 @@ var types_1 = require("../diag/types"); | ||
self.setLogger = function (logger, logLevel) { | ||
var _a; | ||
var _a, _b; | ||
if (logLevel === void 0) { logLevel = types_1.DiagLogLevel.INFO; } | ||
@@ -59,5 +60,13 @@ if (logger === self) { | ||
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); | ||
return; | ||
return false; | ||
} | ||
global_utils_1.registerGlobal('diag', logLevelLogger_1.createLogLevelDiagLogger(logLevel, logger), true); | ||
var oldLogger = global_utils_1.getGlobal('diag'); | ||
var newLogger = logLevelLogger_1.createLogLevelDiagLogger(logLevel, logger); | ||
// There already is an logger registered. We'll let it know before overwriting it. | ||
if (oldLogger) { | ||
var stack = (_b = new Error().stack) !== null && _b !== void 0 ? _b : '<failed to generate stacktrace>'; | ||
oldLogger.warn("Current logger will be overwritten from " + stack); | ||
newLogger.warn("Current logger will overwrite one already registered from " + stack); | ||
} | ||
return global_utils_1.registerGlobal('diag', newLogger, true); | ||
}; | ||
@@ -67,2 +76,5 @@ self.disable = function () { | ||
}; | ||
self.createComponentLogger = function (options) { | ||
return new ComponentLogger_1.DiagComponentLogger(options); | ||
}; | ||
self.verbose = _logProxy('verbose'); | ||
@@ -69,0 +81,0 @@ self.debug = _logProxy('debug'); |
import { Context } from '../context/types'; | ||
import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator'; | ||
import { getBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers'; | ||
import { createBaggage } from '../baggage/utils'; | ||
/** | ||
@@ -13,5 +15,7 @@ * Singleton object which represents the entry point to the OpenTelemetry Propagation API | ||
/** | ||
* Set the current propagator. Returns the initialized propagator | ||
* Set the current propagator. | ||
* | ||
* @returns true if the propagator was successfully registered, else false | ||
*/ | ||
setGlobalPropagator(propagator: TextMapPropagator): TextMapPropagator; | ||
setGlobalPropagator(propagator: TextMapPropagator): boolean; | ||
/** | ||
@@ -39,4 +43,8 @@ * Inject context into a carrier to be propagated inter-process | ||
disable(): void; | ||
createBaggage: typeof createBaggage; | ||
getBaggage: typeof getBaggage; | ||
setBaggage: typeof setBaggage; | ||
deleteBaggage: typeof deleteBaggage; | ||
private _getGlobalPropagator; | ||
} | ||
//# sourceMappingURL=propagation.d.ts.map |
@@ -19,6 +19,9 @@ "use strict"; | ||
exports.PropagationAPI = void 0; | ||
var global_utils_1 = require("../internal/global-utils"); | ||
var NoopTextMapPropagator_1 = require("../propagation/NoopTextMapPropagator"); | ||
var TextMapPropagator_1 = require("../propagation/TextMapPropagator"); | ||
var global_utils_1 = require("../internal/global-utils"); | ||
var context_helpers_1 = require("../baggage/context-helpers"); | ||
var utils_1 = require("../baggage/utils"); | ||
var API_NAME = 'propagation'; | ||
var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator(); | ||
/** | ||
@@ -30,2 +33,6 @@ * Singleton object which represents the entry point to the OpenTelemetry Propagation API | ||
function PropagationAPI() { | ||
this.createBaggage = utils_1.createBaggage; | ||
this.getBaggage = context_helpers_1.getBaggage; | ||
this.setBaggage = context_helpers_1.setBaggage; | ||
this.deleteBaggage = context_helpers_1.deleteBaggage; | ||
} | ||
@@ -40,7 +47,8 @@ /** Get the singleton instance of the Propagator API */ | ||
/** | ||
* Set the current propagator. Returns the initialized propagator | ||
* Set the current propagator. | ||
* | ||
* @returns true if the propagator was successfully registered, else false | ||
*/ | ||
PropagationAPI.prototype.setGlobalPropagator = function (propagator) { | ||
global_utils_1.registerGlobal(API_NAME, propagator); | ||
return propagator; | ||
return global_utils_1.registerGlobal(API_NAME, propagator); | ||
}; | ||
@@ -80,3 +88,3 @@ /** | ||
PropagationAPI.prototype._getGlobalPropagator = function () { | ||
return global_utils_1.getGlobal(API_NAME) || NoopTextMapPropagator_1.NOOP_TEXT_MAP_PROPAGATOR; | ||
return global_utils_1.getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; | ||
}; | ||
@@ -83,0 +91,0 @@ return PropagationAPI; |
@@ -0,4 +1,5 @@ | ||
import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils'; | ||
import { Tracer } from '../trace/tracer'; | ||
import { TracerProvider } from '../trace/tracer_provider'; | ||
import { isSpanContextValid } from '../trace/spancontext-utils'; | ||
import { deleteSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils'; | ||
/** | ||
@@ -15,5 +16,7 @@ * Singleton object which represents the entry point to the OpenTelemetry Tracing API | ||
/** | ||
* Set the current global tracer. Returns the initialized global tracer provider | ||
* Set the current global tracer. | ||
* | ||
* @returns true if the tracer provider was successfully registered, else false | ||
*/ | ||
setGlobalTracerProvider(provider: TracerProvider): TracerProvider; | ||
setGlobalTracerProvider(provider: TracerProvider): boolean; | ||
/** | ||
@@ -29,4 +32,10 @@ * Returns the global tracer provider. | ||
disable(): void; | ||
wrapSpanContext: typeof wrapSpanContext; | ||
isSpanContextValid: typeof isSpanContextValid; | ||
deleteSpan: typeof deleteSpan; | ||
getSpan: typeof getSpan; | ||
getSpanContext: typeof getSpanContext; | ||
setSpan: typeof setSpan; | ||
setSpanContext: typeof setSpanContext; | ||
} | ||
//# sourceMappingURL=trace.d.ts.map |
@@ -19,5 +19,6 @@ "use strict"; | ||
exports.TraceAPI = void 0; | ||
var global_utils_1 = require("../internal/global-utils"); | ||
var ProxyTracerProvider_1 = require("../trace/ProxyTracerProvider"); | ||
var spancontext_utils_1 = require("../trace/spancontext-utils"); | ||
var global_utils_1 = require("../internal/global-utils"); | ||
var context_utils_1 = require("../trace/context-utils"); | ||
var API_NAME = 'trace'; | ||
@@ -31,3 +32,9 @@ /** | ||
this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); | ||
this.wrapSpanContext = spancontext_utils_1.wrapSpanContext; | ||
this.isSpanContextValid = spancontext_utils_1.isSpanContextValid; | ||
this.deleteSpan = context_utils_1.deleteSpan; | ||
this.getSpan = context_utils_1.getSpan; | ||
this.getSpanContext = context_utils_1.getSpanContext; | ||
this.setSpan = context_utils_1.setSpan; | ||
this.setSpanContext = context_utils_1.setSpanContext; | ||
} | ||
@@ -42,8 +49,9 @@ /** Get the singleton instance of the Trace API */ | ||
/** | ||
* Set the current global tracer. Returns the initialized global tracer provider | ||
* Set the current global tracer. | ||
* | ||
* @returns true if the tracer provider was successfully registered, else false | ||
*/ | ||
TraceAPI.prototype.setGlobalTracerProvider = function (provider) { | ||
this._proxyTracerProvider.setDelegate(provider); | ||
global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider); | ||
return this._proxyTracerProvider; | ||
return global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider); | ||
}; | ||
@@ -50,0 +58,0 @@ /** |
import { Context } from './types'; | ||
import { Baggage, Span, SpanContext } from '../'; | ||
/** | ||
* Return the span if one exists | ||
* | ||
* @param context context to get span from | ||
*/ | ||
export declare function getSpan(context: Context): Span | undefined; | ||
/** | ||
* Set the span on a context | ||
* | ||
* @param context context to use as parent | ||
* @param span span to set active | ||
*/ | ||
export declare function setSpan(context: Context, span: Span): Context; | ||
/** | ||
* Wrap span context in a NoopSpan and set as span in a new | ||
* context | ||
* | ||
* @param context context to set active span on | ||
* @param spanContext span context to be wrapped | ||
*/ | ||
export declare function setSpanContext(context: Context, spanContext: SpanContext): Context; | ||
/** | ||
* Get the span context of the span if it exists. | ||
* | ||
* @param context context to get values from | ||
*/ | ||
export declare function getSpanContext(context: Context): SpanContext | undefined; | ||
/** | ||
* Sets value on context to indicate that instrumentation should | ||
* be suppressed beyond this current scope. | ||
* | ||
* @param context context to set the suppress instrumentation value on. | ||
*/ | ||
export declare function suppressInstrumentation(context: Context): Context; | ||
/** | ||
* Sets value on context to indicate that instrumentation should | ||
* no-longer be suppressed beyond this current scope. | ||
* | ||
* @param context context to set the suppress instrumentation value on. | ||
*/ | ||
export declare function unsuppressInstrumentation(context: Context): Context; | ||
/** | ||
* Return current suppress instrumentation value for the given context, | ||
* if it exists. | ||
* | ||
* @param context context check for the suppress instrumentation value. | ||
*/ | ||
export declare function isInstrumentationSuppressed(context: Context): boolean; | ||
/** | ||
* @param {Context} Context that manage all context values | ||
* @returns {Baggage} Extracted baggage from the context | ||
*/ | ||
export declare function getBaggage(context: Context): Baggage | undefined; | ||
/** | ||
* @param {Context} Context that manage all context values | ||
* @param {Baggage} baggage that will be set in the actual context | ||
*/ | ||
export declare function setBaggage(context: Context, baggage: Baggage): Context; | ||
/** Get a key to uniquely identify a context value */ | ||
@@ -62,0 +3,0 @@ export declare function createContextKey(description: string): symbol; |
@@ -18,105 +18,11 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ROOT_CONTEXT = exports.createContextKey = exports.setBaggage = exports.getBaggage = exports.isInstrumentationSuppressed = exports.unsuppressInstrumentation = exports.suppressInstrumentation = exports.getSpanContext = exports.setSpanContext = exports.setSpan = exports.getSpan = void 0; | ||
var NoopSpan_1 = require("../trace/NoopSpan"); | ||
/** | ||
* span key | ||
*/ | ||
var SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN'); | ||
/** | ||
* Shared key for indicating if instrumentation should be suppressed beyond | ||
* this current scope. | ||
*/ | ||
var SUPPRESS_INSTRUMENTATION_KEY = createContextKey('OpenTelemetry Context Key SUPPRESS_INSTRUMENTATION'); | ||
/** | ||
* Baggage key | ||
*/ | ||
var BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key'); | ||
/** | ||
* Return the span if one exists | ||
* | ||
* @param context context to get span from | ||
*/ | ||
function getSpan(context) { | ||
return context.getValue(SPAN_KEY) || undefined; | ||
} | ||
exports.getSpan = getSpan; | ||
/** | ||
* Set the span on a context | ||
* | ||
* @param context context to use as parent | ||
* @param span span to set active | ||
*/ | ||
function setSpan(context, span) { | ||
return context.setValue(SPAN_KEY, span); | ||
} | ||
exports.setSpan = setSpan; | ||
/** | ||
* Wrap span context in a NoopSpan and set as span in a new | ||
* context | ||
* | ||
* @param context context to set active span on | ||
* @param spanContext span context to be wrapped | ||
*/ | ||
function setSpanContext(context, spanContext) { | ||
return setSpan(context, new NoopSpan_1.NoopSpan(spanContext)); | ||
} | ||
exports.setSpanContext = setSpanContext; | ||
/** | ||
* Get the span context of the span if it exists. | ||
* | ||
* @param context context to get values from | ||
*/ | ||
function getSpanContext(context) { | ||
var _a; | ||
return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.context(); | ||
} | ||
exports.getSpanContext = getSpanContext; | ||
/** | ||
* Sets value on context to indicate that instrumentation should | ||
* be suppressed beyond this current scope. | ||
* | ||
* @param context context to set the suppress instrumentation value on. | ||
*/ | ||
function suppressInstrumentation(context) { | ||
return context.setValue(SUPPRESS_INSTRUMENTATION_KEY, true); | ||
} | ||
exports.suppressInstrumentation = suppressInstrumentation; | ||
/** | ||
* Sets value on context to indicate that instrumentation should | ||
* no-longer be suppressed beyond this current scope. | ||
* | ||
* @param context context to set the suppress instrumentation value on. | ||
*/ | ||
function unsuppressInstrumentation(context) { | ||
return context.setValue(SUPPRESS_INSTRUMENTATION_KEY, false); | ||
} | ||
exports.unsuppressInstrumentation = unsuppressInstrumentation; | ||
/** | ||
* Return current suppress instrumentation value for the given context, | ||
* if it exists. | ||
* | ||
* @param context context check for the suppress instrumentation value. | ||
*/ | ||
function isInstrumentationSuppressed(context) { | ||
return Boolean(context.getValue(SUPPRESS_INSTRUMENTATION_KEY)); | ||
} | ||
exports.isInstrumentationSuppressed = isInstrumentationSuppressed; | ||
/** | ||
* @param {Context} Context that manage all context values | ||
* @returns {Baggage} Extracted baggage from the context | ||
*/ | ||
function getBaggage(context) { | ||
return context.getValue(BAGGAGE_KEY) || undefined; | ||
} | ||
exports.getBaggage = getBaggage; | ||
/** | ||
* @param {Context} Context that manage all context values | ||
* @param {Baggage} baggage that will be set in the actual context | ||
*/ | ||
function setBaggage(context, baggage) { | ||
return context.setValue(BAGGAGE_KEY, baggage); | ||
} | ||
exports.setBaggage = setBaggage; | ||
exports.ROOT_CONTEXT = exports.createContextKey = void 0; | ||
/** Get a key to uniquely identify a context value */ | ||
function createContextKey(description) { | ||
// The specification states that for the same input, multiple calls should | ||
// return different keys. Due to the nature of the JS dependency management | ||
// system, this creates problems where multiple versions of some package | ||
// could hold different keys for the same property. | ||
// | ||
// Therefore, we use Symbol.for which returns the same key for the same input. | ||
return Symbol.for(description); | ||
@@ -123,0 +29,0 @@ } |
@@ -5,3 +5,3 @@ import * as types from './types'; | ||
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(_context: types.Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>; | ||
bind<T>(target: T, _context?: types.Context): T; | ||
bind<T>(_context: types.Context, target: T): T; | ||
enable(): this; | ||
@@ -8,0 +8,0 @@ disable(): this; |
@@ -17,8 +17,6 @@ "use strict"; | ||
*/ | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -39,5 +37,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
} | ||
return fn.call.apply(fn, __spreadArrays([thisArg], args)); | ||
return fn.call.apply(fn, __spreadArray([thisArg], args)); | ||
}; | ||
NoopContextManager.prototype.bind = function (target, _context) { | ||
NoopContextManager.prototype.bind = function (_context, target) { | ||
return target; | ||
@@ -44,0 +42,0 @@ }; |
@@ -39,6 +39,6 @@ export interface Context { | ||
* Bind an object as the current context (or a specific one) | ||
* @param [context] Optionally specify the context which you want to assign | ||
* @param target Any object to which a context need to be set | ||
* @param [context] Optionally specify the context which you want to assign | ||
*/ | ||
bind<T>(target: T, context?: Context): T; | ||
bind<T>(context: Context, target: T): T; | ||
/** | ||
@@ -45,0 +45,0 @@ * Enable context management |
@@ -64,2 +64,8 @@ export declare type DiagLogFunction = (message: string, ...args: unknown[]) => void; | ||
} | ||
/** | ||
* Defines options for ComponentLogger | ||
*/ | ||
export interface ComponentLoggerOptions { | ||
namespace: string; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,13 +0,9 @@ | ||
export * from './baggage'; | ||
export * from './baggage/types'; | ||
export { baggageEntryMetadataFromString } from './baggage/utils'; | ||
export * from './common/Exception'; | ||
export * from './common/Time'; | ||
export * from './diag'; | ||
export * from './propagation/NoopTextMapPropagator'; | ||
export * from './propagation/TextMapPropagator'; | ||
export * from './trace/attributes'; | ||
export * from './trace/Event'; | ||
export * from './trace/link_context'; | ||
export * from './trace/link'; | ||
export * from './trace/NoopTracer'; | ||
export * from './trace/NoopTracerProvider'; | ||
export * from './trace/ProxyTracer'; | ||
@@ -22,3 +18,2 @@ export * from './trace/ProxyTracerProvider'; | ||
export * from './trace/status'; | ||
export * from './trace/TimedEvent'; | ||
export * from './trace/trace_flags'; | ||
@@ -30,3 +25,2 @@ export * from './trace/trace_state'; | ||
export * from './context/context'; | ||
export * from './context/NoopContextManager'; | ||
export * from './context/types'; | ||
@@ -33,0 +27,0 @@ import { ContextAPI } from './api/context'; |
@@ -28,15 +28,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.diag = exports.propagation = exports.trace = exports.context = exports.isValidSpanId = exports.isValidTraceId = exports.isSpanContextValid = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = void 0; | ||
__exportStar(require("./baggage"), exports); | ||
exports.diag = exports.propagation = exports.trace = exports.context = exports.isValidSpanId = exports.isValidTraceId = exports.isSpanContextValid = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = exports.baggageEntryMetadataFromString = void 0; | ||
__exportStar(require("./baggage/types"), exports); | ||
var utils_1 = require("./baggage/utils"); | ||
Object.defineProperty(exports, "baggageEntryMetadataFromString", { enumerable: true, get: function () { return utils_1.baggageEntryMetadataFromString; } }); | ||
__exportStar(require("./common/Exception"), exports); | ||
__exportStar(require("./common/Time"), exports); | ||
__exportStar(require("./diag"), exports); | ||
__exportStar(require("./propagation/NoopTextMapPropagator"), exports); | ||
__exportStar(require("./propagation/TextMapPropagator"), exports); | ||
__exportStar(require("./trace/attributes"), exports); | ||
__exportStar(require("./trace/Event"), exports); | ||
__exportStar(require("./trace/link_context"), exports); | ||
__exportStar(require("./trace/link"), exports); | ||
__exportStar(require("./trace/NoopTracer"), exports); | ||
__exportStar(require("./trace/NoopTracerProvider"), exports); | ||
__exportStar(require("./trace/ProxyTracer"), exports); | ||
@@ -51,3 +48,2 @@ __exportStar(require("./trace/ProxyTracerProvider"), exports); | ||
__exportStar(require("./trace/status"), exports); | ||
__exportStar(require("./trace/TimedEvent"), exports); | ||
__exportStar(require("./trace/trace_flags"), exports); | ||
@@ -65,3 +61,2 @@ __exportStar(require("./trace/trace_state"), exports); | ||
__exportStar(require("./context/context"), exports); | ||
__exportStar(require("./context/NoopContextManager"), exports); | ||
__exportStar(require("./context/types"), exports); | ||
@@ -68,0 +63,0 @@ var context_1 = require("./api/context"); |
@@ -5,3 +5,3 @@ import { ContextManager } from '../context/types'; | ||
import type { TracerProvider } from '../trace/tracer_provider'; | ||
export declare function registerGlobal<Type extends keyof OTelGlobalAPI>(type: Type, instance: OTelGlobalAPI[Type], allowOverride?: boolean): void; | ||
export declare function registerGlobal<Type extends keyof OTelGlobalAPI>(type: Type, instance: OTelGlobalAPI[Type], allowOverride?: boolean): boolean; | ||
export declare function getGlobal<Type extends keyof OTelGlobalAPI>(type: Type): OTelGlobalAPI[Type] | undefined; | ||
@@ -8,0 +8,0 @@ export declare function unregisterGlobal(type: keyof OTelGlobalAPI): void; |
@@ -24,3 +24,3 @@ "use strict"; | ||
var major = version_1.VERSION.split('.')[0]; | ||
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("io.opentelemetry.js.api." + major); | ||
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major); | ||
var _global = platform_1._globalThis; | ||
@@ -30,6 +30,5 @@ function registerGlobal(type, instance, allowOverride) { | ||
if (allowOverride === void 0) { allowOverride = false; } | ||
_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { | ||
var api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { | ||
version: version_1.VERSION, | ||
}; | ||
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY]; | ||
}); | ||
if (!allowOverride && api[type]) { | ||
@@ -39,3 +38,3 @@ // already registered an API of this type | ||
__1.diag.error(err.stack || err.message); | ||
return; | ||
return false; | ||
} | ||
@@ -46,5 +45,7 @@ if (api.version !== version_1.VERSION) { | ||
__1.diag.error(err.stack || err.message); | ||
return; | ||
return false; | ||
} | ||
api[type] = instance; | ||
__1.diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + version_1.VERSION + "."); | ||
return true; | ||
} | ||
@@ -62,2 +63,3 @@ exports.registerGlobal = registerGlobal; | ||
function unregisterGlobal(type) { | ||
__1.diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + version_1.VERSION + "."); | ||
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY]; | ||
@@ -64,0 +66,0 @@ if (api) { |
@@ -13,3 +13,2 @@ import { Context } from '../context/types'; | ||
} | ||
export declare const NOOP_TEXT_MAP_PROPAGATOR: NoopTextMapPropagator; | ||
//# sourceMappingURL=NoopTextMapPropagator.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NOOP_TEXT_MAP_PROPAGATOR = exports.NoopTextMapPropagator = void 0; | ||
exports.NoopTextMapPropagator = void 0; | ||
/** | ||
@@ -38,3 +38,2 @@ * No-op implementations of {@link TextMapPropagator}. | ||
exports.NoopTextMapPropagator = NoopTextMapPropagator; | ||
exports.NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator(); | ||
//# sourceMappingURL=NoopTextMapPropagator.js.map |
import { SpanAttributes } from './attributes'; | ||
import { LinkContext } from './link_context'; | ||
import { SpanContext } from './span_context'; | ||
/** | ||
@@ -19,4 +19,4 @@ * A pointer from the current {@link Span} to another span in the same trace or | ||
export interface Link { | ||
/** The {@link LinkContext} of a linked span. */ | ||
context: LinkContext; | ||
/** The {@link SpanContext} of a linked span. */ | ||
context: SpanContext; | ||
/** A set of {@link SpanAttributes} on the link. */ | ||
@@ -23,0 +23,0 @@ attributes?: SpanAttributes; |
@@ -10,4 +10,6 @@ import { Context } from '../context/types'; | ||
startSpan(name: string, options?: SpanOptions, context?: Context): Span; | ||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>; | ||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions | undefined, fn: F): ReturnType<F>; | ||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions | undefined, ctx: Context | undefined, fn: F): ReturnType<F>; | ||
} | ||
export declare const NOOP_TRACER: NoopTracer; | ||
//# sourceMappingURL=NoopTracer.d.ts.map |
@@ -18,5 +18,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NOOP_TRACER = exports.NoopTracer = void 0; | ||
var context_1 = require("../context/context"); | ||
var NoopSpan_1 = require("./NoopSpan"); | ||
exports.NoopTracer = void 0; | ||
var __1 = require("../"); | ||
var context_utils_1 = require("../trace/context-utils"); | ||
var NonRecordingSpan_1 = require("./NonRecordingSpan"); | ||
var spancontext_utils_1 = require("./spancontext-utils"); | ||
@@ -33,13 +34,37 @@ /** | ||
if (root) { | ||
return new NoopSpan_1.NoopSpan(); | ||
return new NonRecordingSpan_1.NonRecordingSpan(); | ||
} | ||
var parentFromContext = context && context_1.getSpanContext(context); | ||
var parentFromContext = context && context_utils_1.getSpanContext(context); | ||
if (isSpanContext(parentFromContext) && | ||
spancontext_utils_1.isSpanContextValid(parentFromContext)) { | ||
return new NoopSpan_1.NoopSpan(parentFromContext); | ||
return new NonRecordingSpan_1.NonRecordingSpan(parentFromContext); | ||
} | ||
else { | ||
return new NoopSpan_1.NoopSpan(); | ||
return new NonRecordingSpan_1.NonRecordingSpan(); | ||
} | ||
}; | ||
NoopTracer.prototype.startActiveSpan = function (name, arg2, arg3, arg4) { | ||
var opts; | ||
var ctx; | ||
var fn; | ||
if (arguments.length < 2) { | ||
return; | ||
} | ||
else if (arguments.length === 2) { | ||
fn = arg2; | ||
} | ||
else if (arguments.length === 3) { | ||
opts = arg2; | ||
fn = arg3; | ||
} | ||
else { | ||
opts = arg2; | ||
ctx = arg3; | ||
fn = arg4; | ||
} | ||
var parentContext = ctx !== null && ctx !== void 0 ? ctx : __1.context.active(); | ||
var span = this.startSpan(name, opts, parentContext); | ||
var contextWithSpanSet = context_utils_1.setSpan(parentContext, span); | ||
return __1.context.with(contextWithSpanSet, fn, undefined, span); | ||
}; | ||
return NoopTracer; | ||
@@ -54,3 +79,2 @@ }()); | ||
} | ||
exports.NOOP_TRACER = new NoopTracer(); | ||
//# sourceMappingURL=NoopTracer.js.map |
@@ -12,3 +12,2 @@ import { Tracer } from './tracer'; | ||
} | ||
export declare const NOOP_TRACER_PROVIDER: NoopTracerProvider; | ||
//# sourceMappingURL=NoopTracerProvider.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NOOP_TRACER_PROVIDER = exports.NoopTracerProvider = void 0; | ||
exports.NoopTracerProvider = void 0; | ||
var NoopTracer_1 = require("./NoopTracer"); | ||
@@ -31,3 +31,3 @@ /** | ||
NoopTracerProvider.prototype.getTracer = function (_name, _version) { | ||
return NoopTracer_1.NOOP_TRACER; | ||
return new NoopTracer_1.NoopTracer(); | ||
}; | ||
@@ -37,3 +37,2 @@ return NoopTracerProvider; | ||
exports.NoopTracerProvider = NoopTracerProvider; | ||
exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); | ||
//# sourceMappingURL=NoopTracerProvider.js.map |
@@ -16,2 +16,3 @@ import { Context } from '../context/types'; | ||
startSpan(name: string, options?: SpanOptions, context?: Context): Span; | ||
startActiveSpan<F extends (span: Span) => unknown>(_name: string, _options: F | SpanOptions, _context?: F | Context, _fn?: F): ReturnType<F>; | ||
/** | ||
@@ -18,0 +19,0 @@ * Try to get a tracer from the proxy tracer provider. |
@@ -32,2 +32,6 @@ "use strict"; | ||
}; | ||
ProxyTracer.prototype.startActiveSpan = function (_name, _options, _context, _fn) { | ||
var tracer = this._getTracer(); | ||
return Reflect.apply(tracer.startActiveSpan, tracer, arguments); | ||
}; | ||
/** | ||
@@ -43,3 +47,3 @@ * Try to get a tracer from the proxy tracer provider. | ||
if (!tracer) { | ||
return NoopTracer_1.NOOP_TRACER; | ||
return new NoopTracer_1.NoopTracer(); | ||
} | ||
@@ -46,0 +50,0 @@ this._delegate = tracer; |
@@ -21,2 +21,3 @@ "use strict"; | ||
var NoopTracerProvider_1 = require("./NoopTracerProvider"); | ||
var NOOP_TRACER_PROVIDER = new NoopTracerProvider_1.NoopTracerProvider(); | ||
/** | ||
@@ -42,3 +43,3 @@ * Tracer provider which provides {@link ProxyTracer}s. | ||
var _a; | ||
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NoopTracerProvider_1.NOOP_TRACER_PROVIDER; | ||
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER; | ||
}; | ||
@@ -45,0 +46,0 @@ /** |
@@ -25,3 +25,3 @@ import { Exception } from '../common/Exception'; | ||
*/ | ||
context(): SpanContext; | ||
spanContext(): SpanContext; | ||
/** | ||
@@ -28,0 +28,0 @@ * Sets an attribute to the span. |
@@ -0,1 +1,2 @@ | ||
import { Span } from './span'; | ||
import { SpanContext } from './span_context'; | ||
@@ -12,2 +13,9 @@ export declare const INVALID_SPANID = "0000000000000000"; | ||
export declare function isSpanContextValid(spanContext: SpanContext): boolean; | ||
/** | ||
* Wrap the given {@link SpanContext} in a new non-recording {@link Span} | ||
* | ||
* @param spanContext span context to be wrapped | ||
* @returns a new non-recording {@link Span} with the provided context | ||
*/ | ||
export declare function wrapSpanContext(spanContext: SpanContext): Span; | ||
//# sourceMappingURL=spancontext-utils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSpanContextValid = exports.isValidSpanId = exports.isValidTraceId = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = void 0; | ||
exports.wrapSpanContext = exports.isSpanContextValid = exports.isValidSpanId = exports.isValidTraceId = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = void 0; | ||
/* | ||
* 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. | ||
*/ | ||
var NonRecordingSpan_1 = require("./NonRecordingSpan"); | ||
var trace_flags_1 = require("./trace_flags"); | ||
@@ -30,2 +46,12 @@ var VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i; | ||
exports.isSpanContextValid = isSpanContextValid; | ||
/** | ||
* Wrap the given {@link SpanContext} in a new non-recording {@link Span} | ||
* | ||
* @param spanContext span context to be wrapped | ||
* @returns a new non-recording {@link Span} with the provided context | ||
*/ | ||
function wrapSpanContext(spanContext) { | ||
return new NonRecordingSpan_1.NonRecordingSpan(spanContext); | ||
} | ||
exports.wrapSpanContext = wrapSpanContext; | ||
//# sourceMappingURL=spancontext-utils.js.map |
@@ -23,3 +23,49 @@ import { Context } from '../context/types'; | ||
startSpan(name: string, options?: SpanOptions, context?: Context): Span; | ||
/** | ||
* Starts a new {@link Span} and calls the given function passing it the | ||
* created span as first argument. | ||
* Additionally the new span gets set in context and this context is activated | ||
* for the duration of the function call. | ||
* | ||
* @param name The name of the span | ||
* @param [options] SpanOptions used for span creation | ||
* @param [context] Context to use to extract parent | ||
* @param fn function called in the context of the span and receives the newly created span as an argument | ||
* @returns return value of fn | ||
* @example | ||
* const something = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* span.setStatus({code: SpanStatusCode.OK}); | ||
* return something; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } finally { | ||
* span.end(); | ||
* } | ||
* }); | ||
* @example | ||
* const span = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* return span; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } | ||
* }); | ||
* do some more work | ||
* span.end(); | ||
*/ | ||
startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>; | ||
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>; | ||
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>; | ||
} | ||
//# sourceMappingURL=tracer.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.0-rc.3"; | ||
export declare const VERSION = "1.0.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '1.0.0-rc.3'; | ||
exports.VERSION = '1.0.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,2 +5,90 @@ # CHANGELOG | ||
## 1.0.0 | ||
### :memo: Documentation | ||
* [#89](https://github.com/open-telemetry/opentelemetry-js-api/pull/89) chore: update upgrade guidelines ([@dyladan](https://github.com/dyladan)) | ||
### :house: Internal | ||
* [#90](https://github.com/open-telemetry/opentelemetry-js-api/pull/90) chore: enable typescript 4.3 noImplicitOverride option ([@Flarna](https://github.com/Flarna)) | ||
### Committers: 2 | ||
* Daniel Dyla ([@dyladan](https://github.com/dyladan)) | ||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna)) | ||
## 0.21.0 | ||
### :boom: Breaking Change | ||
* [#78](https://github.com/open-telemetry/opentelemetry-js-api/pull/78) feat: unify signatures of `with` and `bind` ([@Rauno56](https://github.com/Rauno56)) | ||
* [#46](https://github.com/open-telemetry/opentelemetry-js-api/pull/46) chore: do not export singletons ([@dyladan](https://github.com/dyladan)) | ||
### :rocket: Enhancement | ||
* [#81](https://github.com/open-telemetry/opentelemetry-js-api/pull/81) chore: function overloads implementation of startActiveSpan in noop t… ([@naseemkullah](https://github.com/naseemkullah)) | ||
### :house: Internal | ||
* [#84](https://github.com/open-telemetry/opentelemetry-js-api/pull/84) chore: remove unused backwards compatibility folder ([@Flarna](https://github.com/Flarna)) | ||
* [#85](https://github.com/open-telemetry/opentelemetry-js-api/pull/85) chore: add node:16 to the test matrix ([@Rauno56](https://github.com/Rauno56)) | ||
* [#63](https://github.com/open-telemetry/opentelemetry-js-api/pull/63) feat: debug log global registrations and logger overwrites ([@Rauno56](https://github.com/Rauno56)) | ||
* [#75](https://github.com/open-telemetry/opentelemetry-js-api/pull/75) Add CodeQL Security Scan ([@xukaren](https://github.com/xukaren)) | ||
* [#79](https://github.com/open-telemetry/opentelemetry-js-api/pull/79) chore: fix eslint config ([@Rauno56](https://github.com/Rauno56)) | ||
### Committers: 5 | ||
* Daniel Dyla ([@dyladan](https://github.com/dyladan)) | ||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna)) | ||
* Karen Xu ([@xukaren](https://github.com/xukaren)) | ||
* Naseem ([@naseemkullah](https://github.com/naseemkullah)) | ||
* Rauno Viskus ([@Rauno56](https://github.com/Rauno56)) | ||
## 0.20.0 | ||
### :rocket: Enhancement | ||
* [#69](https://github.com/open-telemetry/opentelemetry-js-api/pull/69) feat(context): add utils method to remove keys from context ([@vmarchaud](https://github.com/vmarchaud)) | ||
* [#71](https://github.com/open-telemetry/opentelemetry-js-api/pull/71) chore: export baggage ([@dyladan](https://github.com/dyladan)) | ||
### Committers: 2 | ||
* Daniel Dyla ([@dyladan](https://github.com/dyladan)) | ||
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud)) | ||
## 0.19.0 | ||
### :boom: Breaking Change | ||
* [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) chore: move baggage methods in propagation namespace ([@vmarchaud](https://github.com/vmarchaud)) | ||
* [#65](https://github.com/open-telemetry/opentelemetry-js-api/pull/65) chore: remove suppress instrumentation ([@dyladan](https://github.com/dyladan)) | ||
* [#60](https://github.com/open-telemetry/opentelemetry-js-api/pull/60) chore: removing timed event ([@obecny](https://github.com/obecny)) | ||
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan)) | ||
* [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) chore: move span method for context in trace API #40 ([@vmarchaud](https://github.com/vmarchaud)) | ||
* [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) chore: rename `span#context()` to `span#spanContext` ([@dyladan](https://github.com/dyladan)) | ||
* [#43](https://github.com/open-telemetry/opentelemetry-js-api/pull/43) chore: renaming noop span to non recording span ([@obecny](https://github.com/obecny)) | ||
* [#32](https://github.com/open-telemetry/opentelemetry-js-api/pull/32) feat!: return boolean success value from setGlobalXXX methods ([@dyladan](https://github.com/dyladan)) | ||
### :rocket: Enhancement | ||
* [#62](https://github.com/open-telemetry/opentelemetry-js-api/pull/62) chore: adding component logger ([@obecny](https://github.com/obecny)) | ||
* [#54](https://github.com/open-telemetry/opentelemetry-js-api/pull/54) feat: add tracer.startActiveSpan() ([@naseemkullah](https://github.com/naseemkullah)) | ||
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan)) | ||
* [#51](https://github.com/open-telemetry/opentelemetry-js-api/pull/51) feat: add function to wrap SpanContext in NonRecordingSpan #49 ([@dyladan](https://github.com/dyladan)) | ||
### :memo: Documentation | ||
* [#64](https://github.com/open-telemetry/opentelemetry-js-api/pull/64) chore: document the reason for symbol.for ([@dyladan](https://github.com/dyladan)) | ||
* [#44](https://github.com/open-telemetry/opentelemetry-js-api/pull/44) chore: updating readme headline and fixing links ([@obecny](https://github.com/obecny)) | ||
### Committers: 6 | ||
* Bartlomiej Obecny ([@obecny](https://github.com/obecny)) | ||
* Daniel Dyla ([@dyladan](https://github.com/dyladan)) | ||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna)) | ||
* Naseem ([@naseemkullah](https://github.com/naseemkullah)) | ||
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud)) | ||
* t2t2 ([@t2t2](https://github.com/t2t2)) | ||
## 1.0.0-rc.0 | ||
@@ -7,0 +95,0 @@ |
{ | ||
"name": "@opentelemetry/api", | ||
"version": "1.0.0-rc.3", | ||
"version": "1.0.0", | ||
"description": "Public API for OpenTelemetry", | ||
"main": "build/src/index.js", | ||
"module": "build/esm/index.js", | ||
"types": "build/src/index.d.ts", | ||
"browser": { | ||
"./src/platform/index.ts": "./src/platform/browser/index.ts", | ||
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js", | ||
"./build/src/platform/index.js": "./build/src/platform/browser/index.js" | ||
@@ -14,6 +16,6 @@ }, | ||
"build": "npm run compile", | ||
"clean": "tsc --build --clean", | ||
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", | ||
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p .", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p .", | ||
"compile": "tsc --build", | ||
"compile": "tsc --build tsconfig.json tsconfig.esm.json", | ||
"docs": "typedoc", | ||
@@ -44,2 +46,5 @@ "docs:deploy": "gh-pages --dist docs/out", | ||
"files": [ | ||
"build/esm/**/*.js", | ||
"build/esm/**/*.js.map", | ||
"build/esm/**/*.d.ts", | ||
"build/src/**/*.js", | ||
@@ -55,13 +60,13 @@ "build/src/**/*.js.map", | ||
"devDependencies": { | ||
"@types/mocha": "8.2.1", | ||
"@types/node": "14.14.28", | ||
"@types/sinon": "9.0.10", | ||
"@types/mocha": "8.2.2", | ||
"@types/node": "14.17.1", | ||
"@types/sinon": "10.0.2", | ||
"@types/webpack-env": "1.16.0", | ||
"@typescript-eslint/eslint-plugin": "4.15.1", | ||
"@typescript-eslint/parser": "4.15.1", | ||
"codecov": "3.8.1", | ||
"eslint": "7.20.0", | ||
"@typescript-eslint/eslint-plugin": "4.26.0", | ||
"@typescript-eslint/parser": "4.26.0", | ||
"codecov": "3.8.2", | ||
"eslint": "7.28.0", | ||
"eslint-plugin-header": "3.1.1", | ||
"eslint-plugin-import": "2.22.1", | ||
"gh-pages": "3.1.0", | ||
"eslint-plugin-import": "2.23.4", | ||
"gh-pages": "3.2.0", | ||
"gts": "3.1.0", | ||
@@ -75,13 +80,13 @@ "istanbul-instrumenter-loader": "3.0.1", | ||
"karma-webpack": "4.0.2", | ||
"lerna-changelog": "^1.0.1", | ||
"linkinator": "2.13.5", | ||
"lerna-changelog": "1.0.1", | ||
"linkinator": "2.13.6", | ||
"mocha": "7.2.0", | ||
"nyc": "15.1.0", | ||
"sinon": "9.2.4", | ||
"ts-loader": "8.0.17", | ||
"sinon": "11.1.1", | ||
"ts-loader": "8.2.0", | ||
"ts-mocha": "8.0.0", | ||
"typedoc": "0.20.25", | ||
"typescript": "4.1.5", | ||
"typedoc": "0.21.0-beta.1", | ||
"typescript": "4.3.2", | ||
"webpack": "4.46.0" | ||
} | ||
} |
@@ -0,1 +1,32 @@ | ||
--- | ||
<p align="center"> | ||
<strong> | ||
<a href="https://open-telemetry.github.io/opentelemetry-js">API Documentation<a/> | ||
• | ||
<a href="https://github.com/open-telemetry/opentelemetry-js/discussions">Getting In Touch (GitHub Discussions)<a/> | ||
</strong> | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/open-telemetry/opentelemetry-js-api/releases"> | ||
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-js-api?include_prereleases&style=for-the-badge"> | ||
</a> | ||
<a href="https://codecov.io/gh/open-telemetry/opentelemetry-js-api/branch/main/"> | ||
<img alt="Codecov Status" src="https://img.shields.io/codecov/c/github/open-telemetry/opentelemetry-js-api?style=for-the-badge"> | ||
</a> | ||
<a href="https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE"> | ||
<img alt="license" src="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=for-the-badge"> | ||
</a> | ||
<br/> | ||
<a href="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/docs.yaml"> | ||
<img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/test.yaml/badge.svg?branch=main"> | ||
</a> | ||
<a href="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/test.yaml?query=branch%3Amain"> | ||
<img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/docs.yaml/badge.svg"> | ||
</a> | ||
</p> | ||
--- | ||
# OpenTelemetry API for JavaScript | ||
@@ -6,3 +37,2 @@ | ||
[![devDependencies][devDependencies-image]][devDependencies-url] | ||
[![Apache License][license-image]][license-image] | ||
@@ -54,3 +84,3 @@ This package provides everything needed to interact with the OpenTelemetry API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser. | ||
const span = tracer.startSpan("do operation"); | ||
// mock some work by sleeping 1 second | ||
@@ -78,2 +108,21 @@ await new Promise((resolve, reject) => { | ||
## Upgrade Guidelines | ||
### 0.21.0 to 1.0.0 | ||
No breaking changes | ||
### 0.20.0 to 0.21.0 | ||
- [#78](https://github.com/open-telemetry/opentelemetry-js-api/issues/78) `api.context.bind` arguments reversed and `context` is now a required argument. | ||
- [#46](https://github.com/open-telemetry/opentelemetry-js-api/issues/46) Noop classes and singletons are no longer exported. To create a noop span it is recommended to use `api.trace.wrapSpanContext` with `INVALID_SPAN_CONTEXT` instead of using the `NOOP_TRACER`. | ||
### 1.0.0-rc.3 to 0.20.0 | ||
- Removing `TimedEvent` which was not part of spec | ||
- `HttpBaggage` renamed to `HttpBaggagePropagator` | ||
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext` | ||
- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace | ||
- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace | ||
## Useful links | ||
@@ -94,10 +143,9 @@ | ||
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat | ||
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js-api/status.svg | ||
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-api.svg | ||
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-api | ||
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js-api/dev-status.svg | ||
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-api.svg?type=dev | ||
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-api?type=dev | ||
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api | ||
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg | ||
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/tracing.md | ||
[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/sdk-registration.md |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
364607
310
6711
1
148
0