@mastra/otel-exporter 1.4.10-alpha.1 → 1.4.10-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -16
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let _mastra_core_observability = require("@mastra/core/observability");
|
|
25
24
|
let _mastra_observability = require("@mastra/observability");
|
|
26
25
|
_mastra_observability = __toESM(_mastra_observability, 1);
|
|
@@ -35,7 +34,7 @@ let fs = require("fs");
|
|
|
35
34
|
let url = require("url");
|
|
36
35
|
let _opentelemetry_semantic_conventions_incubating = require("@opentelemetry/semantic-conventions/incubating");
|
|
37
36
|
let _mastra_core_features = require("@mastra/core/features");
|
|
38
|
-
|
|
37
|
+
// src/loadExporter.ts
|
|
39
38
|
const EXPORTER_SPECS = {
|
|
40
39
|
traces: {
|
|
41
40
|
"http/json": {
|
|
@@ -111,8 +110,7 @@ async function loadSignalExporter(signal, protocol, provider) {
|
|
|
111
110
|
function capitalize(s) {
|
|
112
111
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
113
112
|
}
|
|
114
|
-
|
|
115
|
-
//#region src/log-converter.ts
|
|
113
|
+
// src/log-converter.ts
|
|
116
114
|
/**
|
|
117
115
|
* Map Mastra LogLevel to OTEL SeverityNumber
|
|
118
116
|
*/
|
|
@@ -176,8 +174,7 @@ function convertLog(log) {
|
|
|
176
174
|
spanId: log.spanId
|
|
177
175
|
};
|
|
178
176
|
}
|
|
179
|
-
|
|
180
|
-
//#region src/provider-configs.ts
|
|
177
|
+
// src/provider-configs.ts
|
|
181
178
|
function resolveProviderConfig(config, debug) {
|
|
182
179
|
const providerName = Object.keys(config)[0];
|
|
183
180
|
if (debug) console.info(`[OtelExporter:debug] Resolving provider config for: ${providerName}`);
|
|
@@ -290,8 +287,7 @@ function resolveCustomConfig(config) {
|
|
|
290
287
|
protocol: config.protocol || "http/json"
|
|
291
288
|
};
|
|
292
289
|
}
|
|
293
|
-
|
|
294
|
-
//#region src/features.ts
|
|
290
|
+
// src/features.ts
|
|
295
291
|
/**
|
|
296
292
|
* Feature detection for paired @mastra/core and @mastra/observability versions.
|
|
297
293
|
*
|
|
@@ -323,8 +319,7 @@ function isModelInferenceEnabled() {
|
|
|
323
319
|
function __setObservabilityFeaturesForTest(features) {
|
|
324
320
|
observabilityFeatures = features;
|
|
325
321
|
}
|
|
326
|
-
|
|
327
|
-
//#region src/gen-ai-messages.ts
|
|
322
|
+
// src/gen-ai-messages.ts
|
|
328
323
|
const isMastraMessagePart = (p) => {
|
|
329
324
|
return typeof p === "object" && p != null && "type" in p && (p.type === "text" || p.type === "tool-call" || p.type === "tool-result") && (p.type === "text" && "text" in p || p.type === "tool-call" && "toolCallId" in p && "toolName" in p && "input" in p || p.type === "tool-result" && "toolCallId" in p && "toolName" in p && "output" in p);
|
|
330
325
|
};
|
|
@@ -413,8 +408,7 @@ const convertMastraMessagesToGenAIMessages = (inputOutputString) => {
|
|
|
413
408
|
return inputOutputString;
|
|
414
409
|
}
|
|
415
410
|
};
|
|
416
|
-
|
|
417
|
-
//#region src/gen-ai-semantics.ts
|
|
411
|
+
// src/gen-ai-semantics.ts
|
|
418
412
|
/**
|
|
419
413
|
* Utilities for converting Mastra Spans to OTel Spans
|
|
420
414
|
* with Semantic conventions for generative AI systems
|
|
@@ -730,8 +724,7 @@ function normalizeProvider(providerName) {
|
|
|
730
724
|
for (const [canonical, aliases] of Object.entries(PROVIDER_ALIASES)) for (const alias of aliases) if (normalized === alias) return canonical;
|
|
731
725
|
return providerName.toLowerCase();
|
|
732
726
|
}
|
|
733
|
-
|
|
734
|
-
//#region src/span-converter.ts
|
|
727
|
+
// src/span-converter.ts
|
|
735
728
|
/**
|
|
736
729
|
* Convert Mastra Spans to OpenTelemetry spans
|
|
737
730
|
*/
|
|
@@ -896,8 +889,7 @@ function buildStatusAndEvents(span, defaultTime) {
|
|
|
896
889
|
events
|
|
897
890
|
};
|
|
898
891
|
}
|
|
899
|
-
|
|
900
|
-
//#region src/tracing.ts
|
|
892
|
+
// src/tracing.ts
|
|
901
893
|
/**
|
|
902
894
|
* Wrapper around a SpanExporter that logs export results when debug mode is enabled.
|
|
903
895
|
* The OTel SDK intentionally does not log on success, making debugging difficult.
|
|
@@ -1241,7 +1233,6 @@ var OtelExporter = class extends _mastra_observability.BaseExporter {
|
|
|
1241
1233
|
if (shutdownPromises.length > 0) await Promise.all(shutdownPromises);
|
|
1242
1234
|
}
|
|
1243
1235
|
};
|
|
1244
|
-
//#endregion
|
|
1245
1236
|
exports.OtelExporter = OtelExporter;
|
|
1246
1237
|
exports.SpanConverter = SpanConverter;
|
|
1247
1238
|
exports.__setObservabilityFeaturesForTest = __setObservabilityFeaturesForTest;
|