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

opentracing

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentracing - npm Package Compare versions

Comparing version 0.9.18 to 0.10.1

.eslintrc

592

dist/opentracing-browser.js

@@ -91,10 +91,14 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _constants = __webpack_require__(5);
var _constants = __webpack_require__(6);
var Constants = _interopRequireWildcard(_constants);
var _binary_carrier = __webpack_require__(6);
var _binary_carrier = __webpack_require__(7);
var _binary_carrier2 = _interopRequireDefault(_binary_carrier);
var _reference = __webpack_require__(8);
var _reference2 = _interopRequireDefault(_reference);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

@@ -111,3 +115,4 @@

/**
* The Singleton object extends the standard Tracer object so that the default
* The Singleton object is the default export of the package and extends the
* standard Tracer object so that the default
* exported object of the package can be conveniently be used both as the

@@ -133,3 +138,3 @@ * default tracer and an interface to the library.

*
* @param {TracerImp} The Tracer implementation object
* @param {TracerImp} tracerImp - the Tracer implementation object
*/

@@ -162,2 +167,30 @@ value: function initGlobalTracer(tracerImp) {

/**
* Return a new REFERENCE_CHILD_OF reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_CHILD_OF reference pointing to `spanContext`
*/
}, {
key: 'childOf',
value: function childOf(spanContext) {
return new _reference2.default(Constants.REFERENCE_CHILD_OF, spanContext);
}
/**
* Return a new REFERENCE_FOLLOWS_FROM reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_FOLLOWS_FROM reference pointing to `spanContext`
*/
}, {
key: 'followsFrom',
value: function followsFrom(spanContext) {
return new _reference2.default(Constants.REFERENCE_FOLLOWS_FROM, spanContext);
}
// ---------------------------------------------------------------------- //

@@ -167,3 +200,4 @@ // Private and non-standard methods

/**
/* For internal use only:
*
* Creates the Singleton with no underlying implementation (i.e. defaults

@@ -190,4 +224,6 @@ * to no-op behavior for all functions).

for (var key in Constants) {
// eslint-disable-line no-restricted-syntax
_this[key] = Constants[key];
}
_this.Reference = _reference2.default;

@@ -201,3 +237,3 @@ // Carrier objects to be exposed at the package level

}(_tracer2.default);
exports.default = Singleton;

@@ -222,4 +258,8 @@ module.exports = exports['default'];

var _constants = __webpack_require__(5);
var _span_context = __webpack_require__(5);
var _span_context2 = _interopRequireDefault(_span_context);
var _constants = __webpack_require__(6);
var _constants2 = _interopRequireDefault(_constants);

@@ -250,24 +290,35 @@

*
* @param {string|object} nameOrFields
* If the given argument is a `string`, it is the name of the
* the operation from the perpsective of the current service.
* For example:
*
* If the given argument is a object, it is treated as a set of
* fields to set on the newly created span.
* // Start a new (parentless) root Span:
* var parent = Tracer.startSpan('DoWork');
*
* - `operationName` {string} Required. This is the name to use for
* the newly created span.
* - `parent` {Span} Optional. The newly created Span will be created
* as a child of `parent`.
* - `tags` {object} Optional set of key-value pairs which will be set as
* tags on the newly created Span. Ownership of the object is
* passed to the created span and the caller for efficiency
* reasons.
* - `startTime` {Number} Optional manually specified start time for the
* created Span object. The time should be specified in
* milliseconds as Unix timestamp. Decimal value are supported
* to represent time values with sub-millisecond accuracy.
* // Start a new (child) Span:
* var child = Tracer.startSpan('Subroutine', {
* reference: Tracer.childOf(parent.context()),
* });
*
* @return {Span}
* A new Span object.
* @param {string|object} nameOrFields - if the given argument is a
* string, it is the name of the operation and the second `fields`
* argument is optional. If it is an object, it is treated as the
* fields argument and a second argument should not be provided.
* @param {object} [fields] - the fields to set on the newly created span.
* @param {string} [fields.operationName] - the name to use for the newly
* created span. Required if called with a single argument.
* @param {SpanContext} [fields.childOf] - a parent SpanContext (or Span,
* for convenience) that the newly-started span will be the child of
* (per REFERENCE_CHILD_OF). If specified, `fields.references` must
* be unspecified.
* @param {array} [fields.references] - an array of Reference instances,
* each pointing to a causal parent SpanContext. If specified,
* `fields.childOf` must be unspecified.
* @param {object} [fields.tags] - set of key-value pairs which will be set
* as tags on the newly created Span. Ownership of the object is
* passed to the created span for efficiency reasons (the caller
* should not modify this object after calling startSpan).
* @param {number} [fields.startTime] - a manually specified start time for
* the created Span object. The time should be specified in
* milliseconds as Unix timestamp. Decimal value are supported
* to represent time values with sub-millisecond accuracy.
* @return {Span} - a new Span object.
*/

@@ -313,2 +364,22 @@ value: function startSpan(nameOrFields, fields) {

}
if (true) {
if (fields.childOf && fields.references) {
throw new Error('At most one of `childOf` and ' + '`references` may be specified');
}
if (fields.childOf && !(fields.childOf instanceof _span2.default || fields.childOf instanceof _span_context2.default)) {
throw new Error('childOf must be a Span or SpanContext instance');
}
}
// Convert fields.childOf to fields.references as needed.
if (fields.childOf) {
// Coerce from a Span to a SpanContext.
var childOf = fields.childOf instanceof _span2.default ? fields.childOf.context() : fields.childOf;
if (fields.references) {
fields.references.push(childOf);
} else {
fields.references = [childOf];
}
delete fields.childOf;
}
spanImp = this._imp.startSpan(fields);

@@ -320,6 +391,8 @@ }

/**
* Injects the information about the given span into the carrier
* so that the span can propogate across inter-process barriers.
* Injects the given SpanContext instance for cross-process propagation
* within `carrier`. The expected type of `carrier` depends on the value of
* `format.
*
* See FORMAT_TEXT_MAP and FORMAT_BINARY for the two required carriers.
* OpenTracing defines a common set of `format` values (see FORMAT_TEXT_MAP
* and FORMAT_BINARY), and each has an expected carrier type.
*

@@ -332,3 +405,3 @@ * Consider this pseudocode example:

* var textCarrier = {};
* Tracer.inject(clientSpan, Tracer.FORMAT_TEXT_MAP, textCarrier);
* Tracer.inject(clientSpan.context(), Tracer.FORMAT_TEXT_MAP, textCarrier);
* // Incorporate the textCarrier into the outbound HTTP request header

@@ -344,8 +417,9 @@ * // map.

*
* @param {Span} span
* The span whose information should be injected into the carrier.
* @param {string} format
* The format of the carrier.
* @param {any} carrier
* See the method description for details on the carrier object.
* @param {SpanContext} spanContext - the SpanContext to inject into the
* carrier object. As a convenience, a Span instance may be passed
* in instead (in which case its .context() is used for the
* inject()).
* @param {string} format - the format of the carrier.
* @param {any} carrier - see the documentation for the chosen `format`
* for a description of the carrier object.
*/

@@ -355,3 +429,3 @@

key: 'inject',
value: function inject(span, format, carrier) {
value: function inject(spanContext, format, carrier) {
if (true) {

@@ -361,4 +435,4 @@ if (arguments.length !== 3) {

}
if (!(span instanceof _span2.default)) {
throw new Error('Expected span object as first argument');
if (!(spanContext instanceof _span_context2.default || spanContext instanceof _span2.default)) {
throw new Error('first argument must be a SpanContext or Span instance');
}

@@ -377,3 +451,7 @@ if (typeof format !== 'string') {

if (this._imp) {
this._imp.inject(span._imp, format, carrier);
// Allow the user to pass a Span instead of a SpanContext
if (spanContext instanceof _span2.default) {
spanContext = spanContext.context();
}
this._imp.inject(spanContext._imp, format, carrier);
}

@@ -383,6 +461,7 @@ }

/**
* Returns a new Span object with the given operation name using the trace
* information from the carrier.
* Returns a SpanContext instance extracted from `carrier` in the given
* `format`.
*
* See FORMAT_TEXT_MAP and FORMAT_BINARY for the two required carriers.
* OpenTracing defines a common set of `format` values (see FORMAT_TEXT_MAP
* and FORMAT_BINARY), and each has an expected carrier type.
*

@@ -393,4 +472,4 @@ * Consider this pseudocode example:

* var textCarrier = inboundHTTPReq.headers;
* var serverSpan = Tracer.join(
* "operation name", Tracer.FORMAT_TEXT_MAP, textCarrier);
* var wireCtx = Tracer.extract(Tracer.FORMAT_TEXT_MAP, textCarrier);
* var serverSpan = Tracer.startSpan('...', Tracer.childOf(wireCtx));
*

@@ -400,21 +479,17 @@ * For FORMAT_BINARY, `carrier` is expected to have a field named `buffer`

*
* @param {string} operationName
* Operation name to use on the newly created span.
* @param {string} format
* The format of the carrier.
* @param {any} carrier
* The type of the carrier object is determined by the format.
* @return {Span}
* @param {string} format - the format of the carrier.
* @param {any} carrier - the type of the carrier object is determined by
* the format.
* @return {SpanContext}
* The extracted SpanContext, or null if no such SpanContext could
* be found in `carrier`
*/
}, {
key: 'join',
value: function join(operationName, format, carrier) {
key: 'extract',
value: function extract(format, carrier) {
if (true) {
if (arguments.length !== 3) {
if (arguments.length !== 2) {
throw new Error('Invalid number of arguments.');
}
if (typeof operationName !== 'string' || !operationName.length) {
throw new Error('operationName is expected to be a string of non-zero length');
}
if (typeof format !== 'string' || !format.length) {

@@ -432,7 +507,10 @@ throw new Error('format is expected to be a string of non-zero length');

}
var spanImp = null;
var spanContextImp = null;
if (this._imp) {
spanImp = this._imp.join(operationName, format, carrier);
spanContextImp = this._imp.extract(format, carrier);
}
return new _span2.default(spanImp);
if (spanContextImp !== null) {
return new _span_context2.default(spanContextImp);
}
return null;
}

@@ -443,6 +521,6 @@

*
* @param {function} done
* Optional callback function with the signature `function(err)` that
* will be called as soon as the flush completes. `err` should be
* null or undefined if the flush was successful.
* @param {function(err: objectg)} done - optional callback function with
* the signature `function(err)` that will be called as soon as the
* flush completes. `err` should be null or undefined if the flush
* was successful.
*/

@@ -506,3 +584,3 @@

}();
exports.default = Tracer;

@@ -527,2 +605,6 @@ module.exports = exports['default'];

var _span_context = __webpack_require__(5);
var _span_context2 = _interopRequireDefault(_span_context);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -536,4 +618,2 @@

var kKeyRegExp = new RegExp(/^[a-z0-9][-a-z0-9]*/);
/**

@@ -548,3 +628,3 @@ * Span represents a logical unit of work as part of a broader Trace. Examples

_createClass(Span, [{
key: 'tracer',
key: 'context',

@@ -557,2 +637,20 @@

/**
* Returns the SpanContext object associated with this Span.
*
* @return {SpanContext}
*/
value: function context() {
if (true) {
if (arguments.length !== 0) {
throw new Error('Invalid number of arguments');
}
}
var spanContextImp = null;
if (this._imp) {
spanContextImp = this._imp.context();
}
return new _span_context2.default(spanContextImp);
}
/**
* Returns the Tracer object used to create this Span.

@@ -562,2 +660,5 @@ *

*/
}, {
key: 'tracer',
value: function tracer() {

@@ -657,93 +758,13 @@ if (true) {

/**
* Set an arbitrary key-value string pair that will be carried along the
* full path of a trace.
*
* All spans created as children of this span will inherit the baggage items
* of this span.
*
* Baggage items are copied between all spans, both in-process and across
* distributed requests, therefore this feature should be used with care to
* ensure undue overhead is not incurred.
*
* Keys are case insensitive and must match the regular expresssion
* `[a-z0-9][-a-z0-9]*`.
*
* @param {string} key
* @param {string} value
*/
}, {
key: 'setBaggageItem',
value: function setBaggageItem(key, value) {
if (true) {
if (arguments.length !== 2) {
throw new Error('Expected 2 arguments');
}
if (typeof key !== 'string' || key.length === 0) {
throw new Error('Key must be a string');
}
if (!kKeyRegExp.test(key)) {
throw new Error('Invalid trace key');
}
var valueType = typeof value;
if (value !== null && valueType !== 'boolean' && valueType !== 'number' && valueType !== 'string') {
throw new Error('Trace attribute values can only be basic types');
}
}
if (this._imp) {
this._imp.setBaggageItem(key, value);
}
return this;
}
/**
* Returns the value for the given baggage item key.
*
* @param {string} key
* The key for the given trace attribute.
* @return {string}
* String value for the given key, or undefined if the key does not
* correspond to a set trace attribute.
*/
}, {
key: 'getBaggageItem',
value: function getBaggageItem(key) {
if (true) {
if (arguments.length !== 1) {
throw new Error('Expected 1 arguments');
}
if (typeof key !== 'string' || key.length === 0) {
throw new Error('Key must be a string');
}
if (!kKeyRegExp.test(key)) {
throw new Error('Invalid trace key');
}
}
if (!this._imp) {
return undefined;
}
return this._imp.getBaggageItem(key);
}
/**
* Explicitly create a log record associated with the span.
*
* @param {[type]} fields [description]
* @param {object} fields
* Optional associative array of fields.
* - `timestamp` {Number} Optional field specifying the timestamp
* in milliseconds as a Unix timestamp. Fractional values are
* allowed so that timestamps with sub-millisecond accuracy
* can be represented. If not specified, the implementation
* is expected to use it's notion of the current time of the
* call.
* - `event` {string}
* The event name.
* - `payload` {object}
* An arbitrary structured payload. It is implementation-dependent
* how this will be processed.
* @param {object} fields - object containing the log record properties
* @param {number} [fields.timestamp] - optional field specifying the
* timestamp in milliseconds as a Unix timestamp. Fractional values
* are allowed so that timestamps with sub-millisecond accuracy
* can be represented. If not specified, the implementation is
* expected to use it's notion of the current time of the call.
* @param {string} [fields.event] - the event name
* @param {object} [fields.payload] - an arbitrary structured payload. It is
* implementation-dependent how this will be processed.
*/

@@ -772,5 +793,5 @@

*
* @param {string} eventName [description]
* @param {} payload [description]
* @return {[type]} [description]
* @param {string} eventName - string associated with the log record
* @param {object} [payload] - arbitrary payload object associated with the
* log record.
*/

@@ -782,4 +803,4 @@

return this.log({
'event': eventName,
'payload': payload
event: eventName,
payload: payload
});

@@ -789,11 +810,8 @@ }

/**
* Indicates that the unit of work represented by the span is complete or
* has otherwise been terminated.
* Sets the end timestamp and finalizes Span state.
*
* All Span objects must have finish() called on them before they are
* reported to the backend implementation.
* With the exception of calls to Span.context() (which are always allowed),
* finish() must be the last call made to any span instance, and to do
* otherwise leads to undefined behavior.
*
* Once `finish()` is called on a Span object, the behavior of all methods
* on the object is considered undefined.
*
* @param {Number} finishTime

@@ -829,3 +847,4 @@ * Optional finish time in milliseconds as a Unix timestamp. Decimal

/**
* Constructs a new Span object. This method should not be called directly.
* Constructs a new Span object, this method should not be called directly;
* Tracer.startSpan() or Tracer.join() should be used instead.
*/

@@ -856,3 +875,3 @@

}();
exports.default = Span;

@@ -863,2 +882,121 @@ module.exports = exports['default'];

/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
/**
* SpanContext represents Span state that must propagate to descendant Spans
* and across process boundaries.
*
* SpanContext is logically divided into two pieces: the user-level "Baggage"
* (see setBaggageItem and getBaggageItem) that propagates across Span
* boundaries and any Tracer-implementation-specific fields that are needed to
* identify or otherwise contextualize the associated Span instance (e.g., a
* <trace_id, span_id, sampled> tuple).
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SpanContext = function () {
_createClass(SpanContext, [{
key: 'setBaggageItem',
/**
* Sets a key:value pair on this SpanContext that also propagates to future
* children of the associated Span.
*
* setBaggageItem() enables powerful functionality given a full-stack
* opentracing integration (e.g., arbitrary application data from a web
* client can make it, transparently, all the way into the depths of a
* storage system), and with it some powerful costs: use this feature with
* care.
*
* IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to
* *future* causal descendants of the associated Span.
*
* IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and
* value is copied into every local *and remote* child of the associated
* Span, and that can add up to a lot of network and cpu overhead.
*
* @param {string} key
* @param {string} value
*/
value: function setBaggageItem(key, value) {
if (true) {
if (arguments.length !== 2) {
throw new Error('Invalid number of arguments');
}
}
if (this._imp) {
this._imp.setBaggageItem(key, value);
}
}
/**
* Returns the value for a baggage item given its key.
*
* @param {string} key
* The key for the given trace attribute.
* @return {string}
* String value for the given key, or undefined if the key does not
* correspond to a set trace attribute.
*/
}, {
key: 'getBaggageItem',
value: function getBaggageItem(key) {
if (true) {
if (arguments.length !== 1) {
throw new Error('Invalid number of arguments');
}
}
if (this._imp) {
return this._imp.getBaggageItem(key);
}
return undefined;
}
/**
* Constructs a new SpanContext object.
*
* This method should not be called directly; Span.context() should be used
* instead.
*/
}]);
function SpanContext(imp) {
_classCallCheck(this, SpanContext);
this._imp = imp;
}
/**
* Returns the SpanContext implementation object. The returned object is by
* its nature entirely implementation-dependent.
*/
_createClass(SpanContext, [{
key: 'imp',
value: function imp() {
return this._imp;
}
}]);
return SpanContext;
}();
exports.default = SpanContext;
module.exports = exports['default'];
/***/ },
/* 6 */
/***/ function(module, exports) {

@@ -880,6 +1018,2 @@

*
* NOTE: Since HTTP headers are a particularly important use case for the
* TEXT_MAP carrier, map keys identify their respective values in a
* case-insensitive manner.
*
* NOTE: The TEXT_MAP carrier map may contain unrelated data (e.g.,

@@ -890,7 +1024,24 @@ * arbitrary HTTP headers). As such, the Tracer implementation should use a

*/
FORMAT_TEXT_MAP: 'text_map'
FORMAT_TEXT_MAP: 'text_map',
/**
* A Span may be the "child of" a parent Span. In a “child of” reference,
* the parent Span depends on the child Span in some capacity.
*
* See more about reference types at http://opentracing.io/spec/
*/
REFERENCE_CHILD_OF: 'child_of',
/**
* Some parent Spans do not depend in any way on the result of their child
* Spans. In these cases, we say merely that the child Span “follows from”
* the parent Span in a causal sense.
*
* See more about reference types at http://opentracing.io/spec/
*/
REFERENCE_FOLLOWS_FROM: 'follows_from'
};
/***/ },
/* 6 */
/* 7 */
/***/ function(module, exports) {

@@ -922,2 +1073,87 @@

/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _span = __webpack_require__(4);
var _span2 = _interopRequireDefault(_span);
var _span_context = __webpack_require__(5);
var _span_context2 = _interopRequireDefault(_span_context);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Reference pairs a reference type constant (e.g., REFERENCE_CHILD_OF or
* REFERENCE_FOLLOWS_FROM) with the SpanContext it points to.
*
* See the exported childOf() and followsFrom() functions at the package level.
*/
var Reference = function () {
_createClass(Reference, [{
key: 'type',
/**
* @return {string} The Reference type (e.g., REFERENCE_CHILD_OF or
* REFERENCE_FOLLOWS_FROM).
*/
value: function type() {
return this._type;
}
/**
* @return {SpanContext} The SpanContext being referred to (e.g., the
* parent in a REFERENCE_CHILD_OF Reference).
*/
}, {
key: 'spanContext',
value: function spanContext() {
return this._spanContext;
}
/**
* Initialize a new Reference instance.
*
* @param {string} type - the Reference type constant (e.g.,
* REFERENCE_CHILD_OF or REFERENCE_FOLLOWS_FROM).
* @param {SpanContext} spanContext - the SpanContext being referred to. As
* a convenience, a Span instance may be passed in instead (in which
* case its .context() is used here).
*/
}]);
function Reference(type, spanContext) {
_classCallCheck(this, Reference);
if (true) {
if (!(spanContext instanceof _span_context2.default || spanContext instanceof _span2.default)) {
throw new Error('spanContext must be a Span or SpanContext instance');
}
}
this._type = type;
this._spanContext = spanContext instanceof _span2.default ? spanContext.context() : spanContext;
}
return Reference;
}();
exports.default = Reference;
module.exports = exports['default'];
/***/ }

@@ -924,0 +1160,0 @@ /******/ ])

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Tracer=t():e.Tracer=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(2),u=r(i);e.exports=new u["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(3),l=i(s),c=n(5),p=r(c),h=n(6),d=i(h),y=function(e){function t(){u(this,t);var e=o(this,Object.getPrototypeOf(t).call(this));for(var n in p)e[n]=p[n];return e.BinaryCarrier=d["default"],e}return a(t,e),f(t,[{key:"initGlobalTracer",value:function(e){this._imp=e,e&&e.setInterface(this)}},{key:"initNewTracer",value:function(e){var t=new l["default"](e);return e&&e.setInterface(this),t}}]),t}(l["default"]);t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(4),a=r(o),f=n(5),s=(r(f),function(){function e(t){i(this,e),this._imp=t||null}return u(e,[{key:"startSpan",value:function(e,t){var n=null;return this._imp&&(1===arguments.length?t="string"==typeof e?{operationName:e}:e:t.operationName=e,n=this._imp.startSpan(t)),new a["default"](n)}},{key:"inject",value:function(e,t,n){this._imp&&this._imp.inject(e._imp,t,n)}},{key:"join",value:function(e,t,n){var r=null;return this._imp&&(r=this._imp.join(e,t,n)),new a["default"](r)}},{key:"flush",value:function(e){return this._imp?void this._imp.flush(e):void e(null)}}]),u(e,[{key:"imp",value:function(){return this._imp}}]),e}());t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(3),f=r(a),s=n(1),l=(new RegExp(/^[a-z0-9][-a-z0-9]*/),function(){function e(t){u(this,e),this._imp=t}return o(e,[{key:"tracer",value:function(){return this._imp?new f["default"](this._imp.tracer()):s}},{key:"setOperationName",value:function(e){return this._imp&&this._imp.setOperationName(e),this}},{key:"setTag",value:function(e,t){return this.addTags(i({},e,t)),this}},{key:"addTags",value:function(e){return this._imp?(this._imp.addTags(e),this):void 0}},{key:"setBaggageItem",value:function(e,t){return this._imp&&this._imp.setBaggageItem(e,t),this}},{key:"getBaggageItem",value:function(e){return this._imp?this._imp.getBaggageItem(e):void 0}},{key:"log",value:function(e){return this._imp?(this._imp.log(e),this):void 0}},{key:"logEvent",value:function(e,t){return this.log({event:e,payload:t})}},{key:"finish",value:function(e){this._imp&&this._imp.finish(e)}}]),o(e,[{key:"imp",value:function(){return this._imp}}]),e}());t["default"]=l,e.exports=t["default"]},function(e,t){"use strict";e.exports={FORMAT_BINARY:"binary",FORMAT_TEXT_MAP:"text_map"}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function i(e){n(this,i),this.buffer=e};t["default"]=r,e.exports=t["default"]}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Tracer=t():e.Tracer=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(2),u=r(i);e.exports=new u["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(3),c=i(l),s=n(6),p=r(s),d=n(7),h=i(d),_=n(8),y=i(_),v=function(e){function t(){u(this,t);var e=o(this,Object.getPrototypeOf(t).call(this));for(var n in p)e[n]=p[n];return e.Reference=y["default"],e.BinaryCarrier=h["default"],e}return a(t,e),f(t,[{key:"initGlobalTracer",value:function(e){this._imp=e,e&&e.setInterface(this)}},{key:"initNewTracer",value:function(e){var t=new c["default"](e);return e&&e.setInterface(this),t}},{key:"childOf",value:function(e){return new y["default"](p.REFERENCE_CHILD_OF,e)}},{key:"followsFrom",value:function(e){return new y["default"](p.REFERENCE_FOLLOWS_FROM,e)}}]),t}(c["default"]);t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(4),a=r(o),f=n(5),l=r(f),c=n(6),s=(r(c),function(){function e(t){i(this,e),this._imp=t||null}return u(e,[{key:"startSpan",value:function(e,t){var n=null;if(this._imp){if(1===arguments.length?t="string"==typeof e?{operationName:e}:e:t.operationName=e,t.childOf){var r=t.childOf instanceof a["default"]?t.childOf.context():t.childOf;t.references?t.references.push(r):t.references=[r],delete t.childOf}n=this._imp.startSpan(t)}return new a["default"](n)}},{key:"inject",value:function(e,t,n){this._imp&&(e instanceof a["default"]&&(e=e.context()),this._imp.inject(e._imp,t,n))}},{key:"extract",value:function(e,t){var n=null;return this._imp&&(n=this._imp.extract(e,t)),null!==n?new l["default"](n):null}},{key:"flush",value:function(e){return this._imp?void this._imp.flush(e):void e(null)}}]),u(e,[{key:"imp",value:function(){return this._imp}}]),e}());t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(3),f=r(a),l=n(5),c=r(l),s=n(1),p=function(){function e(t){u(this,e),this._imp=t}return o(e,[{key:"context",value:function(){var e=null;return this._imp&&(e=this._imp.context()),new c["default"](e)}},{key:"tracer",value:function(){return this._imp?new f["default"](this._imp.tracer()):s}},{key:"setOperationName",value:function(e){return this._imp&&this._imp.setOperationName(e),this}},{key:"setTag",value:function(e,t){return this.addTags(i({},e,t)),this}},{key:"addTags",value:function(e){if(this._imp)return this._imp.addTags(e),this}},{key:"log",value:function(e){if(this._imp)return this._imp.log(e),this}},{key:"logEvent",value:function(e,t){return this.log({event:e,payload:t})}},{key:"finish",value:function(e){this._imp&&this._imp.finish(e)}}]),o(e,[{key:"imp",value:function(){return this._imp}}]),e}();t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t){r(this,e),this._imp=t}return i(e,[{key:"setBaggageItem",value:function(e,t){this._imp&&this._imp.setBaggageItem(e,t)}},{key:"getBaggageItem",value:function(e){if(this._imp)return this._imp.getBaggageItem(e)}}]),i(e,[{key:"imp",value:function(){return this._imp}}]),e}();t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";e.exports={FORMAT_BINARY:"binary",FORMAT_TEXT_MAP:"text_map",REFERENCE_CHILD_OF:"child_of",REFERENCE_FOLLOWS_FROM:"follows_from"}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function i(e){n(this,i),this.buffer=e};t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(4),a=r(o),f=n(5),l=(r(f),function(){function e(t,n){i(this,e),this._type=t,this._spanContext=n instanceof a["default"]?n.context():n}return u(e,[{key:"type",value:function(){return this._type}},{key:"spanContext",value:function(){return this._spanContext}}]),e}());t["default"]=l,e.exports=t["default"]}])});

@@ -83,10 +83,14 @@ require("source-map-support").install();

var _constants = __webpack_require__(5);
var _constants = __webpack_require__(6);
var Constants = _interopRequireWildcard(_constants);
var _binary_carrier = __webpack_require__(6);
var _binary_carrier = __webpack_require__(7);
var _binary_carrier2 = _interopRequireDefault(_binary_carrier);
var _reference = __webpack_require__(8);
var _reference2 = _interopRequireDefault(_reference);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

@@ -103,3 +107,4 @@

/**
* The Singleton object extends the standard Tracer object so that the default
* The Singleton object is the default export of the package and extends the
* standard Tracer object so that the default
* exported object of the package can be conveniently be used both as the

@@ -125,3 +130,3 @@ * default tracer and an interface to the library.

*
* @param {TracerImp} The Tracer implementation object
* @param {TracerImp} tracerImp - the Tracer implementation object
*/

@@ -154,2 +159,30 @@ value: function initGlobalTracer(tracerImp) {

/**
* Return a new REFERENCE_CHILD_OF reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_CHILD_OF reference pointing to `spanContext`
*/
}, {
key: 'childOf',
value: function childOf(spanContext) {
return new _reference2.default(Constants.REFERENCE_CHILD_OF, spanContext);
}
/**
* Return a new REFERENCE_FOLLOWS_FROM reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_FOLLOWS_FROM reference pointing to `spanContext`
*/
}, {
key: 'followsFrom',
value: function followsFrom(spanContext) {
return new _reference2.default(Constants.REFERENCE_FOLLOWS_FROM, spanContext);
}
// ---------------------------------------------------------------------- //

@@ -159,3 +192,4 @@ // Private and non-standard methods

/**
/* For internal use only:
*
* Creates the Singleton with no underlying implementation (i.e. defaults

@@ -182,4 +216,6 @@ * to no-op behavior for all functions).

for (var key in Constants) {
// eslint-disable-line no-restricted-syntax
_this[key] = Constants[key];
}
_this.Reference = _reference2.default;

@@ -193,3 +229,3 @@ // Carrier objects to be exposed at the package level

}(_tracer2.default);
exports.default = Singleton;

@@ -214,4 +250,8 @@ module.exports = exports['default'];

var _constants = __webpack_require__(5);
var _span_context = __webpack_require__(5);
var _span_context2 = _interopRequireDefault(_span_context);
var _constants = __webpack_require__(6);
var _constants2 = _interopRequireDefault(_constants);

@@ -242,24 +282,35 @@

*
* @param {string|object} nameOrFields
* If the given argument is a `string`, it is the name of the
* the operation from the perpsective of the current service.
* For example:
*
* If the given argument is a object, it is treated as a set of
* fields to set on the newly created span.
* // Start a new (parentless) root Span:
* var parent = Tracer.startSpan('DoWork');
*
* - `operationName` {string} Required. This is the name to use for
* the newly created span.
* - `parent` {Span} Optional. The newly created Span will be created
* as a child of `parent`.
* - `tags` {object} Optional set of key-value pairs which will be set as
* tags on the newly created Span. Ownership of the object is
* passed to the created span and the caller for efficiency
* reasons.
* - `startTime` {Number} Optional manually specified start time for the
* created Span object. The time should be specified in
* milliseconds as Unix timestamp. Decimal value are supported
* to represent time values with sub-millisecond accuracy.
* // Start a new (child) Span:
* var child = Tracer.startSpan('Subroutine', {
* reference: Tracer.childOf(parent.context()),
* });
*
* @return {Span}
* A new Span object.
* @param {string|object} nameOrFields - if the given argument is a
* string, it is the name of the operation and the second `fields`
* argument is optional. If it is an object, it is treated as the
* fields argument and a second argument should not be provided.
* @param {object} [fields] - the fields to set on the newly created span.
* @param {string} [fields.operationName] - the name to use for the newly
* created span. Required if called with a single argument.
* @param {SpanContext} [fields.childOf] - a parent SpanContext (or Span,
* for convenience) that the newly-started span will be the child of
* (per REFERENCE_CHILD_OF). If specified, `fields.references` must
* be unspecified.
* @param {array} [fields.references] - an array of Reference instances,
* each pointing to a causal parent SpanContext. If specified,
* `fields.childOf` must be unspecified.
* @param {object} [fields.tags] - set of key-value pairs which will be set
* as tags on the newly created Span. Ownership of the object is
* passed to the created span for efficiency reasons (the caller
* should not modify this object after calling startSpan).
* @param {number} [fields.startTime] - a manually specified start time for
* the created Span object. The time should be specified in
* milliseconds as Unix timestamp. Decimal value are supported
* to represent time values with sub-millisecond accuracy.
* @return {Span} - a new Span object.
*/

@@ -305,2 +356,22 @@ value: function startSpan(nameOrFields, fields) {

}
if (true) {
if (fields.childOf && fields.references) {
throw new Error('At most one of `childOf` and ' + '`references` may be specified');
}
if (fields.childOf && !(fields.childOf instanceof _span2.default || fields.childOf instanceof _span_context2.default)) {
throw new Error('childOf must be a Span or SpanContext instance');
}
}
// Convert fields.childOf to fields.references as needed.
if (fields.childOf) {
// Coerce from a Span to a SpanContext.
var childOf = fields.childOf instanceof _span2.default ? fields.childOf.context() : fields.childOf;
if (fields.references) {
fields.references.push(childOf);
} else {
fields.references = [childOf];
}
delete fields.childOf;
}
spanImp = this._imp.startSpan(fields);

@@ -312,6 +383,8 @@ }

/**
* Injects the information about the given span into the carrier
* so that the span can propogate across inter-process barriers.
* Injects the given SpanContext instance for cross-process propagation
* within `carrier`. The expected type of `carrier` depends on the value of
* `format.
*
* See FORMAT_TEXT_MAP and FORMAT_BINARY for the two required carriers.
* OpenTracing defines a common set of `format` values (see FORMAT_TEXT_MAP
* and FORMAT_BINARY), and each has an expected carrier type.
*

@@ -324,3 +397,3 @@ * Consider this pseudocode example:

* var textCarrier = {};
* Tracer.inject(clientSpan, Tracer.FORMAT_TEXT_MAP, textCarrier);
* Tracer.inject(clientSpan.context(), Tracer.FORMAT_TEXT_MAP, textCarrier);
* // Incorporate the textCarrier into the outbound HTTP request header

@@ -336,8 +409,9 @@ * // map.

*
* @param {Span} span
* The span whose information should be injected into the carrier.
* @param {string} format
* The format of the carrier.
* @param {any} carrier
* See the method description for details on the carrier object.
* @param {SpanContext} spanContext - the SpanContext to inject into the
* carrier object. As a convenience, a Span instance may be passed
* in instead (in which case its .context() is used for the
* inject()).
* @param {string} format - the format of the carrier.
* @param {any} carrier - see the documentation for the chosen `format`
* for a description of the carrier object.
*/

@@ -347,3 +421,3 @@

key: 'inject',
value: function inject(span, format, carrier) {
value: function inject(spanContext, format, carrier) {
if (true) {

@@ -353,4 +427,4 @@ if (arguments.length !== 3) {

}
if (!(span instanceof _span2.default)) {
throw new Error('Expected span object as first argument');
if (!(spanContext instanceof _span_context2.default || spanContext instanceof _span2.default)) {
throw new Error('first argument must be a SpanContext or Span instance');
}

@@ -369,3 +443,7 @@ if (typeof format !== 'string') {

if (this._imp) {
this._imp.inject(span._imp, format, carrier);
// Allow the user to pass a Span instead of a SpanContext
if (spanContext instanceof _span2.default) {
spanContext = spanContext.context();
}
this._imp.inject(spanContext._imp, format, carrier);
}

@@ -375,6 +453,7 @@ }

/**
* Returns a new Span object with the given operation name using the trace
* information from the carrier.
* Returns a SpanContext instance extracted from `carrier` in the given
* `format`.
*
* See FORMAT_TEXT_MAP and FORMAT_BINARY for the two required carriers.
* OpenTracing defines a common set of `format` values (see FORMAT_TEXT_MAP
* and FORMAT_BINARY), and each has an expected carrier type.
*

@@ -385,4 +464,4 @@ * Consider this pseudocode example:

* var textCarrier = inboundHTTPReq.headers;
* var serverSpan = Tracer.join(
* "operation name", Tracer.FORMAT_TEXT_MAP, textCarrier);
* var wireCtx = Tracer.extract(Tracer.FORMAT_TEXT_MAP, textCarrier);
* var serverSpan = Tracer.startSpan('...', Tracer.childOf(wireCtx));
*

@@ -392,21 +471,17 @@ * For FORMAT_BINARY, `carrier` is expected to have a field named `buffer`

*
* @param {string} operationName
* Operation name to use on the newly created span.
* @param {string} format
* The format of the carrier.
* @param {any} carrier
* The type of the carrier object is determined by the format.
* @return {Span}
* @param {string} format - the format of the carrier.
* @param {any} carrier - the type of the carrier object is determined by
* the format.
* @return {SpanContext}
* The extracted SpanContext, or null if no such SpanContext could
* be found in `carrier`
*/
}, {
key: 'join',
value: function join(operationName, format, carrier) {
key: 'extract',
value: function extract(format, carrier) {
if (true) {
if (arguments.length !== 3) {
if (arguments.length !== 2) {
throw new Error('Invalid number of arguments.');
}
if (typeof operationName !== 'string' || !operationName.length) {
throw new Error('operationName is expected to be a string of non-zero length');
}
if (typeof format !== 'string' || !format.length) {

@@ -424,7 +499,10 @@ throw new Error('format is expected to be a string of non-zero length');

}
var spanImp = null;
var spanContextImp = null;
if (this._imp) {
spanImp = this._imp.join(operationName, format, carrier);
spanContextImp = this._imp.extract(format, carrier);
}
return new _span2.default(spanImp);
if (spanContextImp !== null) {
return new _span_context2.default(spanContextImp);
}
return null;
}

@@ -435,6 +513,6 @@

*
* @param {function} done
* Optional callback function with the signature `function(err)` that
* will be called as soon as the flush completes. `err` should be
* null or undefined if the flush was successful.
* @param {function(err: objectg)} done - optional callback function with
* the signature `function(err)` that will be called as soon as the
* flush completes. `err` should be null or undefined if the flush
* was successful.
*/

@@ -498,3 +576,3 @@

}();
exports.default = Tracer;

@@ -519,2 +597,6 @@ module.exports = exports['default'];

var _span_context = __webpack_require__(5);
var _span_context2 = _interopRequireDefault(_span_context);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -528,4 +610,2 @@

var kKeyRegExp = new RegExp(/^[a-z0-9][-a-z0-9]*/);
/**

@@ -540,3 +620,3 @@ * Span represents a logical unit of work as part of a broader Trace. Examples

_createClass(Span, [{
key: 'tracer',
key: 'context',

@@ -549,2 +629,20 @@

/**
* Returns the SpanContext object associated with this Span.
*
* @return {SpanContext}
*/
value: function context() {
if (true) {
if (arguments.length !== 0) {
throw new Error('Invalid number of arguments');
}
}
var spanContextImp = null;
if (this._imp) {
spanContextImp = this._imp.context();
}
return new _span_context2.default(spanContextImp);
}
/**
* Returns the Tracer object used to create this Span.

@@ -554,2 +652,5 @@ *

*/
}, {
key: 'tracer',
value: function tracer() {

@@ -649,93 +750,13 @@ if (true) {

/**
* Set an arbitrary key-value string pair that will be carried along the
* full path of a trace.
*
* All spans created as children of this span will inherit the baggage items
* of this span.
*
* Baggage items are copied between all spans, both in-process and across
* distributed requests, therefore this feature should be used with care to
* ensure undue overhead is not incurred.
*
* Keys are case insensitive and must match the regular expresssion
* `[a-z0-9][-a-z0-9]*`.
*
* @param {string} key
* @param {string} value
*/
}, {
key: 'setBaggageItem',
value: function setBaggageItem(key, value) {
if (true) {
if (arguments.length !== 2) {
throw new Error('Expected 2 arguments');
}
if (typeof key !== 'string' || key.length === 0) {
throw new Error('Key must be a string');
}
if (!kKeyRegExp.test(key)) {
throw new Error('Invalid trace key');
}
var valueType = typeof value;
if (value !== null && valueType !== 'boolean' && valueType !== 'number' && valueType !== 'string') {
throw new Error('Trace attribute values can only be basic types');
}
}
if (this._imp) {
this._imp.setBaggageItem(key, value);
}
return this;
}
/**
* Returns the value for the given baggage item key.
*
* @param {string} key
* The key for the given trace attribute.
* @return {string}
* String value for the given key, or undefined if the key does not
* correspond to a set trace attribute.
*/
}, {
key: 'getBaggageItem',
value: function getBaggageItem(key) {
if (true) {
if (arguments.length !== 1) {
throw new Error('Expected 1 arguments');
}
if (typeof key !== 'string' || key.length === 0) {
throw new Error('Key must be a string');
}
if (!kKeyRegExp.test(key)) {
throw new Error('Invalid trace key');
}
}
if (!this._imp) {
return undefined;
}
return this._imp.getBaggageItem(key);
}
/**
* Explicitly create a log record associated with the span.
*
* @param {[type]} fields [description]
* @param {object} fields
* Optional associative array of fields.
* - `timestamp` {Number} Optional field specifying the timestamp
* in milliseconds as a Unix timestamp. Fractional values are
* allowed so that timestamps with sub-millisecond accuracy
* can be represented. If not specified, the implementation
* is expected to use it's notion of the current time of the
* call.
* - `event` {string}
* The event name.
* - `payload` {object}
* An arbitrary structured payload. It is implementation-dependent
* how this will be processed.
* @param {object} fields - object containing the log record properties
* @param {number} [fields.timestamp] - optional field specifying the
* timestamp in milliseconds as a Unix timestamp. Fractional values
* are allowed so that timestamps with sub-millisecond accuracy
* can be represented. If not specified, the implementation is
* expected to use it's notion of the current time of the call.
* @param {string} [fields.event] - the event name
* @param {object} [fields.payload] - an arbitrary structured payload. It is
* implementation-dependent how this will be processed.
*/

@@ -764,5 +785,5 @@

*
* @param {string} eventName [description]
* @param {} payload [description]
* @return {[type]} [description]
* @param {string} eventName - string associated with the log record
* @param {object} [payload] - arbitrary payload object associated with the
* log record.
*/

@@ -774,4 +795,4 @@

return this.log({
'event': eventName,
'payload': payload
event: eventName,
payload: payload
});

@@ -781,11 +802,8 @@ }

/**
* Indicates that the unit of work represented by the span is complete or
* has otherwise been terminated.
* Sets the end timestamp and finalizes Span state.
*
* All Span objects must have finish() called on them before they are
* reported to the backend implementation.
* With the exception of calls to Span.context() (which are always allowed),
* finish() must be the last call made to any span instance, and to do
* otherwise leads to undefined behavior.
*
* Once `finish()` is called on a Span object, the behavior of all methods
* on the object is considered undefined.
*
* @param {Number} finishTime

@@ -821,3 +839,4 @@ * Optional finish time in milliseconds as a Unix timestamp. Decimal

/**
* Constructs a new Span object. This method should not be called directly.
* Constructs a new Span object, this method should not be called directly;
* Tracer.startSpan() or Tracer.join() should be used instead.
*/

@@ -848,3 +867,3 @@

}();
exports.default = Span;

@@ -855,2 +874,121 @@ module.exports = exports['default'];

/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
/**
* SpanContext represents Span state that must propagate to descendant Spans
* and across process boundaries.
*
* SpanContext is logically divided into two pieces: the user-level "Baggage"
* (see setBaggageItem and getBaggageItem) that propagates across Span
* boundaries and any Tracer-implementation-specific fields that are needed to
* identify or otherwise contextualize the associated Span instance (e.g., a
* <trace_id, span_id, sampled> tuple).
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SpanContext = function () {
_createClass(SpanContext, [{
key: 'setBaggageItem',
/**
* Sets a key:value pair on this SpanContext that also propagates to future
* children of the associated Span.
*
* setBaggageItem() enables powerful functionality given a full-stack
* opentracing integration (e.g., arbitrary application data from a web
* client can make it, transparently, all the way into the depths of a
* storage system), and with it some powerful costs: use this feature with
* care.
*
* IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to
* *future* causal descendants of the associated Span.
*
* IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and
* value is copied into every local *and remote* child of the associated
* Span, and that can add up to a lot of network and cpu overhead.
*
* @param {string} key
* @param {string} value
*/
value: function setBaggageItem(key, value) {
if (true) {
if (arguments.length !== 2) {
throw new Error('Invalid number of arguments');
}
}
if (this._imp) {
this._imp.setBaggageItem(key, value);
}
}
/**
* Returns the value for a baggage item given its key.
*
* @param {string} key
* The key for the given trace attribute.
* @return {string}
* String value for the given key, or undefined if the key does not
* correspond to a set trace attribute.
*/
}, {
key: 'getBaggageItem',
value: function getBaggageItem(key) {
if (true) {
if (arguments.length !== 1) {
throw new Error('Invalid number of arguments');
}
}
if (this._imp) {
return this._imp.getBaggageItem(key);
}
return undefined;
}
/**
* Constructs a new SpanContext object.
*
* This method should not be called directly; Span.context() should be used
* instead.
*/
}]);
function SpanContext(imp) {
_classCallCheck(this, SpanContext);
this._imp = imp;
}
/**
* Returns the SpanContext implementation object. The returned object is by
* its nature entirely implementation-dependent.
*/
_createClass(SpanContext, [{
key: 'imp',
value: function imp() {
return this._imp;
}
}]);
return SpanContext;
}();
exports.default = SpanContext;
module.exports = exports['default'];
/***/ },
/* 6 */
/***/ function(module, exports) {

@@ -872,6 +1010,2 @@

*
* NOTE: Since HTTP headers are a particularly important use case for the
* TEXT_MAP carrier, map keys identify their respective values in a
* case-insensitive manner.
*
* NOTE: The TEXT_MAP carrier map may contain unrelated data (e.g.,

@@ -882,7 +1016,24 @@ * arbitrary HTTP headers). As such, the Tracer implementation should use a

*/
FORMAT_TEXT_MAP: 'text_map'
FORMAT_TEXT_MAP: 'text_map',
/**
* A Span may be the "child of" a parent Span. In a “child of” reference,
* the parent Span depends on the child Span in some capacity.
*
* See more about reference types at http://opentracing.io/spec/
*/
REFERENCE_CHILD_OF: 'child_of',
/**
* Some parent Spans do not depend in any way on the result of their child
* Spans. In these cases, we say merely that the child Span “follows from”
* the parent Span in a causal sense.
*
* See more about reference types at http://opentracing.io/spec/
*/
REFERENCE_FOLLOWS_FROM: 'follows_from'
};
/***/ },
/* 6 */
/* 7 */
/***/ function(module, exports) {

@@ -914,4 +1065,89 @@

/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _span = __webpack_require__(4);
var _span2 = _interopRequireDefault(_span);
var _span_context = __webpack_require__(5);
var _span_context2 = _interopRequireDefault(_span_context);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Reference pairs a reference type constant (e.g., REFERENCE_CHILD_OF or
* REFERENCE_FOLLOWS_FROM) with the SpanContext it points to.
*
* See the exported childOf() and followsFrom() functions at the package level.
*/
var Reference = function () {
_createClass(Reference, [{
key: 'type',
/**
* @return {string} The Reference type (e.g., REFERENCE_CHILD_OF or
* REFERENCE_FOLLOWS_FROM).
*/
value: function type() {
return this._type;
}
/**
* @return {SpanContext} The SpanContext being referred to (e.g., the
* parent in a REFERENCE_CHILD_OF Reference).
*/
}, {
key: 'spanContext',
value: function spanContext() {
return this._spanContext;
}
/**
* Initialize a new Reference instance.
*
* @param {string} type - the Reference type constant (e.g.,
* REFERENCE_CHILD_OF or REFERENCE_FOLLOWS_FROM).
* @param {SpanContext} spanContext - the SpanContext being referred to. As
* a convenience, a Span instance may be passed in instead (in which
* case its .context() is used here).
*/
}]);
function Reference(type, spanContext) {
_classCallCheck(this, Reference);
if (true) {
if (!(spanContext instanceof _span_context2.default || spanContext instanceof _span2.default)) {
throw new Error('spanContext must be a Span or SpanContext instance');
}
}
this._type = type;
this._spanContext = spanContext instanceof _span2.default ? spanContext.context() : spanContext;
}
return Reference;
}();
exports.default = Reference;
module.exports = exports['default'];
/***/ }
/******/ ]);
//# sourceMappingURL=opentracing-node-debug.js.map

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

module.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(2),u=r(i);e.exports=new u["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(3),s=i(l),c=n(5),p=r(c),h=n(6),d=i(h),_=function(e){function t(){u(this,t);var e=o(this,Object.getPrototypeOf(t).call(this));for(var n in p)e[n]=p[n];return e.BinaryCarrier=d["default"],e}return a(t,e),f(t,[{key:"initGlobalTracer",value:function(e){this._imp=e,e&&e.setInterface(this)}},{key:"initNewTracer",value:function(e){var t=new s["default"](e);return e&&e.setInterface(this),t}}]),t}(s["default"]);t["default"]=_,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(4),a=r(o),f=n(5),l=(r(f),function(){function e(t){i(this,e),this._imp=t||null}return u(e,[{key:"startSpan",value:function(e,t){var n=null;return this._imp&&(1===arguments.length?t="string"==typeof e?{operationName:e}:e:t.operationName=e,n=this._imp.startSpan(t)),new a["default"](n)}},{key:"inject",value:function(e,t,n){this._imp&&this._imp.inject(e._imp,t,n)}},{key:"join",value:function(e,t,n){var r=null;return this._imp&&(r=this._imp.join(e,t,n)),new a["default"](r)}},{key:"flush",value:function(e){return this._imp?void this._imp.flush(e):void e(null)}}]),u(e,[{key:"imp",value:function(){return this._imp}}]),e}());t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(3),f=r(a),l=n(1),s=(new RegExp(/^[a-z0-9][-a-z0-9]*/),function(){function e(t){u(this,e),this._imp=t}return o(e,[{key:"tracer",value:function(){return this._imp?new f["default"](this._imp.tracer()):l}},{key:"setOperationName",value:function(e){return this._imp&&this._imp.setOperationName(e),this}},{key:"setTag",value:function(e,t){return this.addTags(i({},e,t)),this}},{key:"addTags",value:function(e){return this._imp?(this._imp.addTags(e),this):void 0}},{key:"setBaggageItem",value:function(e,t){return this._imp&&this._imp.setBaggageItem(e,t),this}},{key:"getBaggageItem",value:function(e){return this._imp?this._imp.getBaggageItem(e):void 0}},{key:"log",value:function(e){return this._imp?(this._imp.log(e),this):void 0}},{key:"logEvent",value:function(e,t){return this.log({event:e,payload:t})}},{key:"finish",value:function(e){this._imp&&this._imp.finish(e)}}]),o(e,[{key:"imp",value:function(){return this._imp}}]),e}());t["default"]=s,e.exports=t["default"]},function(e,t){"use strict";e.exports={FORMAT_BINARY:"binary",FORMAT_TEXT_MAP:"text_map"}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function i(e){n(this,i),this.buffer=e};t["default"]=r,e.exports=t["default"]}]);
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(2),u=r(i);e.exports=new u["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(3),c=i(l),s=n(6),p=r(s),h=n(7),d=i(h),_=n(8),y=i(_),v=function(e){function t(){u(this,t);var e=o(this,Object.getPrototypeOf(t).call(this));for(var n in p)e[n]=p[n];return e.Reference=y["default"],e.BinaryCarrier=d["default"],e}return a(t,e),f(t,[{key:"initGlobalTracer",value:function(e){this._imp=e,e&&e.setInterface(this)}},{key:"initNewTracer",value:function(e){var t=new c["default"](e);return e&&e.setInterface(this),t}},{key:"childOf",value:function(e){return new y["default"](p.REFERENCE_CHILD_OF,e)}},{key:"followsFrom",value:function(e){return new y["default"](p.REFERENCE_FOLLOWS_FROM,e)}}]),t}(c["default"]);t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(4),a=r(o),f=n(5),l=r(f),c=n(6),s=(r(c),function(){function e(t){i(this,e),this._imp=t||null}return u(e,[{key:"startSpan",value:function(e,t){var n=null;if(this._imp){if(1===arguments.length?t="string"==typeof e?{operationName:e}:e:t.operationName=e,t.childOf){var r=t.childOf instanceof a["default"]?t.childOf.context():t.childOf;t.references?t.references.push(r):t.references=[r],delete t.childOf}n=this._imp.startSpan(t)}return new a["default"](n)}},{key:"inject",value:function(e,t,n){this._imp&&(e instanceof a["default"]&&(e=e.context()),this._imp.inject(e._imp,t,n))}},{key:"extract",value:function(e,t){var n=null;return this._imp&&(n=this._imp.extract(e,t)),null!==n?new l["default"](n):null}},{key:"flush",value:function(e){return this._imp?void this._imp.flush(e):void e(null)}}]),u(e,[{key:"imp",value:function(){return this._imp}}]),e}());t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(3),f=r(a),l=n(5),c=r(l),s=n(1),p=function(){function e(t){u(this,e),this._imp=t}return o(e,[{key:"context",value:function(){var e=null;return this._imp&&(e=this._imp.context()),new c["default"](e)}},{key:"tracer",value:function(){return this._imp?new f["default"](this._imp.tracer()):s}},{key:"setOperationName",value:function(e){return this._imp&&this._imp.setOperationName(e),this}},{key:"setTag",value:function(e,t){return this.addTags(i({},e,t)),this}},{key:"addTags",value:function(e){if(this._imp)return this._imp.addTags(e),this}},{key:"log",value:function(e){if(this._imp)return this._imp.log(e),this}},{key:"logEvent",value:function(e,t){return this.log({event:e,payload:t})}},{key:"finish",value:function(e){this._imp&&this._imp.finish(e)}}]),o(e,[{key:"imp",value:function(){return this._imp}}]),e}();t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t){r(this,e),this._imp=t}return i(e,[{key:"setBaggageItem",value:function(e,t){this._imp&&this._imp.setBaggageItem(e,t)}},{key:"getBaggageItem",value:function(e){if(this._imp)return this._imp.getBaggageItem(e)}}]),i(e,[{key:"imp",value:function(){return this._imp}}]),e}();t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";e.exports={FORMAT_BINARY:"binary",FORMAT_TEXT_MAP:"text_map",REFERENCE_CHILD_OF:"child_of",REFERENCE_FOLLOWS_FROM:"follows_from"}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function i(e){n(this,i),this.buffer=e};t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(4),a=r(o),f=n(5),l=(r(f),function(){function e(t,n){i(this,e),this._type=t,this._spanContext=n instanceof a["default"]?n.context():n}return u(e,[{key:"type",value:function(){return this._type}},{key:"spanContext",value:function(){return this._spanContext}}]),e}());t["default"]=l,e.exports=t["default"]}]);
{
"name": "opentracing",
"version": "0.9.18",
"version": "0.10.1",
"main": "dist/opentracing-node.js",

@@ -44,2 +44,7 @@ "scripts": {

"colors": "^1.1.2",
"eslint": "2.13.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.10.2",
"eslint-plugin-jsx-a11y": "^1.5.5",
"eslint-plugin-react": "^5.2.2",
"json-loader": "^0.5.4",

@@ -46,0 +51,0 @@ "mocha": "^2.4.5",

@@ -60,5 +60,38 @@ # OpenTracing API for JavaScript

## API Documentation
There is a hosted copy of the current generated [ESDoc API Documentation here](https://doc.esdoc.org/github.com/opentracing/opentracing-javascript/).
## Notes on backwards-incompatible changes
### v0.9.x to v0.10.x
This release makes the `opentracing-javascript` package conformant with the ideas proposed in [opentracing/opentracing.github.io#99](https://github.com/opentracing/opentracing.github.io/issues/99). The API changes can be summarized as follows:
* Every `Span` has a `SpanContext`, available via `Span.context()`. The `SpanContext` represents the subset of `Span` state that must propagate across process boundaries in-band along with the application data.
* `Span.setBaggageItem()` and `Span.getBaggageItem()` have moved to `SpanContext`. Calls can be migrated trivially: `Span.context().{set,get}BaggageItem()`.
* The first parameter to `Tracer.inject()` is now a `SpanContext`. As a convenience, a `Span` may be passed instead.
* There is a new concept called a `Reference`; a reference describes a relationship between a newly started `Span` and some other `Span` (via a `SpanContext`). The common case is to describe a reference to a parent `Span` that depends on the child `Span` ('REFERENCE_CHILD_OF`).
* `Tracer.startSpan(operation, fields)` no longer accepts `fields.parent`; it now accepts either `fields.childOf`, a `SpanContext` or `Span` instance, or `fields.references`, an array of one or more `Reference` objects. The former is just a shorthand for the latter.
* `Tracer.join(operationName, format, carrier)` has been removed from the API. In its place, use `Tracer.extract(format, carrier)` which returns a `SpanContext`, and pass that `SpanContext` as a reference in `Tracer.startSpan()`.
TL;DR, to start a child span, do this:
```
let parentSpan = ...;
let childSpan = Tracer.startSpan('child op', { childOf : parentSpan });
```
... and to continue a trace from the server side of an RPC, do this:
```
let format = ...; // same as for Tracer.join()
let carrier = ...; // same as for Tracer.join()
let extractedCtx = Tracer.extract(format, carrier);
let serverSpan = Tracer.startSpan('...', { childOf : extractedCtx });
```
## Development Information
*I.e. information for developers working on this package.*
*I.e., information for developers working on this package.*

@@ -65,0 +98,0 @@ #### Building the library

@@ -15,6 +15,2 @@ 'use strict';

*
* NOTE: Since HTTP headers are a particularly important use case for the
* TEXT_MAP carrier, map keys identify their respective values in a
* case-insensitive manner.
*
* NOTE: The TEXT_MAP carrier map may contain unrelated data (e.g.,

@@ -25,3 +21,20 @@ * arbitrary HTTP headers). As such, the Tracer implementation should use a

*/
FORMAT_TEXT_MAP : 'text_map',
FORMAT_TEXT_MAP : 'text_map',
/**
* A Span may be the "child of" a parent Span. In a “child of” reference,
* the parent Span depends on the child Span in some capacity.
*
* See more about reference types at http://opentracing.io/spec/
*/
REFERENCE_CHILD_OF : 'child_of',
/**
* Some parent Spans do not depend in any way on the result of their child
* Spans. In these cases, we say merely that the child Span “follows from”
* the parent Span in a causal sense.
*
* See more about reference types at http://opentracing.io/spec/
*/
REFERENCE_FOLLOWS_FROM : 'follows_from',
};

@@ -6,5 +6,7 @@ 'use strict';

import BinaryCarrier from './binary_carrier';
import Reference from './reference';
/**
* The Singleton object extends the standard Tracer object so that the default
* The Singleton object is the default export of the package and extends the
* standard Tracer object so that the default
* exported object of the package can be conveniently be used both as the

@@ -24,3 +26,3 @@ * default tracer and an interface to the library.

*
* @param {TracerImp} The Tracer implementation object
* @param {TracerImp} tracerImp - the Tracer implementation object
*/

@@ -50,2 +52,24 @@ initGlobalTracer(tracerImp) {

/**
* Return a new REFERENCE_CHILD_OF reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_CHILD_OF reference pointing to `spanContext`
*/
childOf(spanContext) {
return new Reference(Constants.REFERENCE_CHILD_OF, spanContext);
}
/**
* Return a new REFERENCE_FOLLOWS_FROM reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_FOLLOWS_FROM reference pointing to `spanContext`
*/
followsFrom(spanContext) {
return new Reference(Constants.REFERENCE_FOLLOWS_FROM, spanContext);
}
// ---------------------------------------------------------------------- //

@@ -55,3 +79,4 @@ // Private and non-standard methods

/**
/* For internal use only:
*
* Creates the Singleton with no underlying implementation (i.e. defaults

@@ -71,5 +96,6 @@ * to no-op behavior for all functions).

// package level.
for (let key in Constants) {
for (let key in Constants) { // eslint-disable-line no-restricted-syntax
this[key] = Constants[key];
}
this.Reference = Reference;

@@ -76,0 +102,0 @@ // Carrier objects to be exposed at the package level

'use strict';
import Tracer from './tracer';
import SpanContext from './span_context';
let defaultTracer = require('./default_tracer');
const kKeyRegExp = new RegExp(/^[a-z0-9][-a-z0-9]*/);
/**

@@ -21,2 +20,20 @@ * Span represents a logical unit of work as part of a broader Trace. Examples

/**
* Returns the SpanContext object associated with this Span.
*
* @return {SpanContext}
*/
context() {
if (API_CONFORMANCE_CHECKS) {
if (arguments.length !== 0) {
throw new Error('Invalid number of arguments');
}
}
let spanContextImp = null;
if (this._imp) {
spanContextImp = this._imp.context();
}
return new SpanContext(spanContextImp);
}
/**
* Returns the Tracer object used to create this Span.

@@ -111,90 +128,13 @@ *

/**
* Set an arbitrary key-value string pair that will be carried along the
* full path of a trace.
*
* All spans created as children of this span will inherit the baggage items
* of this span.
*
* Baggage items are copied between all spans, both in-process and across
* distributed requests, therefore this feature should be used with care to
* ensure undue overhead is not incurred.
*
* Keys are case insensitive and must match the regular expresssion
* `[a-z0-9][-a-z0-9]*`.
*
* @param {string} key
* @param {string} value
*/
setBaggageItem(key, value) {
if (API_CONFORMANCE_CHECKS) {
if (arguments.length !== 2) {
throw new Error('Expected 2 arguments');
}
if (typeof key !== 'string' || key.length === 0) {
throw new Error('Key must be a string');
}
if (!kKeyRegExp.test(key)) {
throw new Error('Invalid trace key');
}
let valueType = typeof value;
if (value !== null &&
valueType !== 'boolean' &&
valueType !== 'number' &&
valueType !== 'string') {
throw new Error('Trace attribute values can only be basic types');
}
}
if (this._imp) {
this._imp.setBaggageItem(key, value);
}
return this;
}
/**
* Returns the value for the given baggage item key.
*
* @param {string} key
* The key for the given trace attribute.
* @return {string}
* String value for the given key, or undefined if the key does not
* correspond to a set trace attribute.
*/
getBaggageItem(key) {
if (API_CONFORMANCE_CHECKS) {
if (arguments.length !== 1) {
throw new Error('Expected 1 arguments');
}
if (typeof key !== 'string' || key.length === 0) {
throw new Error('Key must be a string');
}
if (!kKeyRegExp.test(key)) {
throw new Error('Invalid trace key');
}
}
if (!this._imp) {
return undefined;
}
return this._imp.getBaggageItem(key);
}
/**
* Explicitly create a log record associated with the span.
*
* @param {[type]} fields [description]
* @param {object} fields
* Optional associative array of fields.
* - `timestamp` {Number} Optional field specifying the timestamp
* in milliseconds as a Unix timestamp. Fractional values are
* allowed so that timestamps with sub-millisecond accuracy
* can be represented. If not specified, the implementation
* is expected to use it's notion of the current time of the
* call.
* - `event` {string}
* The event name.
* - `payload` {object}
* An arbitrary structured payload. It is implementation-dependent
* how this will be processed.
* @param {object} fields - object containing the log record properties
* @param {number} [fields.timestamp] - optional field specifying the
* timestamp in milliseconds as a Unix timestamp. Fractional values
* are allowed so that timestamps with sub-millisecond accuracy
* can be represented. If not specified, the implementation is
* expected to use it's notion of the current time of the call.
* @param {string} [fields.event] - the event name
* @param {object} [fields.payload] - an arbitrary structured payload. It is
* implementation-dependent how this will be processed.
*/

@@ -220,10 +160,10 @@ log(fields) {

*
* @param {string} eventName [description]
* @param {} payload [description]
* @return {[type]} [description]
* @param {string} eventName - string associated with the log record
* @param {object} [payload] - arbitrary payload object associated with the
* log record.
*/
logEvent(eventName, payload) {
return this.log({
'event' : eventName,
'payload' : payload,
event : eventName,
payload : payload,
});

@@ -233,11 +173,8 @@ }

/**
* Indicates that the unit of work represented by the span is complete or
* has otherwise been terminated.
* Sets the end timestamp and finalizes Span state.
*
* All Span objects must have finish() called on them before they are
* reported to the backend implementation.
* With the exception of calls to Span.context() (which are always allowed),
* finish() must be the last call made to any span instance, and to do
* otherwise leads to undefined behavior.
*
* Once `finish()` is called on a Span object, the behavior of all methods
* on the object is considered undefined.
*
* @param {Number} finishTime

@@ -270,3 +207,4 @@ * Optional finish time in milliseconds as a Unix timestamp. Decimal

/**
* Constructs a new Span object. This method should not be called directly.
* Constructs a new Span object, this method should not be called directly;
* Tracer.startSpan() or Tracer.join() should be used instead.
*/

@@ -273,0 +211,0 @@ constructor(imp) {

'use strict';
import Span from './span';
import SpanContext from './span_context';
import Constants from './constants';

@@ -21,24 +22,35 @@

*
* @param {string|object} nameOrFields
* If the given argument is a `string`, it is the name of the
* the operation from the perpsective of the current service.
* For example:
*
* If the given argument is a object, it is treated as a set of
* fields to set on the newly created span.
* // Start a new (parentless) root Span:
* var parent = Tracer.startSpan('DoWork');
*
* - `operationName` {string} Required. This is the name to use for
* the newly created span.
* - `parent` {Span} Optional. The newly created Span will be created
* as a child of `parent`.
* - `tags` {object} Optional set of key-value pairs which will be set as
* tags on the newly created Span. Ownership of the object is
* passed to the created span and the caller for efficiency
* reasons.
* - `startTime` {Number} Optional manually specified start time for the
* created Span object. The time should be specified in
* milliseconds as Unix timestamp. Decimal value are supported
* to represent time values with sub-millisecond accuracy.
* // Start a new (child) Span:
* var child = Tracer.startSpan('Subroutine', {
* reference: Tracer.childOf(parent.context()),
* });
*
* @return {Span}
* A new Span object.
* @param {string|object} nameOrFields - if the given argument is a
* string, it is the name of the operation and the second `fields`
* argument is optional. If it is an object, it is treated as the
* fields argument and a second argument should not be provided.
* @param {object} [fields] - the fields to set on the newly created span.
* @param {string} [fields.operationName] - the name to use for the newly
* created span. Required if called with a single argument.
* @param {SpanContext} [fields.childOf] - a parent SpanContext (or Span,
* for convenience) that the newly-started span will be the child of
* (per REFERENCE_CHILD_OF). If specified, `fields.references` must
* be unspecified.
* @param {array} [fields.references] - an array of Reference instances,
* each pointing to a causal parent SpanContext. If specified,
* `fields.childOf` must be unspecified.
* @param {object} [fields.tags] - set of key-value pairs which will be set
* as tags on the newly created Span. Ownership of the object is
* passed to the created span for efficiency reasons (the caller
* should not modify this object after calling startSpan).
* @param {number} [fields.startTime] - a manually specified start time for
* the created Span object. The time should be specified in
* milliseconds as Unix timestamp. Decimal value are supported
* to represent time values with sub-millisecond accuracy.
* @return {Span} - a new Span object.
*/

@@ -64,3 +76,3 @@ startSpan(nameOrFields, fields) {

if (!nameOrFields.operationName) {
throw new Error('operationName is a required parameter')
throw new Error('operationName is a required parameter');
}

@@ -85,2 +97,28 @@ }

}
if (API_CONFORMANCE_CHECKS) {
if (fields.childOf && fields.references) {
throw new Error('At most one of `childOf` and ' +
'`references` may be specified');
}
if (fields.childOf && !(
fields.childOf instanceof Span ||
fields.childOf instanceof SpanContext)) {
throw new Error('childOf must be a Span or SpanContext instance');
}
}
// Convert fields.childOf to fields.references as needed.
if (fields.childOf) {
// Coerce from a Span to a SpanContext.
let childOf = (
fields.childOf instanceof Span ?
fields.childOf.context() :
fields.childOf);
if (fields.references) {
fields.references.push(childOf);
} else {
fields.references = [childOf];
}
delete(fields.childOf);
}
spanImp = this._imp.startSpan(fields);

@@ -92,6 +130,8 @@ }

/**
* Injects the information about the given span into the carrier
* so that the span can propogate across inter-process barriers.
* Injects the given SpanContext instance for cross-process propagation
* within `carrier`. The expected type of `carrier` depends on the value of
* `format.
*
* See FORMAT_TEXT_MAP and FORMAT_BINARY for the two required carriers.
* OpenTracing defines a common set of `format` values (see FORMAT_TEXT_MAP
* and FORMAT_BINARY), and each has an expected carrier type.
*

@@ -104,3 +144,3 @@ * Consider this pseudocode example:

* var textCarrier = {};
* Tracer.inject(clientSpan, Tracer.FORMAT_TEXT_MAP, textCarrier);
* Tracer.inject(clientSpan.context(), Tracer.FORMAT_TEXT_MAP, textCarrier);
* // Incorporate the textCarrier into the outbound HTTP request header

@@ -116,10 +156,11 @@ * // map.

*
* @param {Span} span
* The span whose information should be injected into the carrier.
* @param {string} format
* The format of the carrier.
* @param {any} carrier
* See the method description for details on the carrier object.
* @param {SpanContext} spanContext - the SpanContext to inject into the
* carrier object. As a convenience, a Span instance may be passed
* in instead (in which case its .context() is used for the
* inject()).
* @param {string} format - the format of the carrier.
* @param {any} carrier - see the documentation for the chosen `format`
* for a description of the carrier object.
*/
inject(span, format, carrier) {
inject(spanContext, format, carrier) {
if (API_CONFORMANCE_CHECKS) {

@@ -129,7 +170,7 @@ if (arguments.length !== 3) {

}
if (!(span instanceof Span)) {
throw new Error('Expected span object as first argument');
if (!(spanContext instanceof SpanContext || spanContext instanceof Span)) {
throw new Error('first argument must be a SpanContext or Span instance');
}
if (typeof format !== 'string') {
throw new Error('format expected to be a string. Found: ' + typeof format);
throw new Error(`format expected to be a string. Found: ${typeof format}`);
}

@@ -145,3 +186,7 @@ if (format === Constants.FORMAT_TEXT_MAP && typeof carrier !== 'object') {

if (this._imp) {
this._imp.inject(span._imp, format, carrier);
// Allow the user to pass a Span instead of a SpanContext
if (spanContext instanceof Span) {
spanContext = spanContext.context();
}
this._imp.inject(spanContext._imp, format, carrier);
}

@@ -151,6 +196,7 @@ }

/**
* Returns a new Span object with the given operation name using the trace
* information from the carrier.
* Returns a SpanContext instance extracted from `carrier` in the given
* `format`.
*
* See FORMAT_TEXT_MAP and FORMAT_BINARY for the two required carriers.
* OpenTracing defines a common set of `format` values (see FORMAT_TEXT_MAP
* and FORMAT_BINARY), and each has an expected carrier type.
*

@@ -161,4 +207,4 @@ * Consider this pseudocode example:

* var textCarrier = inboundHTTPReq.headers;
* var serverSpan = Tracer.join(
* "operation name", Tracer.FORMAT_TEXT_MAP, textCarrier);
* var wireCtx = Tracer.extract(Tracer.FORMAT_TEXT_MAP, textCarrier);
* var serverSpan = Tracer.startSpan('...', Tracer.childOf(wireCtx));
*

@@ -168,18 +214,14 @@ * For FORMAT_BINARY, `carrier` is expected to have a field named `buffer`

*
* @param {string} operationName
* Operation name to use on the newly created span.
* @param {string} format
* The format of the carrier.
* @param {any} carrier
* The type of the carrier object is determined by the format.
* @return {Span}
* @param {string} format - the format of the carrier.
* @param {any} carrier - the type of the carrier object is determined by
* the format.
* @return {SpanContext}
* The extracted SpanContext, or null if no such SpanContext could
* be found in `carrier`
*/
join(operationName, format, carrier) {
extract(format, carrier) {
if (API_CONFORMANCE_CHECKS) {
if (arguments.length !== 3) {
if (arguments.length !== 2) {
throw new Error('Invalid number of arguments.');
}
if (typeof operationName !== 'string' || !operationName.length) {
throw new Error('operationName is expected to be a string of non-zero length');
}
if (typeof format !== 'string' || !format.length) {

@@ -197,7 +239,10 @@ throw new Error('format is expected to be a string of non-zero length');

}
let spanImp = null;
let spanContextImp = null;
if (this._imp) {
spanImp = this._imp.join(operationName, format, carrier);
spanContextImp = this._imp.extract(format, carrier);
}
return new Span(spanImp);
if (spanContextImp !== null) {
return new SpanContext(spanContextImp);
}
return null;
}

@@ -208,6 +253,6 @@

*
* @param {function} done
* Optional callback function with the signature `function(err)` that
* will be called as soon as the flush completes. `err` should be
* null or undefined if the flush was successful.
* @param {function(err: objectg)} done - optional callback function with
* the signature `function(err)` that will be called as soon as the
* flush completes. `err` should be null or undefined if the flush
* was successful.
*/

@@ -214,0 +259,0 @@ flush(done) {

@@ -18,3 +18,3 @@ // For the convenience of unit testing, add these to the global namespace

describe('API surface area', function() {
describe('surface area', function() {
it('should have the required functions on the singleton', function() {

@@ -28,2 +28,4 @@ expect(Tracer.initGlobalTracer).to.be.a('function');

expect(Tracer.FORMAT_BINARY).to.be.a('string');
expect(Tracer.REFERENCE_CHILD_OF).to.be.a('string');
expect(Tracer.REFERENCE_FOLLOWS_FROM).to.be.a('string');
});

@@ -34,3 +36,3 @@

expect(Tracer.inject).to.be.a('function');
expect(Tracer.join).to.be.a('function');
expect(Tracer.extract).to.be.a('function');
expect(Tracer.flush).to.be.a('function');

@@ -42,6 +44,5 @@ });

expect(span.tracer).to.be.a('function');
expect(span.context).to.be.a('function');
expect(span.setTag).to.be.a('function');
expect(span.addTags).to.be.a('function');
expect(span.setBaggageItem).to.be.a('function');
expect(span.getBaggageItem).to.be.a('function');
expect(span.log).to.be.a('function');

@@ -52,26 +53,41 @@ expect(span.logEvent).to.be.a('function');

it('should have the required SpanContext functions', function() {
var spanContext = Tracer.startSpan('test_operation').context();
expect(spanContext.setBaggageItem).to.be.a('function');
expect(spanContext.getBaggageItem).to.be.a('function');
});
it('should enforce the required carrier types', function() {
var span = Tracer.startSpan('test_operation');
var spanContext = Tracer.startSpan('test_operation').context();
var textCarrier = {};
expect(function() { Tracer.inject(span, Tracer.FORMAT_TEXT_MAP, textCarrier); }).to.not.throw(Error);
expect(function() { Tracer.inject(span, Tracer.FORMAT_TEXT_MAP, ''); }).to.throw(Error);
expect(function() { Tracer.inject(span, Tracer.FORMAT_TEXT_MAP, 5); }).to.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_TEXT_MAP, textCarrier); }).to.not.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_TEXT_MAP, ''); }).to.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_TEXT_MAP, 5); }).to.throw(Error);
var binCarrier = new Tracer.BinaryCarrier();
expect(function() { Tracer.inject(span, Tracer.FORMAT_BINARY, binCarrier); }).to.not.throw(Error);
expect(function() { Tracer.inject(span, Tracer.FORMAT_BINARY, new Object); }).to.not.throw(Error);
expect(function() { Tracer.inject(span, Tracer.FORMAT_BINARY, {}); }).to.not.throw(Error);
expect(function() { Tracer.inject(span, Tracer.FORMAT_BINARY, { buffer : null }); }).to.not.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_BINARY, binCarrier); }).to.not.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_BINARY, new Object); }).to.not.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_BINARY, {}); }).to.not.throw(Error);
expect(function() { Tracer.inject(spanContext, Tracer.FORMAT_BINARY, { buffer : null }); }).to.not.throw(Error);
expect(function() { Tracer.join('test_op2', Tracer.FORMAT_BINARY, binCarrier); }).to.not.throw(Error);
expect(function() { Tracer.join('test_op2', Tracer.FORMAT_BINARY, {}); }).to.not.throw(Error);
expect(function() { Tracer.join('test_op2', Tracer.FORMAT_BINARY, { buffer : null }); }).to.not.throw(Error);
expect(function() { Tracer.join('test_op2', Tracer.FORMAT_BINARY, { buffer : '' }); }).to.throw(Error);
expect(function() { Tracer.join('test_op2', Tracer.FORMAT_BINARY, { buffer : 5 }); }).to.throw(Error);
expect(function() { Tracer.extract(Tracer.FORMAT_BINARY, binCarrier); }).to.not.throw(Error);
expect(function() { Tracer.extract(Tracer.FORMAT_BINARY, {}); }).to.not.throw(Error);
expect(function() { Tracer.extract(Tracer.FORMAT_BINARY, { buffer : null }); }).to.not.throw(Error);
expect(function() { Tracer.extract(Tracer.FORMAT_BINARY, { buffer : '' }); }).to.throw(Error);
expect(function() { Tracer.extract(Tracer.FORMAT_BINARY, { buffer : 5 }); }).to.throw(Error);
});
it('should coerce to spanContext as needed', function() {
var span = Tracer.startSpan('test_operation');
var textCarrier = {};
expect(function() { Tracer.inject(span, Tracer.FORMAT_TEXT_MAP, textCarrier); }).to.not.throw(Error);
expect(function() { Tracer.startSpan('child', { childOf : span }); }).to.not.throw(Error);
expect(function() { var _ = new Tracer.Reference(Tracer.REFERENCE_CHILD_OF, span); }).to.not.throw(Error);
});
});
describe('No-op tracer', function() {
it('should return a valid no-op tracer object when given a null implemenation', function() {
it('should return a valid no-op tracer object when given a null implementation', function() {
var tracer;

@@ -91,3 +107,3 @@ expect(function() {

before(function() {
NoopTracerImp = require('../src/imp/noop_imp.js');
NoopTracerImp = require('./imp/noop_imp.js');
});

@@ -94,0 +110,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

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