lightstep-tracer
Version:
> ❗ **This instrumentation is no longer recommended**. Please review [documentation on setting up and configuring the OpenTelemetry Node.js Launcher](https://github.com/lightstep/otel-launcher-node) or [OpenTelemetry JS (Browser)](https://github.com/open-
62 lines (46 loc) • 2.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var converter = require('hex2dec');
var Util = /*#__PURE__*/function () {
function Util() {
_classCallCheck(this, Util);
}
_createClass(Util, [{
key: "detachedTimeout",
value: // Similar to a regular setTimeout() call, but dereferences the timer so the
// program execution will not be held up by this timer.
function detachedTimeout(callback, delay) {
var timer = setTimeout(callback, delay);
if (timer.unref) {
timer.unref();
}
return timer;
}
}, {
key: "shouldSendMetaSpan",
value: function shouldSendMetaSpan(opts, tags) {
var shouldSendSpan = opts.meta_event_reporting === true && tags['lightstep.meta_event'] !== true;
return shouldSendSpan;
} // Use native BigInt if available. Native BigInt has a significant
// performance improvement over hex2dec
}, {
key: "hexToDec",
value: function hexToDec(hexString) {
if (typeof global.BigInt !== 'function') {
return converter.hexToDec(hexString);
} // eslint-ignore-line
return global.BigInt("0x".concat(hexString)).toString(10);
}
}]);
return Util;
}();
var _default = new Util();
exports["default"] = _default;
module.exports = exports.default;
//# sourceMappingURL=util.js.map