@mastra/observability 1.12.0-alpha.2 → 1.12.0-alpha.3

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 CHANGED
@@ -1,5 +1,55 @@
1
1
  # @mastra/observability
2
2
 
3
+ ## 1.12.0-alpha.3
4
+
5
+ ### Minor Changes
6
+
7
+ - Renamed two built-in observability exporters to clearer names. The originals are still exported (now deprecated) and continue to work unchanged, including their existing exporter `name` strings and error IDs, so monitoring rules and dashboards keep matching until you migrate. ([#16223](https://github.com/mastra-ai/mastra/pull/16223))
8
+ - `CloudExporter` → `MastraPlatformExporter`
9
+ - `DefaultExporter` → `MastraStorageExporter`
10
+
11
+ **Before**
12
+
13
+ ```ts
14
+ import { Observability, DefaultExporter, CloudExporter, SensitiveDataFilter } from '@mastra/observability';
15
+
16
+ new Observability({
17
+ configs: {
18
+ default: {
19
+ serviceName: 'my-app',
20
+ exporters: [new DefaultExporter(), new CloudExporter()],
21
+ spanOutputProcessors: [new SensitiveDataFilter()],
22
+ },
23
+ },
24
+ });
25
+ ```
26
+
27
+ **After**
28
+
29
+ ```ts
30
+ import {
31
+ Observability,
32
+ MastraStorageExporter,
33
+ MastraPlatformExporter,
34
+ SensitiveDataFilter,
35
+ } from '@mastra/observability';
36
+
37
+ new Observability({
38
+ configs: {
39
+ default: {
40
+ serviceName: 'my-app',
41
+ exporters: [new MastraStorageExporter(), new MastraPlatformExporter()],
42
+ spanOutputProcessors: [new SensitiveDataFilter()],
43
+ },
44
+ },
45
+ });
46
+ ```
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [[`7ad5585`](https://github.com/mastra-ai/mastra/commit/7ad55856406f1de398dc713f6a9eaa78b2784bb6), [`210ea7a`](https://github.com/mastra-ai/mastra/commit/210ea7af559791b73a44fc9c12179908aaa3183f), [`83218c8`](https://github.com/mastra-ai/mastra/commit/83218c88b37773c9424fbe733b37be556e55e94d), [`265ec9f`](https://github.com/mastra-ai/mastra/commit/265ec9f887b5c81255c873a76ff7796f16e4f99b), [`6ce80bf`](https://github.com/mastra-ai/mastra/commit/6ce80bf4872a891e0bddf8b80561a80584efb14b), [`9268531`](https://github.com/mastra-ai/mastra/commit/9268531e7ec4be98beeba3b3ae8be0a7ea380662), [`13ead79`](https://github.com/mastra-ai/mastra/commit/13ead79149486b88144db7e11e6ff551caef5be1), [`bd36d8e`](https://github.com/mastra-ai/mastra/commit/bd36d8eb6de8c9a0310352649dbd4b06703c2299), [`8ac9141`](https://github.com/mastra-ai/mastra/commit/8ac9141439caa8fdd674944c4d84f29b3c730296)]:
51
+ - @mastra/core@1.33.0-alpha.10
52
+
3
53
  ## 1.12.0-alpha.2
4
54
 
5
55
  ### Patch Changes
package/README.md CHANGED
@@ -12,7 +12,7 @@ npm install @mastra/observability
12
12
 
13
13
  ```typescript
14
14
  import { Mastra } from '@mastra/core';
15
- import { Observability, DefaultExporter, CloudExporter } from '@mastra/observability';
15
+ import { Observability, MastraStorageExporter, MastraPlatformExporter } from '@mastra/observability';
16
16
 
17
17
  export const mastra = new Mastra({
18
18
  observability: new Observability({
@@ -20,8 +20,8 @@ export const mastra = new Mastra({
20
20
  default: {
21
21
  serviceName: 'my-app',
22
22
  exporters: [
23
- new DefaultExporter(), // Persists traces for Mastra Studio
24
- new CloudExporter(), // Sends to Mastra platform
23
+ new MastraStorageExporter(), // Persists observability events to Mastra Storage
24
+ new MastraPlatformExporter(), // Sends observability events to Mastra Platform
25
25
  ],
26
26
  },
27
27
  },
@@ -8,7 +8,7 @@
8
8
  * - Clean shutdown flushes then clears subscribers
9
9
  *
10
10
  * Buffering/batching is intentionally NOT done here — individual exporters
11
- * own their own batching strategy (e.g. CloudExporter batches uploads).
11
+ * own their own batching strategy.
12
12
  */
13
13
  import { MastraBase } from '@mastra/core/base';
14
14
  import type { ObservabilityEventBus } from '@mastra/core/observability';
package/dist/config.d.ts CHANGED
@@ -121,7 +121,7 @@ export interface ObservabilityInstanceConfig {
121
121
  export interface ObservabilityRegistryConfig {
122
122
  /**
123
123
  * Enables default exporters, with sampling: always, and sensitive data filtering
124
- * @deprecated Use explicit `configs` with DefaultExporter, CloudExporter, and SensitiveDataFilter instead.
124
+ * @deprecated Use explicit `configs` with MastraStorageExporter, MastraPlatformExporter, and SensitiveDataFilter instead.
125
125
  * This option will be removed in a future version.
126
126
  */
127
127
  default?: {
@@ -1,6 +1,11 @@
1
1
  import type { TracingEvent, LogEvent, MetricEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
2
2
  import { BaseExporter } from './base.js';
3
3
  import type { BaseExporterConfig } from './base.js';
4
+ /**
5
+ * @deprecated Use `MastraPlatformExporterConfig` from `@mastra/observability`
6
+ * instead. This type is kept for backward compatibility and will be removed in
7
+ * a future major version.
8
+ */
4
9
  export interface CloudExporterConfig extends BaseExporterConfig {
5
10
  maxBatchSize?: number;
6
11
  maxBatchWaitMs?: number;
@@ -14,6 +19,13 @@ export interface CloudExporterConfig extends BaseExporterConfig {
14
19
  scoresEndpoint?: string;
15
20
  feedbackEndpoint?: string;
16
21
  }
22
+ /**
23
+ * @deprecated Use `MastraPlatformExporter` from `@mastra/observability` instead.
24
+ * This class is preserved unchanged so existing integrations (including code
25
+ * that matches on the `CLOUD_EXPORTER_*` error IDs or the
26
+ * `mastra-cloud-observability-exporter` exporter name) keep working. It will
27
+ * be removed in a future major version.
28
+ */
17
29
  export declare class CloudExporter extends BaseExporter {
18
30
  name: string;
19
31
  private readonly cloudConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD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OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,eAAe,CAA4B;gBAEvC,MAAM,GAAE,mBAAwB;cAgE5B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAejE,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1C,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9C,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;YAMR,mBAAmB;IAYjC,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;YAoBP,WAAW;IAoDzB;;OAEG;YACW,WAAW;YAuBX,gBAAgB;IA+B9B,OAAO,CAAC,WAAW;IAUnB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAiChC"}
@@ -2,7 +2,13 @@ import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEve
2
2
  import type { TracingStorageStrategy } from '@mastra/core/storage';
3
3
  import type { BaseExporterConfig } from './base.js';
4
4
  import { BaseExporter } from './base.js';
5
- /** Configuration for the DefaultExporter's batching, retry, and strategy behavior. */
5
+ /**
6
+ * Configuration for the DefaultExporter's batching, retry, and strategy behavior.
7
+ *
8
+ * @deprecated Use `MastraStorageExporterConfig` from `@mastra/observability` instead.
9
+ * This interface is kept for backward compatibility and will be removed in a
10
+ * future major version.
11
+ */
6
12
  interface DefaultExporterConfig extends BaseExporterConfig {
7
13
  maxBatchSize?: number;
8
14
  maxBufferSize?: number;
@@ -12,6 +18,11 @@ interface DefaultExporterConfig extends BaseExporterConfig {
12
18
  strategy?: TracingStorageStrategy | 'auto';
13
19
  }
14
20
  /**
21
+ * @deprecated Use `MastraStorageExporter` from `@mastra/observability` instead.
22
+ * This class is preserved unchanged so existing integrations (including code
23
+ * that matches on the `mastra-default-observability-exporter` exporter name)
24
+ * keep working. It will be removed in a future major version.
25
+ *
15
26
  * Default storage-backed exporter. Buffers observability events and flushes them
16
27
  * in batches to the configured ObservabilityStorage backend with retry support.
17
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/exporters/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EAId,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAwB,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AAS/G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,sFAAsF;AACtF,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;AA6BD;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,YAAY;;IAC/C,IAAI,SAA2C;gBAgB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AAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAYhC"}
@@ -7,5 +7,7 @@ export * from './span-formatters.js';
7
7
  export * from './cloud.js';
8
8
  export * from './console.js';
9
9
  export * from './default.js';
10
+ export * from './mastra-platform.js';
11
+ export * from './mastra-storage.js';
10
12
  export * from './test.js';
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -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,mBAAmB,CAAC;AAGlC,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,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { TracingEvent, LogEvent, MetricEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
2
+ import { BaseExporter } from './base.js';
3
+ import type { BaseExporterConfig } from './base.js';
4
+ export interface MastraPlatformExporterConfig extends BaseExporterConfig {
5
+ maxBatchSize?: number;
6
+ maxBatchWaitMs?: number;
7
+ maxRetries?: number;
8
+ accessToken?: string;
9
+ projectId?: string;
10
+ endpoint?: string;
11
+ tracesEndpoint?: string;
12
+ logsEndpoint?: string;
13
+ metricsEndpoint?: string;
14
+ scoresEndpoint?: string;
15
+ feedbackEndpoint?: string;
16
+ }
17
+ export declare class MastraPlatformExporter extends BaseExporter {
18
+ name: string;
19
+ private readonly platformConfig;
20
+ private buffer;
21
+ private flushTimer;
22
+ private inFlightFlushes;
23
+ constructor(config?: MastraPlatformExporterConfig);
24
+ protected _exportTracingEvent(event: TracingEvent): Promise<void>;
25
+ onLogEvent(event: LogEvent): Promise<void>;
26
+ onMetricEvent(event: MetricEvent): Promise<void>;
27
+ onScoreEvent(event: ScoreEvent): Promise<void>;
28
+ onFeedbackEvent(event: FeedbackEvent): Promise<void>;
29
+ private addToBuffer;
30
+ private addLogToBuffer;
31
+ private addMetricToBuffer;
32
+ private addScoreToBuffer;
33
+ private addFeedbackToBuffer;
34
+ private markBufferStart;
35
+ private formatSpan;
36
+ private formatLog;
37
+ private formatMetric;
38
+ private formatScore;
39
+ private formatFeedback;
40
+ private handleBufferedEvent;
41
+ private shouldFlush;
42
+ private scheduleFlush;
43
+ private flushBuffer;
44
+ /**
45
+ * Uploads a signal batch to the configured Mastra Observability API using fetchWithRetry.
46
+ */
47
+ private batchUpload;
48
+ private flushSignalBatch;
49
+ private resetBuffer;
50
+ /**
51
+ * Force flush any buffered events without shutting down the exporter.
52
+ * This is useful in serverless environments where you need to ensure events
53
+ * are exported before the runtime instance is terminated.
54
+ */
55
+ flush(): Promise<void>;
56
+ shutdown(): Promise<void>;
57
+ }
58
+ //# sourceMappingURL=mastra-platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mastra-platform.d.ts","sourceRoot":"","sources":["../../src/exporters/mastra-platform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;I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IAYjC,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,aAAa;YAoBP,WAAW;IAkDzB;;OAEG;YACW,WAAW;YAuBX,gBAAgB;IA+B9B,OAAO,CAAC,WAAW;IAUnB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CA+BhC"}
@@ -0,0 +1,91 @@
1
+ import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
2
+ import type { TracingStorageStrategy } from '@mastra/core/storage';
3
+ import type { BaseExporterConfig } from './base.js';
4
+ import { BaseExporter } from './base.js';
5
+ /** Configuration for the MastraStorageExporter's batching, retry, and strategy behavior. */
6
+ export interface MastraStorageExporterConfig extends BaseExporterConfig {
7
+ maxBatchSize?: number;
8
+ maxBufferSize?: number;
9
+ maxBatchWaitMs?: number;
10
+ maxRetries?: number;
11
+ retryDelayMs?: number;
12
+ strategy?: TracingStorageStrategy | 'auto';
13
+ }
14
+ /**
15
+ * Storage-backed exporter. Buffers observability events and flushes them in
16
+ * batches to the configured ObservabilityStorage backend with retry support.
17
+ */
18
+ export declare class MastraStorageExporter extends BaseExporter {
19
+ #private;
20
+ name: string;
21
+ constructor(config?: MastraStorageExporterConfig);
22
+ /**
23
+ * Initialize the exporter (called after all dependencies are ready)
24
+ */
25
+ init(options: InitExporterOptions): Promise<void>;
26
+ /**
27
+ * Checks if buffer should be flushed based on size or time triggers
28
+ */
29
+ private shouldFlush;
30
+ /**
31
+ * Schedules a flush using setTimeout
32
+ */
33
+ private scheduleFlush;
34
+ /**
35
+ * Checks flush triggers and schedules/triggers flush as needed.
36
+ * Called after adding any event to the buffer.
37
+ * Returns the flush promise when flushing so callers can await it.
38
+ */
39
+ private handleBatchedFlush;
40
+ /**
41
+ * Flush a batch of create events for a single signal type.
42
+ * On "not implemented" errors, disables the signal for future flushes.
43
+ * On other errors, re-adds events to the buffer for retry.
44
+ */
45
+ private flushCreates;
46
+ /**
47
+ * Flush span update/end events, deferring any whose span hasn't been created yet.
48
+ * When `isEnd` is true, successfully flushed spans are removed from tracking.
49
+ */
50
+ private flushSpanUpdates;
51
+ /**
52
+ * Flushes the current buffer to storage.
53
+ *
54
+ * Creates are flushed first, then their span keys are added to allCreatedSpans.
55
+ * Updates are checked against allCreatedSpans — those whose span hasn't been
56
+ * created yet are re-inserted into the live buffer for the next flush.
57
+ * Completed spans (SPAN_ENDED) are cleaned up from allCreatedSpans after success.
58
+ */
59
+ private flushBuffer;
60
+ _exportTracingEvent(event: TracingEvent): Promise<void>;
61
+ /**
62
+ * Resolves when an ongoing init call is finished
63
+ * Doesn't wait for the caller to call init
64
+ * @returns
65
+ */
66
+ private waitForInit;
67
+ /**
68
+ * Handle metric events — buffer for batch flush.
69
+ */
70
+ onMetricEvent(event: MetricEvent): Promise<void>;
71
+ /**
72
+ * Handle log events — buffer for batch flush.
73
+ */
74
+ onLogEvent(event: LogEvent): Promise<void>;
75
+ /**
76
+ * Handle score events — buffer for batch flush.
77
+ */
78
+ onScoreEvent(event: ScoreEvent): Promise<void>;
79
+ /**
80
+ * Handle feedback events — buffer for batch flush.
81
+ */
82
+ onFeedbackEvent(event: FeedbackEvent): Promise<void>;
83
+ /**
84
+ * Force flush any buffered spans without shutting down the exporter.
85
+ * This is useful in serverless environments where you need to ensure spans
86
+ * are exported before the runtime instance is terminated.
87
+ */
88
+ flush(): Promise<void>;
89
+ shutdown(): Promise<void>;
90
+ }
91
+ //# sourceMappingURL=mastra-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mastra-storage.d.ts","sourceRoot":"","sources":["../../src/exporters/mastra-storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAwB,sBAAsB,EAAwB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