UNPKG

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-

102 lines (81 loc) 4.99 kB
"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _platform_abstraction_layer = require("../platform_abstraction_layer"); var _each2 = _interopRequireDefault(require("../_each")); var coerce = _interopRequireWildcard(require("./coerce")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 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"); } } 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 ReportImp = /*#__PURE__*/function () { function ReportImp(runtime, oldestMicros, youngestMicros, spanRecords, internalLogs, counters, timestampOffsetMicros) { _classCallCheck(this, ReportImp); this._runtime = runtime; this._oldestMicros = oldestMicros; this._youngestMicros = youngestMicros; this._spanRecords = spanRecords; this._internalLogs = internalLogs; this._counters = counters; this._timestampOffsetMicros = timestampOffsetMicros; } _createClass(ReportImp, [{ key: "getSpanRecords", value: function getSpanRecords() { return this._spanRecords; } }, { key: "getInternalLogs", value: function getInternalLogs() { return this._internalLogs; } }, { key: "getCounters", value: function getCounters() { return this._counters; } }, { key: "toThrift", value: function toThrift() { var _this = this; (0, _each2["default"])(this._spanRecords, function (span) { span.runtime_guid = _this._runtimeGUID; }); var thriftCounters = []; (0, _each2["default"])(this._counters, function (value, key) { if (value === 0) { return; } // eslint-disable-next-line camelcase thriftCounters.push(new _platform_abstraction_layer.crouton_thrift.MetricsSample({ name: coerce.toString(key), double_value: coerce.toNumber(value) })); }); var thriftSpanRecords = []; (0, _each2["default"])(this._spanRecords, function (spanRecord) { thriftSpanRecords.push(spanRecord._toThrift()); }); // eslint-disable-next-line camelcase return new _platform_abstraction_layer.crouton_thrift.ReportRequest({ runtime: this._runtime.toThrift(), oldest_micros: this._oldestMicros, youngest_micros: this._youngestMicros, span_records: thriftSpanRecords, internal_logs: this._internalLogs, // eslint-disable-next-line camelcase internal_metrics: new _platform_abstraction_layer.crouton_thrift.Metrics({ counts: thriftCounters }), timestamp_offset_micros: this._timestampOffsetMicros }); } }]); return ReportImp; }(); exports["default"] = ReportImp; module.exports = exports.default; //# sourceMappingURL=report_imp.js.map