@mastra/observability 1.0.0-beta.11 → 1.0.0-beta.12
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 +46 -0
- package/dist/exporters/base.d.ts +42 -3
- package/dist/exporters/base.d.ts.map +1 -1
- package/dist/exporters/cloud.d.ts +1 -1
- package/dist/exporters/cloud.d.ts.map +1 -1
- package/dist/exporters/index.d.ts +1 -0
- package/dist/exporters/index.d.ts.map +1 -1
- package/dist/exporters/span-formatters.d.ts +35 -0
- package/dist/exporters/span-formatters.d.ts.map +1 -0
- package/dist/exporters/tracking.d.ts +4 -0
- package/dist/exporters/tracking.d.ts.map +1 -1
- package/dist/index.cjs +60 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @mastra/observability
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added `customSpanFormatter` option to exporters for per-exporter span transformation. This allows different formatting per exporter and supports both synchronous and asynchronous operations, including async data enrichment. ([#11985](https://github.com/mastra-ai/mastra/pull/11985))
|
|
8
|
+
|
|
9
|
+
**Configuration example:**
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { DefaultExporter } from '@mastra/observability';
|
|
13
|
+
import { SpanType } from '@mastra/core/observability';
|
|
14
|
+
import type { CustomSpanFormatter } from '@mastra/core/observability';
|
|
15
|
+
|
|
16
|
+
// Sync formatter
|
|
17
|
+
const plainTextFormatter: CustomSpanFormatter = span => {
|
|
18
|
+
if (span.type === SpanType.AGENT_RUN && Array.isArray(span.input)) {
|
|
19
|
+
const userMessage = span.input.find(m => m.role === 'user');
|
|
20
|
+
return { ...span, input: userMessage?.content ?? span.input };
|
|
21
|
+
}
|
|
22
|
+
return span;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Async formatter for data enrichment
|
|
26
|
+
const enrichmentFormatter: CustomSpanFormatter = async span => {
|
|
27
|
+
const userData = await fetchUserData(span.metadata?.userId);
|
|
28
|
+
return { ...span, metadata: { ...span.metadata, userName: userData.name } };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const exporter = new DefaultExporter({
|
|
32
|
+
customSpanFormatter: plainTextFormatter,
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Also added `chainFormatters` utility to combine multiple formatters (supports mixed sync/async):
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { chainFormatters } from '@mastra/observability';
|
|
40
|
+
|
|
41
|
+
const exporter = new BraintrustExporter({
|
|
42
|
+
customSpanFormatter: chainFormatters([syncFormatter, asyncFormatter]),
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [[`c8417b4`](https://github.com/mastra-ai/mastra/commit/c8417b41d9f3486854dc7842d977fbe5e2166264), [`dd4f34c`](https://github.com/mastra-ai/mastra/commit/dd4f34c78cbae24063463475b0619575c415f9b8)]:
|
|
47
|
+
- @mastra/core@1.0.0-beta.23
|
|
48
|
+
|
|
3
49
|
## 1.0.0-beta.11
|
|
4
50
|
|
|
5
51
|
### Major Changes
|
package/dist/exporters/base.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { LogLevel } from '@mastra/core/logger';
|
|
10
10
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
11
|
-
import type { TracingEvent, ObservabilityExporter, InitExporterOptions } from '@mastra/core/observability';
|
|
11
|
+
import type { TracingEvent, ObservabilityExporter, InitExporterOptions, CustomSpanFormatter } from '@mastra/core/observability';
|
|
12
12
|
/**
|
|
13
13
|
* Base configuration that all exporters should support
|
|
14
14
|
*/
|
|
@@ -17,6 +17,31 @@ export interface BaseExporterConfig {
|
|
|
17
17
|
logger?: IMastraLogger;
|
|
18
18
|
/** Log level for the exporter (defaults to INFO) - accepts both enum and string */
|
|
19
19
|
logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error';
|
|
20
|
+
/**
|
|
21
|
+
* Custom span formatter function to transform exported spans before they are
|
|
22
|
+
* processed by the exporter. This allows customization of how spans appear
|
|
23
|
+
* in vendor-specific observability platforms.
|
|
24
|
+
*
|
|
25
|
+
* Use cases:
|
|
26
|
+
* - Extract plain text from structured AI SDK messages for better readability
|
|
27
|
+
* - Transform input/output format for specific vendor requirements
|
|
28
|
+
* - Add or remove fields based on the target platform
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const exporter = new BraintrustExporter({
|
|
33
|
+
* customSpanFormatter: (span) => {
|
|
34
|
+
* // Extract plain text user message for AGENT_RUN spans
|
|
35
|
+
* if (span.type === SpanType.AGENT_RUN && Array.isArray(span.input)) {
|
|
36
|
+
* const userMsg = span.input.find(m => m.role === 'user');
|
|
37
|
+
* return { ...span, input: userMsg?.content ?? span.input };
|
|
38
|
+
* }
|
|
39
|
+
* return span;
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
customSpanFormatter?: CustomSpanFormatter;
|
|
20
45
|
}
|
|
21
46
|
/**
|
|
22
47
|
* Abstract base class for observability exporters
|
|
@@ -54,6 +79,8 @@ export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
|
54
79
|
abstract name: string;
|
|
55
80
|
/** Mastra logger instance */
|
|
56
81
|
protected logger: IMastraLogger;
|
|
82
|
+
/** Base configuration (accessible by subclasses) */
|
|
83
|
+
protected readonly baseConfig: BaseExporterConfig;
|
|
57
84
|
/** Public getter for disabled state */
|
|
58
85
|
get isDisabled(): boolean;
|
|
59
86
|
/**
|
|
@@ -74,11 +101,23 @@ export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
|
74
101
|
* @param reason - Reason why the exporter is disabled
|
|
75
102
|
*/
|
|
76
103
|
protected setDisabled(reason: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Apply the customSpanFormatter if configured.
|
|
106
|
+
* This is called automatically by exportTracingEvent before _exportTracingEvent.
|
|
107
|
+
*
|
|
108
|
+
* Supports both synchronous and asynchronous formatters. If the formatter
|
|
109
|
+
* returns a Promise, it will be awaited.
|
|
110
|
+
*
|
|
111
|
+
* @param event - The incoming tracing event
|
|
112
|
+
* @returns The (possibly modified) event to process
|
|
113
|
+
*/
|
|
114
|
+
protected applySpanFormatter(event: TracingEvent): Promise<TracingEvent>;
|
|
77
115
|
/**
|
|
78
116
|
* Export a tracing event
|
|
79
117
|
*
|
|
80
|
-
* This method checks if the exporter is disabled
|
|
81
|
-
*
|
|
118
|
+
* This method checks if the exporter is disabled, applies the customSpanFormatter,
|
|
119
|
+
* then calls _exportTracingEvent.
|
|
120
|
+
* Subclasses should implement _exportTracingEvent instead of overriding this method.
|
|
82
121
|
*/
|
|
83
122
|
exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
84
123
|
/**
|
|
@@ -1 +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,
|
|
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,EACV,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC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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"}
|
|
@@ -10,7 +10,7 @@ export interface CloudExporterConfig extends BaseExporterConfig {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class CloudExporter extends BaseExporter {
|
|
12
12
|
name: string;
|
|
13
|
-
private
|
|
13
|
+
private cloudConfig;
|
|
14
14
|
private buffer;
|
|
15
15
|
private flushTimer;
|
|
16
16
|
constructor(config?: CloudExporterConfig);
|
|
@@ -1 +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;
|
|
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;AAgCD,qBAAa,aAAc,SAAQ,YAAY;IAC7C,IAAI,SAAyC;IAE7C,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAA+B;gBAErC,MAAM,GAAE,mBAAwB;cA2B5B,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exporters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exporters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAG3B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with custom span formatters.
|
|
3
|
+
*/
|
|
4
|
+
import type { CustomSpanFormatter } from '@mastra/core/observability';
|
|
5
|
+
/**
|
|
6
|
+
* Chains multiple span formatters into a single formatter.
|
|
7
|
+
*
|
|
8
|
+
* Formatters are applied in order, with each receiving the output of the previous.
|
|
9
|
+
* Supports both synchronous and asynchronous formatters - if any formatter returns
|
|
10
|
+
* a Promise, the entire chain will return a Promise.
|
|
11
|
+
*
|
|
12
|
+
* @param formatters - Array of formatters to chain (can be sync or async)
|
|
13
|
+
* @returns A single formatter that applies all formatters in sequence
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Chain sync formatters
|
|
18
|
+
* const chainedFormatter = chainFormatters([
|
|
19
|
+
* myPlainTextFormatter,
|
|
20
|
+
* myRedactionFormatter,
|
|
21
|
+
* ]);
|
|
22
|
+
*
|
|
23
|
+
* // Chain mixed sync and async formatters
|
|
24
|
+
* const asyncChainedFormatter = chainFormatters([
|
|
25
|
+
* myPlainTextFormatter, // sync
|
|
26
|
+
* myAsyncEnrichmentFormatter, // async
|
|
27
|
+
* ]);
|
|
28
|
+
*
|
|
29
|
+
* const exporter = new BraintrustExporter({
|
|
30
|
+
* customSpanFormatter: chainedFormatter,
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function chainFormatters(formatters: CustomSpanFormatter[]): CustomSpanFormatter;
|
|
35
|
+
//# sourceMappingURL=span-formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-formatters.d.ts","sourceRoot":"","sources":["../../src/exporters/span-formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAmB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,CAQtF"}
|
|
@@ -314,6 +314,10 @@ export declare abstract class TrackingExporter<TRootData, TSpanData, TEventData,
|
|
|
314
314
|
/**
|
|
315
315
|
* Hook called before processing each tracing event.
|
|
316
316
|
* Override to transform or enrich the event before processing.
|
|
317
|
+
*
|
|
318
|
+
* Note: The customSpanFormatter is applied at the BaseExporter level before this hook.
|
|
319
|
+
* Subclasses can override this to add additional pre-processing logic.
|
|
320
|
+
*
|
|
317
321
|
* @param event - The incoming tracing event
|
|
318
322
|
* @returns The (possibly modified) event to process
|
|
319
323
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.d.ts","sourceRoot":"","sources":["../../src/exporters/tracking.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,KAAK,EAAE,YAAY,CAAC;IACpB,wEAAwE;IACxE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,QAAQ,EAAE,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,mBAAmB,CAAC,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O,CAAC,SAAS;cAoBD,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA0JvE;;;;;;;OAOG;IACH,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE;QAC3B,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC;IAsB1D;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,MAAM;IAQhC;;;OAGG;cACa,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7C;;;OAGG;cACa,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9C;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAkDhC"}
|
package/dist/index.cjs
CHANGED
|
@@ -4163,6 +4163,8 @@ var observabilityRegistryConfigSchema = external_exports.object({
|
|
|
4163
4163
|
var BaseExporter = class {
|
|
4164
4164
|
/** Mastra logger instance */
|
|
4165
4165
|
logger;
|
|
4166
|
+
/** Base configuration (accessible by subclasses) */
|
|
4167
|
+
baseConfig;
|
|
4166
4168
|
/** Whether this exporter is disabled */
|
|
4167
4169
|
#disabled = false;
|
|
4168
4170
|
/** Public getter for disabled state */
|
|
@@ -4173,6 +4175,7 @@ var BaseExporter = class {
|
|
|
4173
4175
|
* Initialize the base exporter with logger
|
|
4174
4176
|
*/
|
|
4175
4177
|
constructor(config = {}) {
|
|
4178
|
+
this.baseConfig = config;
|
|
4176
4179
|
const logLevel = this.resolveLogLevel(config.logLevel);
|
|
4177
4180
|
this.logger = config.logger ?? new logger.ConsoleLogger({ level: logLevel, name: this.constructor.name });
|
|
4178
4181
|
}
|
|
@@ -4210,17 +4213,47 @@ var BaseExporter = class {
|
|
|
4210
4213
|
this.#disabled = true;
|
|
4211
4214
|
this.logger.warn(`${this.name} disabled: ${reason}`);
|
|
4212
4215
|
}
|
|
4216
|
+
/**
|
|
4217
|
+
* Apply the customSpanFormatter if configured.
|
|
4218
|
+
* This is called automatically by exportTracingEvent before _exportTracingEvent.
|
|
4219
|
+
*
|
|
4220
|
+
* Supports both synchronous and asynchronous formatters. If the formatter
|
|
4221
|
+
* returns a Promise, it will be awaited.
|
|
4222
|
+
*
|
|
4223
|
+
* @param event - The incoming tracing event
|
|
4224
|
+
* @returns The (possibly modified) event to process
|
|
4225
|
+
*/
|
|
4226
|
+
async applySpanFormatter(event) {
|
|
4227
|
+
if (this.baseConfig.customSpanFormatter) {
|
|
4228
|
+
try {
|
|
4229
|
+
const formattedSpan = await this.baseConfig.customSpanFormatter(event.exportedSpan);
|
|
4230
|
+
return {
|
|
4231
|
+
...event,
|
|
4232
|
+
exportedSpan: formattedSpan
|
|
4233
|
+
};
|
|
4234
|
+
} catch (error) {
|
|
4235
|
+
this.logger.error(`${this.name}: Error in customSpanFormatter`, {
|
|
4236
|
+
error,
|
|
4237
|
+
spanId: event.exportedSpan.id,
|
|
4238
|
+
traceId: event.exportedSpan.traceId
|
|
4239
|
+
});
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
return event;
|
|
4243
|
+
}
|
|
4213
4244
|
/**
|
|
4214
4245
|
* Export a tracing event
|
|
4215
4246
|
*
|
|
4216
|
-
* This method checks if the exporter is disabled
|
|
4217
|
-
*
|
|
4247
|
+
* This method checks if the exporter is disabled, applies the customSpanFormatter,
|
|
4248
|
+
* then calls _exportTracingEvent.
|
|
4249
|
+
* Subclasses should implement _exportTracingEvent instead of overriding this method.
|
|
4218
4250
|
*/
|
|
4219
4251
|
async exportTracingEvent(event) {
|
|
4220
4252
|
if (this.isDisabled) {
|
|
4221
4253
|
return;
|
|
4222
4254
|
}
|
|
4223
|
-
await this.
|
|
4255
|
+
const processedEvent = await this.applySpanFormatter(event);
|
|
4256
|
+
await this._exportTracingEvent(processedEvent);
|
|
4224
4257
|
}
|
|
4225
4258
|
/**
|
|
4226
4259
|
* Shutdown the exporter and clean up resources
|
|
@@ -4892,6 +4925,10 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
4892
4925
|
/**
|
|
4893
4926
|
* Hook called before processing each tracing event.
|
|
4894
4927
|
* Override to transform or enrich the event before processing.
|
|
4928
|
+
*
|
|
4929
|
+
* Note: The customSpanFormatter is applied at the BaseExporter level before this hook.
|
|
4930
|
+
* Subclasses can override this to add additional pre-processing logic.
|
|
4931
|
+
*
|
|
4895
4932
|
* @param event - The incoming tracing event
|
|
4896
4933
|
* @returns The (possibly modified) event to process
|
|
4897
4934
|
*/
|
|
@@ -5164,9 +5201,20 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
5164
5201
|
await super.shutdown();
|
|
5165
5202
|
}
|
|
5166
5203
|
};
|
|
5204
|
+
|
|
5205
|
+
// src/exporters/span-formatters.ts
|
|
5206
|
+
function chainFormatters(formatters) {
|
|
5207
|
+
return async (span) => {
|
|
5208
|
+
let currentSpan = span;
|
|
5209
|
+
for (const formatter of formatters) {
|
|
5210
|
+
currentSpan = await formatter(currentSpan);
|
|
5211
|
+
}
|
|
5212
|
+
return currentSpan;
|
|
5213
|
+
};
|
|
5214
|
+
}
|
|
5167
5215
|
var CloudExporter = class extends BaseExporter {
|
|
5168
5216
|
name = "mastra-cloud-observability-exporter";
|
|
5169
|
-
|
|
5217
|
+
cloudConfig;
|
|
5170
5218
|
buffer;
|
|
5171
5219
|
flushTimer = null;
|
|
5172
5220
|
constructor(config = {}) {
|
|
@@ -5176,7 +5224,7 @@ var CloudExporter = class extends BaseExporter {
|
|
|
5176
5224
|
this.setDisabled("MASTRA_CLOUD_ACCESS_TOKEN environment variable not set.");
|
|
5177
5225
|
}
|
|
5178
5226
|
const endpoint = config.endpoint ?? process.env.MASTRA_CLOUD_TRACES_ENDPOINT ?? "https://api.mastra.ai/ai/spans/publish";
|
|
5179
|
-
this.
|
|
5227
|
+
this.cloudConfig = {
|
|
5180
5228
|
logger: this.logger,
|
|
5181
5229
|
logLevel: config.logLevel ?? logger.LogLevel.INFO,
|
|
5182
5230
|
maxBatchSize: config.maxBatchSize ?? 1e3,
|
|
@@ -5234,12 +5282,12 @@ var CloudExporter = class extends BaseExporter {
|
|
|
5234
5282
|
return spanRecord;
|
|
5235
5283
|
}
|
|
5236
5284
|
shouldFlush() {
|
|
5237
|
-
if (this.buffer.totalSize >= this.
|
|
5285
|
+
if (this.buffer.totalSize >= this.cloudConfig.maxBatchSize) {
|
|
5238
5286
|
return true;
|
|
5239
5287
|
}
|
|
5240
5288
|
if (this.buffer.firstEventTime && this.buffer.totalSize > 0) {
|
|
5241
5289
|
const elapsed = Date.now() - this.buffer.firstEventTime.getTime();
|
|
5242
|
-
if (elapsed >= this.
|
|
5290
|
+
if (elapsed >= this.cloudConfig.maxBatchWaitMs) {
|
|
5243
5291
|
return true;
|
|
5244
5292
|
}
|
|
5245
5293
|
}
|
|
@@ -5262,7 +5310,7 @@ var CloudExporter = class extends BaseExporter {
|
|
|
5262
5310
|
this.logger.trackException(mastraError);
|
|
5263
5311
|
this.logger.error("Scheduled flush failed", mastraError);
|
|
5264
5312
|
});
|
|
5265
|
-
}, this.
|
|
5313
|
+
}, this.cloudConfig.maxBatchWaitMs);
|
|
5266
5314
|
}
|
|
5267
5315
|
async flush() {
|
|
5268
5316
|
if (this.flushTimer) {
|
|
@@ -5274,7 +5322,7 @@ var CloudExporter = class extends BaseExporter {
|
|
|
5274
5322
|
}
|
|
5275
5323
|
const startTime = Date.now();
|
|
5276
5324
|
const spansCopy = [...this.buffer.spans];
|
|
5277
|
-
const flushReason = this.buffer.totalSize >= this.
|
|
5325
|
+
const flushReason = this.buffer.totalSize >= this.cloudConfig.maxBatchSize ? "size" : "time";
|
|
5278
5326
|
this.resetBuffer();
|
|
5279
5327
|
try {
|
|
5280
5328
|
await this.batchUpload(spansCopy);
|
|
@@ -5305,7 +5353,7 @@ var CloudExporter = class extends BaseExporter {
|
|
|
5305
5353
|
*/
|
|
5306
5354
|
async batchUpload(spans) {
|
|
5307
5355
|
const headers = {
|
|
5308
|
-
Authorization: `Bearer ${this.
|
|
5356
|
+
Authorization: `Bearer ${this.cloudConfig.accessToken}`,
|
|
5309
5357
|
"Content-Type": "application/json"
|
|
5310
5358
|
};
|
|
5311
5359
|
const options = {
|
|
@@ -5313,7 +5361,7 @@ var CloudExporter = class extends BaseExporter {
|
|
|
5313
5361
|
headers,
|
|
5314
5362
|
body: JSON.stringify({ spans })
|
|
5315
5363
|
};
|
|
5316
|
-
await utils.fetchWithRetry(this.
|
|
5364
|
+
await utils.fetchWithRetry(this.cloudConfig.endpoint, options, this.cloudConfig.maxRetries);
|
|
5317
5365
|
}
|
|
5318
5366
|
resetBuffer() {
|
|
5319
5367
|
this.buffer.spans = [];
|
|
@@ -7736,6 +7784,7 @@ exports.TestExporter = TestExporter;
|
|
|
7736
7784
|
exports.TraceData = TraceData;
|
|
7737
7785
|
exports.TrackingExporter = TrackingExporter;
|
|
7738
7786
|
exports.buildTracingOptions = buildTracingOptions;
|
|
7787
|
+
exports.chainFormatters = chainFormatters;
|
|
7739
7788
|
exports.deepClean = deepClean;
|
|
7740
7789
|
exports.getExternalParentId = getExternalParentId;
|
|
7741
7790
|
exports.mergeSerializationOptions = mergeSerializationOptions;
|