@mastra/otel-exporter 0.0.0-feat-improve-processors-20251205191721 → 0.0.0-feat-mcp-embedded-docs-tools-clean-20260102135536

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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Utilities for converting Mastra Spans to OTel Spans
3
+ * with Semantic conventions for generative AI systems
4
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/gen-ai/README.md
5
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/gen-ai/gen-ai-events.md
6
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/gen-ai/gen-ai-spans.md
7
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/gen-ai/gen-ai-agent-spans.md
8
+ * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/non-normative/examples-llm-calls/
9
+ * @see https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/
10
+ */
11
+ import type { AnyExportedSpan, UsageStats } from '@mastra/core/observability';
12
+ import type { Attributes } from '@opentelemetry/api';
13
+ import { ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS } from '@opentelemetry/semantic-conventions/incubating';
14
+ /**
15
+ * Token usage attributes following OTel GenAI semantic conventions.
16
+ * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/
17
+ */
18
+ export interface OtelUsageMetrics {
19
+ [ATTR_GEN_AI_USAGE_INPUT_TOKENS]?: number;
20
+ [ATTR_GEN_AI_USAGE_OUTPUT_TOKENS]?: number;
21
+ 'gen_ai.usage.reasoning_tokens'?: number;
22
+ 'gen_ai.usage.cached_input_tokens'?: number;
23
+ 'gen_ai.usage.cache_write_tokens'?: number;
24
+ 'gen_ai.usage.audio_input_tokens'?: number;
25
+ 'gen_ai.usage.audio_output_tokens'?: number;
26
+ }
27
+ /**
28
+ * Formats UsageStats to OTel GenAI semantic convention attributes.
29
+ */
30
+ export declare function formatUsageMetrics(usage?: UsageStats): OtelUsageMetrics;
31
+ /**
32
+ * Get an OTEL-compliant span name based on span type and attributes
33
+ */
34
+ export declare function getSpanName(span: AnyExportedSpan): string;
35
+ /**
36
+ * Gets OpenTelemetry attributes from Mastra Span
37
+ * Following OTEL Semantic Conventions for GenAI
38
+ */
39
+ export declare function getAttributes(span: AnyExportedSpan): Attributes;
40
+ //# sourceMappingURL=gen-ai-semantics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gen-ai-semantics.d.ts","sourceRoot":"","sources":["../src/gen-ai-semantics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAEV,eAAe,EAIf,UAAU,EACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAgBL,8BAA8B,EAC9B,+BAA+B,EAYhC,MAAM,gDAAgD,CAAC;AAGxD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,8BAA8B,CAAC,CAAC,EAAE,MAAM,CAAC;IAC1C,CAAC,+BAA+B,CAAC,CAAC,EAAE,MAAM,CAAC;IAC3C,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,kCAAkC,CAAC,EAAE,MAAM,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAqCvE;AAuCD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAUzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU,CA+K/D"}