@mastra/observability 1.6.0-alpha.2 → 1.6.0
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/CHANGELOG.md +43 -0
- package/dist/context/logger.d.ts +4 -0
- package/dist/context/logger.d.ts.map +1 -1
- package/dist/context/metrics.d.ts +6 -0
- package/dist/context/metrics.d.ts.map +1 -1
- package/dist/default.d.ts +14 -1
- package/dist/default.d.ts.map +1 -1
- package/dist/index.cjs +468 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +468 -46
- package/dist/index.js.map +1 -1
- package/dist/instances/base.d.ts +5 -0
- package/dist/instances/base.d.ts.map +1 -1
- package/dist/recorded.d.ts +43 -0
- package/dist/recorded.d.ts.map +1 -0
- package/package.json +6 -6
package/dist/instances/base.d.ts
CHANGED
|
@@ -114,6 +114,11 @@ export declare abstract class BaseObservabilityInstance extends MastraBase imple
|
|
|
114
114
|
* and for tracing events triggers auto-extracted metrics.
|
|
115
115
|
*/
|
|
116
116
|
protected emitObservabilityEvent(event: ObservabilityEvent): void;
|
|
117
|
+
/**
|
|
118
|
+
* Internal hook used by RecordedTrace/RecordedSpan hydration to route
|
|
119
|
+
* non-tracing annotation events back through the normal exporter pipeline.
|
|
120
|
+
*/
|
|
121
|
+
__emitRecordedEvent(event: ObservabilityEvent): void;
|
|
117
122
|
/**
|
|
118
123
|
* Automatically wires up Observability lifecycle events for any span
|
|
119
124
|
* This ensures all spans emit events regardless of implementation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/instances/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EACV,IAAI,E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AQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBhC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AnyRecordedSpan, FeedbackEvent, FeedbackInput, RecordedTrace, ScoreEvent, ScoreInput } from '@mastra/core/observability';
|
|
2
|
+
import type { GetTraceResponse, SpanRecord } from '@mastra/core/storage';
|
|
3
|
+
type RecordedAnnotationEvent = ScoreEvent | FeedbackEvent;
|
|
4
|
+
type EmitRecordedEvent = (event: RecordedAnnotationEvent) => void | Promise<void>;
|
|
5
|
+
type CanEmitRecordedEvent = () => boolean;
|
|
6
|
+
type DebugRecordedAnnotationUnavailable = (args: {
|
|
7
|
+
kind: 'score' | 'feedback';
|
|
8
|
+
traceId: string;
|
|
9
|
+
spanId?: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
type CorrelationParent = Pick<SpanRecord, 'entityType' | 'entityId' | 'entityName'> | AnyRecordedSpan | undefined;
|
|
12
|
+
export declare function buildRecordedScoreEvent(args: {
|
|
13
|
+
span: SpanRecord;
|
|
14
|
+
rootSpan: SpanRecord;
|
|
15
|
+
parent?: CorrelationParent;
|
|
16
|
+
score: ScoreInput;
|
|
17
|
+
spanId?: string;
|
|
18
|
+
}): ScoreEvent;
|
|
19
|
+
export declare function buildRecordedFeedbackEvent(args: {
|
|
20
|
+
span: SpanRecord;
|
|
21
|
+
rootSpan: SpanRecord;
|
|
22
|
+
parent?: CorrelationParent;
|
|
23
|
+
feedback: FeedbackInput;
|
|
24
|
+
spanId?: string;
|
|
25
|
+
}): FeedbackEvent;
|
|
26
|
+
export declare function buildRecordedScoreEventFromTrace(args: {
|
|
27
|
+
trace: GetTraceResponse;
|
|
28
|
+
score: ScoreInput;
|
|
29
|
+
spanId?: string;
|
|
30
|
+
}): ScoreEvent | null;
|
|
31
|
+
export declare function buildRecordedFeedbackEventFromTrace(args: {
|
|
32
|
+
trace: GetTraceResponse;
|
|
33
|
+
feedback: FeedbackInput;
|
|
34
|
+
spanId?: string;
|
|
35
|
+
}): FeedbackEvent | null;
|
|
36
|
+
export declare function hydrateRecordedTrace(args: {
|
|
37
|
+
trace: GetTraceResponse;
|
|
38
|
+
emitRecordedEvent: EmitRecordedEvent;
|
|
39
|
+
canEmitRecordedEvent?: CanEmitRecordedEvent;
|
|
40
|
+
debugRecordedAnnotationUnavailable?: DebugRecordedAnnotationUnavailable;
|
|
41
|
+
}): RecordedTrace | null;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=recorded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recorded.d.ts","sourceRoot":"","sources":["../src/recorded.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,aAAa,EACb,aAAa,EAEb,aAAa,EACb,UAAU,EACV,UAAU,EAGX,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEzE,KAAK,uBAAuB,GAAG,UAAU,GAAG,aAAa,CAAC;AAC1D,KAAK,iBAAiB,GAAG,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAClF,KAAK,oBAAoB,GAAG,MAAM,OAAO,CAAC;AAC1C,KAAK,kCAAkC,GAAG,CAAC,IAAI,EAAE;IAC/C,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAK,IAAI,CAAC;AAEX,KAAK,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC,GAAG,eAAe,GAAG,SAAS,CAAC;AAgElH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,UAAU,CAqBb;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,aAAa,CAsBhB;AAOD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE;IACrD,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,UAAU,GAAG,IAAI,CAgBpB;AAED,wBAAgB,mCAAmC,CAAC,IAAI,EAAE;IACxD,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,aAAa,GAAG,IAAI,CAgBvB;AAkLD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,KAAK,EAAE,gBAAgB,CAAC;IACxB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,kCAAkC,CAAC,EAAE,kCAAkC,CAAC;CACzE,GAAG,aAAa,GAAG,IAAI,CAgDvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/observability",
|
|
3
|
-
"version": "1.6.0
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Core observability package for Mastra - includes tracing and scoring features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"typescript": "^5.9.3",
|
|
33
33
|
"vitest": "4.0.18",
|
|
34
34
|
"zod": "^4.3.6",
|
|
35
|
-
"@internal/ai-sdk-
|
|
36
|
-
"@internal/
|
|
37
|
-
"@internal/
|
|
38
|
-
"@internal/types-builder": "0.0.
|
|
39
|
-
"@mastra/core": "1.18.0
|
|
35
|
+
"@internal/ai-sdk-v4": "0.0.22",
|
|
36
|
+
"@internal/lint": "0.0.75",
|
|
37
|
+
"@internal/ai-sdk-v5": "0.0.22",
|
|
38
|
+
"@internal/types-builder": "0.0.50",
|
|
39
|
+
"@mastra/core": "1.18.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@mastra/core": ">=1.16.0-0 <2.0.0-0"
|