UNPKG

@azure/opentelemetry-instrumentation-azure-sdk

Version:
59 lines (58 loc) 2.16 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var transformations_exports = {}; __export(transformations_exports, { toOpenTelemetrySpanKind: () => toOpenTelemetrySpanKind, toSpanOptions: () => toSpanOptions }); module.exports = __toCommonJS(transformations_exports); var import_api = require("@opentelemetry/api"); var import_core = require("@opentelemetry/core"); function toOpenTelemetrySpanKind(tracingSpanKind) { const key = (tracingSpanKind || "internal").toUpperCase(); return import_api.SpanKind[key]; } function toOpenTelemetryLinks(spanLinks = []) { return spanLinks.reduce((acc, tracingSpanLink) => { const spanContext = import_api.trace.getSpanContext(tracingSpanLink.tracingContext); if (spanContext) { acc.push({ context: spanContext, attributes: (0, import_core.sanitizeAttributes)(tracingSpanLink.attributes) }); } return acc; }, []); } function toSpanOptions(spanOptions) { const { spanAttributes, spanLinks, spanKind } = spanOptions || {}; const attributes = (0, import_core.sanitizeAttributes)(spanAttributes); const kind = toOpenTelemetrySpanKind(spanKind); const links = toOpenTelemetryLinks(spanLinks); return { attributes, kind, links }; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { toOpenTelemetrySpanKind, toSpanOptions }); //# sourceMappingURL=transformations.js.map