@mastra/observability 0.0.0-remove-unused-model-providers-api-20251030210744 → 0.0.0-scorers-logs-20251208093427
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 +189 -3
- package/README.md +99 -0
- package/dist/config.d.ts +445 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/default.d.ts +29 -0
- package/dist/default.d.ts.map +1 -0
- package/dist/exporters/base.d.ts +111 -0
- package/dist/exporters/base.d.ts.map +1 -0
- package/dist/exporters/cloud.d.ts +30 -0
- package/dist/exporters/cloud.d.ts.map +1 -0
- package/dist/exporters/console.d.ts +10 -0
- package/dist/exporters/console.d.ts.map +1 -0
- package/dist/exporters/default.d.ts +89 -0
- package/dist/exporters/default.d.ts.map +1 -0
- package/dist/exporters/index.d.ts +10 -0
- package/dist/exporters/index.d.ts.map +1 -0
- package/dist/exporters/test.d.ts +13 -0
- package/dist/exporters/test.d.ts.map +1 -0
- package/dist/index.cjs +2460 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2439 -0
- package/dist/index.js.map +1 -1
- package/dist/instances/base.d.ts +110 -0
- package/dist/instances/base.d.ts.map +1 -0
- package/dist/instances/default.d.ts +8 -0
- package/dist/instances/default.d.ts.map +1 -0
- package/dist/instances/index.d.ts +6 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/model-tracing.d.ts +42 -0
- package/dist/model-tracing.d.ts.map +1 -0
- package/dist/registry.d.ts +49 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/span_processors/index.d.ts +5 -0
- package/dist/span_processors/index.d.ts.map +1 -0
- package/dist/span_processors/sensitive-data-filter.d.ts +92 -0
- package/dist/span_processors/sensitive-data-filter.d.ts.map +1 -0
- package/dist/spans/base.d.ts +110 -0
- package/dist/spans/base.d.ts.map +1 -0
- package/dist/spans/default.d.ts +13 -0
- package/dist/spans/default.d.ts.map +1 -0
- package/dist/spans/index.d.ts +7 -0
- package/dist/spans/index.d.ts.map +1 -0
- package/dist/spans/no-op.d.ts +15 -0
- package/dist/spans/no-op.d.ts.map +1 -0
- package/dist/tracing-options.d.ts +27 -0
- package/dist/tracing-options.d.ts.map +1 -0
- package/package.json +18 -9
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for Mastra Observability
|
|
3
|
+
*
|
|
4
|
+
* These types define the configuration structure for observability,
|
|
5
|
+
* including tracing configs, sampling strategies, and registry setup.
|
|
6
|
+
*/
|
|
7
|
+
import type { RequestContext } from '@mastra/core/di';
|
|
8
|
+
import type { ObservabilityInstance, ObservabilityExporter, ObservabilityBridge, SpanOutputProcessor, ConfigSelector } from '@mastra/core/observability';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Sampling strategy types
|
|
12
|
+
*/
|
|
13
|
+
export declare enum SamplingStrategyType {
|
|
14
|
+
ALWAYS = "always",
|
|
15
|
+
NEVER = "never",
|
|
16
|
+
RATIO = "ratio",
|
|
17
|
+
CUSTOM = "custom"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options passed when using a custom sampler strategy
|
|
21
|
+
*/
|
|
22
|
+
export interface CustomSamplerOptions {
|
|
23
|
+
requestContext?: RequestContext;
|
|
24
|
+
metadata?: Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sampling strategy configuration
|
|
28
|
+
*/
|
|
29
|
+
export type SamplingStrategy = {
|
|
30
|
+
type: SamplingStrategyType.ALWAYS;
|
|
31
|
+
} | {
|
|
32
|
+
type: SamplingStrategyType.NEVER;
|
|
33
|
+
} | {
|
|
34
|
+
type: SamplingStrategyType.RATIO;
|
|
35
|
+
probability: number;
|
|
36
|
+
} | {
|
|
37
|
+
type: SamplingStrategyType.CUSTOM;
|
|
38
|
+
sampler: (options?: CustomSamplerOptions) => boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Configuration for a single observability instance
|
|
42
|
+
*/
|
|
43
|
+
export interface ObservabilityInstanceConfig {
|
|
44
|
+
/** Unique identifier for this config in the tracing registry */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Service name for tracing */
|
|
47
|
+
serviceName: string;
|
|
48
|
+
/** Sampling strategy - controls whether tracing is collected (defaults to ALWAYS) */
|
|
49
|
+
sampling?: SamplingStrategy;
|
|
50
|
+
/** Custom exporters */
|
|
51
|
+
exporters?: ObservabilityExporter[];
|
|
52
|
+
/** Observability bridge (e.g., OpenTelemetry bridge for context extraction) */
|
|
53
|
+
bridge?: ObservabilityBridge;
|
|
54
|
+
/** Custom span output processors */
|
|
55
|
+
spanOutputProcessors?: SpanOutputProcessor[];
|
|
56
|
+
/** Set to `true` if you want to see spans internal to the operation of mastra */
|
|
57
|
+
includeInternalSpans?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* RequestContext keys to automatically extract as metadata for all spans
|
|
60
|
+
* created with this tracing configuration.
|
|
61
|
+
* Supports dot notation for nested values.
|
|
62
|
+
*/
|
|
63
|
+
requestContextKeys?: string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Complete Observability registry configuration
|
|
67
|
+
*/
|
|
68
|
+
export interface ObservabilityRegistryConfig {
|
|
69
|
+
/** Enables default exporters, with sampling: always, and sensitive data filtering */
|
|
70
|
+
default?: {
|
|
71
|
+
enabled?: boolean;
|
|
72
|
+
};
|
|
73
|
+
/** Map of tracing instance names to their configurations or pre-instantiated instances */
|
|
74
|
+
configs?: Record<string, Omit<ObservabilityInstanceConfig, 'name'> | ObservabilityInstance>;
|
|
75
|
+
/** Optional selector function to choose which tracing instance to use */
|
|
76
|
+
configSelector?: ConfigSelector;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Zod schema for SamplingStrategy
|
|
80
|
+
*/
|
|
81
|
+
export declare const samplingStrategySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
82
|
+
type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
type: SamplingStrategyType.ALWAYS;
|
|
85
|
+
}, {
|
|
86
|
+
type: SamplingStrategyType.ALWAYS;
|
|
87
|
+
}>, z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<SamplingStrategyType.NEVER>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
type: SamplingStrategyType.NEVER;
|
|
91
|
+
}, {
|
|
92
|
+
type: SamplingStrategyType.NEVER;
|
|
93
|
+
}>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<SamplingStrategyType.RATIO>;
|
|
95
|
+
probability: z.ZodNumber;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
type: SamplingStrategyType.RATIO;
|
|
98
|
+
probability: number;
|
|
99
|
+
}, {
|
|
100
|
+
type: SamplingStrategyType.RATIO;
|
|
101
|
+
probability: number;
|
|
102
|
+
}>, z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<SamplingStrategyType.CUSTOM>;
|
|
104
|
+
sampler: z.ZodFunction<z.ZodTuple<[z.ZodOptional<z.ZodAny>], z.ZodUnknown>, z.ZodBoolean>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
type: SamplingStrategyType.CUSTOM;
|
|
107
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
108
|
+
}, {
|
|
109
|
+
type: SamplingStrategyType.CUSTOM;
|
|
110
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
111
|
+
}>]>;
|
|
112
|
+
/**
|
|
113
|
+
* Zod schema for ObservabilityInstanceConfig
|
|
114
|
+
* Note: exporters, spanOutputProcessors, bridge, and configSelector are validated as any
|
|
115
|
+
* since they're complex runtime objects
|
|
116
|
+
*/
|
|
117
|
+
export declare const observabilityInstanceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
serviceName: z.ZodString;
|
|
120
|
+
sampling: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
121
|
+
type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
type: SamplingStrategyType.ALWAYS;
|
|
124
|
+
}, {
|
|
125
|
+
type: SamplingStrategyType.ALWAYS;
|
|
126
|
+
}>, z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<SamplingStrategyType.NEVER>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
type: SamplingStrategyType.NEVER;
|
|
130
|
+
}, {
|
|
131
|
+
type: SamplingStrategyType.NEVER;
|
|
132
|
+
}>, z.ZodObject<{
|
|
133
|
+
type: z.ZodLiteral<SamplingStrategyType.RATIO>;
|
|
134
|
+
probability: z.ZodNumber;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
type: SamplingStrategyType.RATIO;
|
|
137
|
+
probability: number;
|
|
138
|
+
}, {
|
|
139
|
+
type: SamplingStrategyType.RATIO;
|
|
140
|
+
probability: number;
|
|
141
|
+
}>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<SamplingStrategyType.CUSTOM>;
|
|
143
|
+
sampler: z.ZodFunction<z.ZodTuple<[z.ZodOptional<z.ZodAny>], z.ZodUnknown>, z.ZodBoolean>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
type: SamplingStrategyType.CUSTOM;
|
|
146
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
147
|
+
}, {
|
|
148
|
+
type: SamplingStrategyType.CUSTOM;
|
|
149
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
150
|
+
}>]>>;
|
|
151
|
+
exporters: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
152
|
+
bridge: z.ZodOptional<z.ZodAny>;
|
|
153
|
+
spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
154
|
+
includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
+
requestContextKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
name: string;
|
|
158
|
+
serviceName: string;
|
|
159
|
+
sampling?: {
|
|
160
|
+
type: SamplingStrategyType.ALWAYS;
|
|
161
|
+
} | {
|
|
162
|
+
type: SamplingStrategyType.NEVER;
|
|
163
|
+
} | {
|
|
164
|
+
type: SamplingStrategyType.RATIO;
|
|
165
|
+
probability: number;
|
|
166
|
+
} | {
|
|
167
|
+
type: SamplingStrategyType.CUSTOM;
|
|
168
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
169
|
+
} | undefined;
|
|
170
|
+
exporters?: any[] | undefined;
|
|
171
|
+
bridge?: any;
|
|
172
|
+
spanOutputProcessors?: any[] | undefined;
|
|
173
|
+
includeInternalSpans?: boolean | undefined;
|
|
174
|
+
requestContextKeys?: string[] | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
name: string;
|
|
177
|
+
serviceName: string;
|
|
178
|
+
sampling?: {
|
|
179
|
+
type: SamplingStrategyType.ALWAYS;
|
|
180
|
+
} | {
|
|
181
|
+
type: SamplingStrategyType.NEVER;
|
|
182
|
+
} | {
|
|
183
|
+
type: SamplingStrategyType.RATIO;
|
|
184
|
+
probability: number;
|
|
185
|
+
} | {
|
|
186
|
+
type: SamplingStrategyType.CUSTOM;
|
|
187
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
188
|
+
} | undefined;
|
|
189
|
+
exporters?: any[] | undefined;
|
|
190
|
+
bridge?: any;
|
|
191
|
+
spanOutputProcessors?: any[] | undefined;
|
|
192
|
+
includeInternalSpans?: boolean | undefined;
|
|
193
|
+
requestContextKeys?: string[] | undefined;
|
|
194
|
+
}>, {
|
|
195
|
+
name: string;
|
|
196
|
+
serviceName: string;
|
|
197
|
+
sampling?: {
|
|
198
|
+
type: SamplingStrategyType.ALWAYS;
|
|
199
|
+
} | {
|
|
200
|
+
type: SamplingStrategyType.NEVER;
|
|
201
|
+
} | {
|
|
202
|
+
type: SamplingStrategyType.RATIO;
|
|
203
|
+
probability: number;
|
|
204
|
+
} | {
|
|
205
|
+
type: SamplingStrategyType.CUSTOM;
|
|
206
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
207
|
+
} | undefined;
|
|
208
|
+
exporters?: any[] | undefined;
|
|
209
|
+
bridge?: any;
|
|
210
|
+
spanOutputProcessors?: any[] | undefined;
|
|
211
|
+
includeInternalSpans?: boolean | undefined;
|
|
212
|
+
requestContextKeys?: string[] | undefined;
|
|
213
|
+
}, {
|
|
214
|
+
name: string;
|
|
215
|
+
serviceName: string;
|
|
216
|
+
sampling?: {
|
|
217
|
+
type: SamplingStrategyType.ALWAYS;
|
|
218
|
+
} | {
|
|
219
|
+
type: SamplingStrategyType.NEVER;
|
|
220
|
+
} | {
|
|
221
|
+
type: SamplingStrategyType.RATIO;
|
|
222
|
+
probability: number;
|
|
223
|
+
} | {
|
|
224
|
+
type: SamplingStrategyType.CUSTOM;
|
|
225
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
226
|
+
} | undefined;
|
|
227
|
+
exporters?: any[] | undefined;
|
|
228
|
+
bridge?: any;
|
|
229
|
+
spanOutputProcessors?: any[] | undefined;
|
|
230
|
+
includeInternalSpans?: boolean | undefined;
|
|
231
|
+
requestContextKeys?: string[] | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Zod schema for config values in the configs map
|
|
235
|
+
* This is the config object without the name field
|
|
236
|
+
*/
|
|
237
|
+
export declare const observabilityConfigValueSchema: z.ZodEffects<z.ZodObject<{
|
|
238
|
+
serviceName: z.ZodString;
|
|
239
|
+
sampling: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
240
|
+
type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
type: SamplingStrategyType.ALWAYS;
|
|
243
|
+
}, {
|
|
244
|
+
type: SamplingStrategyType.ALWAYS;
|
|
245
|
+
}>, z.ZodObject<{
|
|
246
|
+
type: z.ZodLiteral<SamplingStrategyType.NEVER>;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
type: SamplingStrategyType.NEVER;
|
|
249
|
+
}, {
|
|
250
|
+
type: SamplingStrategyType.NEVER;
|
|
251
|
+
}>, z.ZodObject<{
|
|
252
|
+
type: z.ZodLiteral<SamplingStrategyType.RATIO>;
|
|
253
|
+
probability: z.ZodNumber;
|
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
type: SamplingStrategyType.RATIO;
|
|
256
|
+
probability: number;
|
|
257
|
+
}, {
|
|
258
|
+
type: SamplingStrategyType.RATIO;
|
|
259
|
+
probability: number;
|
|
260
|
+
}>, z.ZodObject<{
|
|
261
|
+
type: z.ZodLiteral<SamplingStrategyType.CUSTOM>;
|
|
262
|
+
sampler: z.ZodFunction<z.ZodTuple<[z.ZodOptional<z.ZodAny>], z.ZodUnknown>, z.ZodBoolean>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
type: SamplingStrategyType.CUSTOM;
|
|
265
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
266
|
+
}, {
|
|
267
|
+
type: SamplingStrategyType.CUSTOM;
|
|
268
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
269
|
+
}>]>>;
|
|
270
|
+
exporters: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
271
|
+
bridge: z.ZodOptional<z.ZodAny>;
|
|
272
|
+
spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
273
|
+
includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
requestContextKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
275
|
+
}, "strip", z.ZodTypeAny, {
|
|
276
|
+
serviceName: string;
|
|
277
|
+
sampling?: {
|
|
278
|
+
type: SamplingStrategyType.ALWAYS;
|
|
279
|
+
} | {
|
|
280
|
+
type: SamplingStrategyType.NEVER;
|
|
281
|
+
} | {
|
|
282
|
+
type: SamplingStrategyType.RATIO;
|
|
283
|
+
probability: number;
|
|
284
|
+
} | {
|
|
285
|
+
type: SamplingStrategyType.CUSTOM;
|
|
286
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
287
|
+
} | undefined;
|
|
288
|
+
exporters?: any[] | undefined;
|
|
289
|
+
bridge?: any;
|
|
290
|
+
spanOutputProcessors?: any[] | undefined;
|
|
291
|
+
includeInternalSpans?: boolean | undefined;
|
|
292
|
+
requestContextKeys?: string[] | undefined;
|
|
293
|
+
}, {
|
|
294
|
+
serviceName: string;
|
|
295
|
+
sampling?: {
|
|
296
|
+
type: SamplingStrategyType.ALWAYS;
|
|
297
|
+
} | {
|
|
298
|
+
type: SamplingStrategyType.NEVER;
|
|
299
|
+
} | {
|
|
300
|
+
type: SamplingStrategyType.RATIO;
|
|
301
|
+
probability: number;
|
|
302
|
+
} | {
|
|
303
|
+
type: SamplingStrategyType.CUSTOM;
|
|
304
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
305
|
+
} | undefined;
|
|
306
|
+
exporters?: any[] | undefined;
|
|
307
|
+
bridge?: any;
|
|
308
|
+
spanOutputProcessors?: any[] | undefined;
|
|
309
|
+
includeInternalSpans?: boolean | undefined;
|
|
310
|
+
requestContextKeys?: string[] | undefined;
|
|
311
|
+
}>, {
|
|
312
|
+
serviceName: string;
|
|
313
|
+
sampling?: {
|
|
314
|
+
type: SamplingStrategyType.ALWAYS;
|
|
315
|
+
} | {
|
|
316
|
+
type: SamplingStrategyType.NEVER;
|
|
317
|
+
} | {
|
|
318
|
+
type: SamplingStrategyType.RATIO;
|
|
319
|
+
probability: number;
|
|
320
|
+
} | {
|
|
321
|
+
type: SamplingStrategyType.CUSTOM;
|
|
322
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
323
|
+
} | undefined;
|
|
324
|
+
exporters?: any[] | undefined;
|
|
325
|
+
bridge?: any;
|
|
326
|
+
spanOutputProcessors?: any[] | undefined;
|
|
327
|
+
includeInternalSpans?: boolean | undefined;
|
|
328
|
+
requestContextKeys?: string[] | undefined;
|
|
329
|
+
}, {
|
|
330
|
+
serviceName: string;
|
|
331
|
+
sampling?: {
|
|
332
|
+
type: SamplingStrategyType.ALWAYS;
|
|
333
|
+
} | {
|
|
334
|
+
type: SamplingStrategyType.NEVER;
|
|
335
|
+
} | {
|
|
336
|
+
type: SamplingStrategyType.RATIO;
|
|
337
|
+
probability: number;
|
|
338
|
+
} | {
|
|
339
|
+
type: SamplingStrategyType.CUSTOM;
|
|
340
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
341
|
+
} | undefined;
|
|
342
|
+
exporters?: any[] | undefined;
|
|
343
|
+
bridge?: any;
|
|
344
|
+
spanOutputProcessors?: any[] | undefined;
|
|
345
|
+
includeInternalSpans?: boolean | undefined;
|
|
346
|
+
requestContextKeys?: string[] | undefined;
|
|
347
|
+
}>;
|
|
348
|
+
/**
|
|
349
|
+
* Zod schema for ObservabilityRegistryConfig
|
|
350
|
+
* Note: Individual configs are validated separately in the constructor to allow for
|
|
351
|
+
* both plain config objects and pre-instantiated ObservabilityInstance objects.
|
|
352
|
+
* The schema is permissive to handle edge cases gracefully (arrays, null values).
|
|
353
|
+
*/
|
|
354
|
+
export declare const observabilityRegistryConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
355
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
356
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
enabled?: boolean | undefined;
|
|
359
|
+
}, {
|
|
360
|
+
enabled?: boolean | undefined;
|
|
361
|
+
}>>>;
|
|
362
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
363
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
364
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
365
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
366
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
}, "strip", z.ZodTypeAny, {
|
|
368
|
+
enabled?: boolean | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
enabled?: boolean | undefined;
|
|
371
|
+
}>>>;
|
|
372
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
373
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
374
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
375
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
376
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
377
|
+
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
enabled?: boolean | undefined;
|
|
379
|
+
}, {
|
|
380
|
+
enabled?: boolean | undefined;
|
|
381
|
+
}>>>;
|
|
382
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
383
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
384
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
385
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
386
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
387
|
+
}, "strip", z.ZodTypeAny, {
|
|
388
|
+
enabled?: boolean | undefined;
|
|
389
|
+
}, {
|
|
390
|
+
enabled?: boolean | undefined;
|
|
391
|
+
}>>>;
|
|
392
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
393
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
394
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
395
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
396
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
397
|
+
}, "strip", z.ZodTypeAny, {
|
|
398
|
+
enabled?: boolean | undefined;
|
|
399
|
+
}, {
|
|
400
|
+
enabled?: boolean | undefined;
|
|
401
|
+
}>>>;
|
|
402
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
403
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
404
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
405
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
406
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
407
|
+
}, "strip", z.ZodTypeAny, {
|
|
408
|
+
enabled?: boolean | undefined;
|
|
409
|
+
}, {
|
|
410
|
+
enabled?: boolean | undefined;
|
|
411
|
+
}>>>;
|
|
412
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
413
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
414
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
415
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
416
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
417
|
+
}, "strip", z.ZodTypeAny, {
|
|
418
|
+
enabled?: boolean | undefined;
|
|
419
|
+
}, {
|
|
420
|
+
enabled?: boolean | undefined;
|
|
421
|
+
}>>>;
|
|
422
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
423
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
424
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
425
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
426
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
427
|
+
}, "strip", z.ZodTypeAny, {
|
|
428
|
+
enabled?: boolean | undefined;
|
|
429
|
+
}, {
|
|
430
|
+
enabled?: boolean | undefined;
|
|
431
|
+
}>>>;
|
|
432
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
433
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
434
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
435
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
436
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
437
|
+
}, "strip", z.ZodTypeAny, {
|
|
438
|
+
enabled?: boolean | undefined;
|
|
439
|
+
}, {
|
|
440
|
+
enabled?: boolean | undefined;
|
|
441
|
+
}>>>;
|
|
442
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
443
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
444
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
445
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAA;CAAE,CAAC;AAMhG;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,uBAAuB;IACvB,SAAS,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACpC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,oCAAoC;IACpC,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C,iFAAiF;IACjF,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qFAAqF;IACrF,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,2BAA2B,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC,CAAC;IAC5F,yEAAyE;IACzE,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAMD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAejC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB3C,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBxC,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAqE3C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Mastra } from '@mastra/core';
|
|
2
|
+
import { MastraBase } from '@mastra/core/base';
|
|
3
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
4
|
+
import type { ConfigSelector, ConfigSelectorOptions, ObservabilityEntrypoint, ObservabilityInstance } from '@mastra/core/observability';
|
|
5
|
+
import type { ObservabilityRegistryConfig } from './config.js';
|
|
6
|
+
export declare class Observability extends MastraBase implements ObservabilityEntrypoint {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: ObservabilityRegistryConfig);
|
|
9
|
+
setMastraContext(options: {
|
|
10
|
+
mastra: Mastra;
|
|
11
|
+
}): void;
|
|
12
|
+
setLogger(options: {
|
|
13
|
+
logger: IMastraLogger;
|
|
14
|
+
}): void;
|
|
15
|
+
getSelectedInstance(options: ConfigSelectorOptions): ObservabilityInstance | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Registry management methods
|
|
18
|
+
*/
|
|
19
|
+
registerInstance(name: string, instance: ObservabilityInstance, isDefault?: boolean): void;
|
|
20
|
+
getInstance(name: string): ObservabilityInstance | undefined;
|
|
21
|
+
getDefaultInstance(): ObservabilityInstance | undefined;
|
|
22
|
+
listInstances(): ReadonlyMap<string, ObservabilityInstance>;
|
|
23
|
+
unregisterInstance(name: string): boolean;
|
|
24
|
+
hasInstance(name: string): boolean;
|
|
25
|
+
setConfigSelector(selector: ConfigSelector): void;
|
|
26
|
+
clear(): void;
|
|
27
|
+
shutdown(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAA+B,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAezF,qBAAa,aAAc,SAAQ,UAAW,YAAW,uBAAuB;;gBAGlE,MAAM,EAAE,2BAA2B;IAsF/C,gBAAgB,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAuBnD,SAAS,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,aAAa,CAAA;KAAE,GAAG,IAAI;IAOnD,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,SAAS;IAItF;;OAEG;IAEH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,UAAQ,GAAG,IAAI;IAIxF,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAI5D,kBAAkB,IAAI,qBAAqB,GAAG,SAAS;IAIvD,aAAa,IAAI,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAI3D,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIlC,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIjD,KAAK,IAAI,IAAI;IAIP,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Exporter for Observability
|
|
3
|
+
*
|
|
4
|
+
* Provides common functionality shared by all observability exporters:
|
|
5
|
+
* - Logger initialization with proper Mastra logger support
|
|
6
|
+
* - Disabled state management
|
|
7
|
+
* - Graceful shutdown lifecycle
|
|
8
|
+
*/
|
|
9
|
+
import { LogLevel } from '@mastra/core/logger';
|
|
10
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
11
|
+
import type { TracingEvent, ObservabilityExporter, InitExporterOptions } from '@mastra/core/observability';
|
|
12
|
+
/**
|
|
13
|
+
* Base configuration that all exporters should support
|
|
14
|
+
*/
|
|
15
|
+
export interface BaseExporterConfig {
|
|
16
|
+
/** Optional Mastra logger instance */
|
|
17
|
+
logger?: IMastraLogger;
|
|
18
|
+
/** Log level for the exporter (defaults to INFO) - accepts both enum and string */
|
|
19
|
+
logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Abstract base class for observability exporters
|
|
23
|
+
*
|
|
24
|
+
* Handles common concerns:
|
|
25
|
+
* - Logger setup with proper Mastra logger
|
|
26
|
+
* - Disabled state management
|
|
27
|
+
* - Basic lifecycle methods
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* class MyExporter extends BaseExporter {
|
|
32
|
+
* name = 'my-exporter';
|
|
33
|
+
*
|
|
34
|
+
* constructor(config: MyExporterConfig) {
|
|
35
|
+
* super(config);
|
|
36
|
+
*
|
|
37
|
+
* if (!config.apiKey) {
|
|
38
|
+
* this.setDisabled('Missing API key');
|
|
39
|
+
* return;
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* // Initialize exporter-specific logic
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* async _exportEvent(event: TracingEvent): Promise<void> {
|
|
46
|
+
* // Export logic
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
52
|
+
/** Exporter name - must be implemented by subclasses */
|
|
53
|
+
abstract name: string;
|
|
54
|
+
/** Mastra logger instance */
|
|
55
|
+
protected logger: IMastraLogger;
|
|
56
|
+
/** Whether this exporter is disabled */
|
|
57
|
+
protected isDisabled: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Initialize the base exporter with logger
|
|
60
|
+
*/
|
|
61
|
+
constructor(config?: BaseExporterConfig);
|
|
62
|
+
/**
|
|
63
|
+
* Set the logger for the exporter (called by Mastra/ObservabilityInstance during initialization)
|
|
64
|
+
*/
|
|
65
|
+
__setLogger(logger: IMastraLogger): void;
|
|
66
|
+
/**
|
|
67
|
+
* Convert string log level to LogLevel enum
|
|
68
|
+
*/
|
|
69
|
+
private resolveLogLevel;
|
|
70
|
+
/**
|
|
71
|
+
* Mark the exporter as disabled and log a message
|
|
72
|
+
*
|
|
73
|
+
* @param reason - Reason why the exporter is disabled
|
|
74
|
+
*/
|
|
75
|
+
protected setDisabled(reason: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Export a tracing event
|
|
78
|
+
*
|
|
79
|
+
* This method checks if the exporter is disabled before calling _exportEvent.
|
|
80
|
+
* Subclasses should implement _exportEvent instead of overriding this method.
|
|
81
|
+
*/
|
|
82
|
+
exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Export a tracing event - must be implemented by subclasses
|
|
85
|
+
*
|
|
86
|
+
* This method is called by exportTracingEvent after checking if the exporter is disabled.
|
|
87
|
+
*/
|
|
88
|
+
protected abstract _exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Optional initialization hook called after Mastra is fully configured
|
|
91
|
+
*/
|
|
92
|
+
init?(_options: InitExporterOptions): void;
|
|
93
|
+
/**
|
|
94
|
+
* Optional method to add scores to traces
|
|
95
|
+
*/
|
|
96
|
+
addScoreToTrace?(_args: {
|
|
97
|
+
traceId: string;
|
|
98
|
+
spanId?: string;
|
|
99
|
+
score: number;
|
|
100
|
+
reason?: string;
|
|
101
|
+
scorerName: string;
|
|
102
|
+
metadata?: Record<string, any>;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Shutdown the exporter and clean up resources
|
|
106
|
+
*
|
|
107
|
+
* Default implementation just logs. Override to add custom cleanup.
|
|
108
|
+
*/
|
|
109
|
+
shutdown(): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/exporters/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAE3G;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,8BAAsB,YAAa,YAAW,qBAAqB;IACjE,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;IAEhC,wCAAwC;IACxC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAS;IAEtC;;OAEG;gBACS,MAAM,GAAE,kBAAuB;IAO3C;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAMxC;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK3C;;;;;OAKG;IACG,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1E;;OAEG;IACH,IAAI,CAAC,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAE1C;;OAEG;IACH,eAAe,CAAC,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAChC,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjB;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TracingEvent } from '@mastra/core/observability';
|
|
2
|
+
import { BaseExporter } from './base.js';
|
|
3
|
+
import type { BaseExporterConfig } from './base.js';
|
|
4
|
+
export interface CloudExporterConfig extends BaseExporterConfig {
|
|
5
|
+
maxBatchSize?: number;
|
|
6
|
+
maxBatchWaitMs?: number;
|
|
7
|
+
maxRetries?: number;
|
|
8
|
+
accessToken?: string;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class CloudExporter extends BaseExporter {
|
|
12
|
+
name: string;
|
|
13
|
+
private config;
|
|
14
|
+
private buffer;
|
|
15
|
+
private flushTimer;
|
|
16
|
+
constructor(config?: CloudExporterConfig);
|
|
17
|
+
protected _exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
18
|
+
private addToBuffer;
|
|
19
|
+
private formatSpan;
|
|
20
|
+
private shouldFlush;
|
|
21
|
+
private scheduleFlush;
|
|
22
|
+
private flush;
|
|
23
|
+
/**
|
|
24
|
+
* Uploads spans to cloud API using fetchWithRetry for all retry logic
|
|
25
|
+
*/
|
|
26
|
+
private batchUpload;
|
|
27
|
+
private resetBuffer;
|
|
28
|
+
shutdown(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cloud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA0BD,qBAAa,aAAc,SAAQ,YAAY;IAC7C,IAAI,SAAyC;IAE7C,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAA+B;gBAErC,MAAM,GAAE,mBAAwB;cA8B5B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvE,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;YAoBP,KAAK;IA8CnB;;OAEG;YACW,WAAW;IAezB,OAAO,CAAC,WAAW;IAMb,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAuChC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TracingEvent } from '@mastra/core/observability';
|
|
2
|
+
import { BaseExporter } from './base.js';
|
|
3
|
+
import type { BaseExporterConfig } from './base.js';
|
|
4
|
+
export declare class ConsoleExporter extends BaseExporter {
|
|
5
|
+
name: string;
|
|
6
|
+
constructor(config?: BaseExporterConfig);
|
|
7
|
+
protected _exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
8
|
+
shutdown(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/exporters/console.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,IAAI,SAA8B;gBAEtB,MAAM,GAAE,kBAAuB;cAI3B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA+EjE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|