@mastra/observability 0.0.0-vnext-20251104230439 → 0.0.0-vnext-20251119160359
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 +94 -3
- package/README.md +18 -20
- package/dist/config.d.ts +343 -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 +10 -10
- package/dist/exporters/base.d.ts.map +1 -1
- package/dist/exporters/cloud.d.ts +2 -2
- package/dist/exporters/cloud.d.ts.map +1 -1
- package/dist/exporters/console.d.ts +2 -2
- package/dist/exporters/console.d.ts.map +1 -1
- package/dist/exporters/default.d.ts +10 -14
- package/dist/exporters/default.d.ts.map +1 -1
- package/dist/exporters/index.d.ts +1 -1
- package/dist/index.cjs +1786 -1649
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1774 -1632
- package/dist/index.js.map +1 -1
- package/dist/{tracers → instances}/base.d.ts +27 -26
- 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 +6 -6
- package/dist/model-tracing.d.ts.map +1 -1
- package/dist/registry.d.ts +46 -48
- package/dist/registry.d.ts.map +1 -1
- package/dist/span_processors/index.d.ts +1 -1
- package/dist/span_processors/sensitive-data-filter.d.ts +4 -4
- package/dist/span_processors/sensitive-data-filter.d.ts.map +1 -1
- package/dist/spans/base.d.ts +11 -11
- package/dist/spans/base.d.ts.map +1 -1
- package/dist/spans/default.d.ts +4 -4
- package/dist/spans/default.d.ts.map +1 -1
- package/dist/spans/index.d.ts +1 -1
- package/dist/spans/no-op.d.ts +4 -4
- package/dist/spans/no-op.d.ts.map +1 -1
- package/package.json +16 -11
- package/dist/default-entrypoint.d.ts +0 -16
- package/dist/default-entrypoint.d.ts.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/tracers/base.d.ts.map +0 -1
- package/dist/tracers/default.d.ts +0 -7
- package/dist/tracers/default.d.ts.map +0 -1
- package/dist/tracers/index.d.ts +0 -6
- package/dist/tracers/index.d.ts.map +0 -1
package/dist/exporters/base.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Base Exporter for
|
|
2
|
+
* Base Exporter for Observability
|
|
3
3
|
*
|
|
4
|
-
* Provides common functionality shared by all
|
|
4
|
+
* Provides common functionality shared by all observability exporters:
|
|
5
5
|
* - Logger initialization with proper Mastra logger support
|
|
6
6
|
* - Disabled state management
|
|
7
7
|
* - Graceful shutdown lifecycle
|
|
8
8
|
*/
|
|
9
9
|
import { LogLevel } from '@mastra/core/logger';
|
|
10
10
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
11
|
-
import type {
|
|
11
|
+
import type { TracingEvent, ObservabilityExporter, InitExporterOptions } from '@mastra/core/observability';
|
|
12
12
|
/**
|
|
13
13
|
* Base configuration that all exporters should support
|
|
14
14
|
*/
|
|
@@ -19,7 +19,7 @@ export interface BaseExporterConfig {
|
|
|
19
19
|
logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error';
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Abstract base class for
|
|
22
|
+
* Abstract base class for observability exporters
|
|
23
23
|
*
|
|
24
24
|
* Handles common concerns:
|
|
25
25
|
* - Logger setup with proper Mastra logger
|
|
@@ -42,13 +42,13 @@ export interface BaseExporterConfig {
|
|
|
42
42
|
* // Initialize exporter-specific logic
|
|
43
43
|
* }
|
|
44
44
|
*
|
|
45
|
-
* async _exportEvent(event:
|
|
45
|
+
* async _exportEvent(event: TracingEvent): Promise<void> {
|
|
46
46
|
* // Export logic
|
|
47
47
|
* }
|
|
48
48
|
* }
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export declare abstract class BaseExporter implements
|
|
51
|
+
export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
52
52
|
/** Exporter name - must be implemented by subclasses */
|
|
53
53
|
abstract name: string;
|
|
54
54
|
/** Mastra logger instance */
|
|
@@ -60,7 +60,7 @@ export declare abstract class BaseExporter implements AITracingExporter {
|
|
|
60
60
|
*/
|
|
61
61
|
constructor(config?: BaseExporterConfig);
|
|
62
62
|
/**
|
|
63
|
-
* Set the logger for the exporter (called by Mastra/
|
|
63
|
+
* Set the logger for the exporter (called by Mastra/ObservabilityInstance during initialization)
|
|
64
64
|
*/
|
|
65
65
|
__setLogger(logger: IMastraLogger): void;
|
|
66
66
|
/**
|
|
@@ -79,13 +79,13 @@ export declare abstract class BaseExporter implements AITracingExporter {
|
|
|
79
79
|
* This method checks if the exporter is disabled before calling _exportEvent.
|
|
80
80
|
* Subclasses should implement _exportEvent instead of overriding this method.
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
83
83
|
/**
|
|
84
84
|
* Export a tracing event - must be implemented by subclasses
|
|
85
85
|
*
|
|
86
|
-
* This method is called by
|
|
86
|
+
* This method is called by exportTracingEvent after checking if the exporter is disabled.
|
|
87
87
|
*/
|
|
88
|
-
protected abstract
|
|
88
|
+
protected abstract _exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
89
89
|
/**
|
|
90
90
|
* Optional initialization hook called after Mastra is fully configured
|
|
91
91
|
*/
|
|
@@ -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,EAAE,
|
|
1
|
+
{"version":3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Ae,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TracingEvent } from '@mastra/core/observability';
|
|
2
2
|
import { BaseExporter } from './base.js';
|
|
3
3
|
import type { BaseExporterConfig } from './base.js';
|
|
4
4
|
export interface CloudExporterConfig extends BaseExporterConfig {
|
|
@@ -14,7 +14,7 @@ export declare class CloudExporter extends BaseExporter {
|
|
|
14
14
|
private buffer;
|
|
15
15
|
private flushTimer;
|
|
16
16
|
constructor(config?: CloudExporterConfig);
|
|
17
|
-
protected
|
|
17
|
+
protected _exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
18
18
|
private addToBuffer;
|
|
19
19
|
private formatSpan;
|
|
20
20
|
private shouldFlush;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TracingEvent } from '@mastra/core/observability';
|
|
2
2
|
import { BaseExporter } from './base.js';
|
|
3
3
|
import type { BaseExporterConfig } from './base.js';
|
|
4
4
|
export declare class ConsoleExporter extends BaseExporter {
|
|
5
5
|
name: string;
|
|
6
6
|
constructor(config?: BaseExporterConfig);
|
|
7
|
-
protected
|
|
7
|
+
protected _exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
8
8
|
shutdown(): Promise<void>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=console.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/exporters/console.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
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"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { TracingEvent, InitExporterOptions, TracingStorageStrategy } from '@mastra/core/observability';
|
|
2
|
+
import type { BaseExporterConfig } from './base.js';
|
|
3
|
+
import { BaseExporter } from './base.js';
|
|
4
|
+
interface DefaultExporterConfig extends BaseExporterConfig {
|
|
4
5
|
maxBatchSize?: number;
|
|
5
6
|
maxBufferSize?: number;
|
|
6
7
|
maxBatchWaitMs?: number;
|
|
7
8
|
maxRetries?: number;
|
|
8
9
|
retryDelayMs?: number;
|
|
9
|
-
strategy?:
|
|
10
|
+
strategy?: TracingStorageStrategy | 'auto';
|
|
10
11
|
}
|
|
11
|
-
export declare class DefaultExporter
|
|
12
|
+
export declare class DefaultExporter extends BaseExporter {
|
|
13
|
+
#private;
|
|
12
14
|
name: string;
|
|
13
|
-
private logger;
|
|
14
|
-
private storage?;
|
|
15
|
-
private config;
|
|
16
|
-
private resolvedStrategy;
|
|
17
15
|
private buffer;
|
|
18
|
-
private flushTimer;
|
|
19
16
|
private allCreatedSpans;
|
|
20
|
-
constructor(config?:
|
|
21
|
-
private strategyInitialized;
|
|
17
|
+
constructor(config?: DefaultExporterConfig);
|
|
22
18
|
/**
|
|
23
19
|
* Initialize the exporter (called after all dependencies are ready)
|
|
24
20
|
*/
|
|
@@ -57,7 +53,7 @@ export declare class DefaultExporter implements AITracingExporter {
|
|
|
57
53
|
private scheduleFlush;
|
|
58
54
|
/**
|
|
59
55
|
* Serializes span attributes to storage record format
|
|
60
|
-
* Handles all
|
|
56
|
+
* Handles all Span types and their specific attributes
|
|
61
57
|
*/
|
|
62
58
|
private serializeAttributes;
|
|
63
59
|
private buildCreateRecord;
|
|
@@ -86,7 +82,7 @@ export declare class DefaultExporter implements AITracingExporter {
|
|
|
86
82
|
* Attempts to flush with exponential backoff retry logic
|
|
87
83
|
*/
|
|
88
84
|
private flushWithRetries;
|
|
89
|
-
|
|
85
|
+
_exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
90
86
|
shutdown(): Promise<void>;
|
|
91
87
|
}
|
|
92
88
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/exporters/default.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/exporters/default.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAEZ,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,UAAU,qBAAsB,SAAQ,kBAAkB;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;CAC5C;AAwDD,qBAAa,eAAgB,SAAQ,YAAY;;IAC/C,IAAI,SAA2C;IAK/C,OAAO,CAAC,MAAM,C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