@mastra/observability 1.15.2 → 1.16.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 CHANGED
@@ -1,5 +1,53 @@
1
1
  # @mastra/observability
2
2
 
3
+ ## 1.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `flush()` to `ObservabilityEntrypoint` so `mastra.observability.flush()` works directly in serverless environments. ([#18873](https://github.com/mastra-ai/mastra/pull/18873))
8
+
9
+ Previously, `flush()` only existed on individual `ObservabilityInstance` objects, requiring users to call `mastra.observability.getDefaultInstance()?.flush()`. The entrypoint-level `flush()` delegates to all registered instances, matching the existing `shutdown()` pattern.
10
+
11
+ ```ts
12
+ // Before (broken — getObservability() didn't exist, flush() wasn't on the entrypoint)
13
+ const observability = mastra.getObservability();
14
+ await observability.flush();
15
+
16
+ // After
17
+ await mastra.observability.flush();
18
+ ```
19
+
20
+ Fixed the serverless flush docs in the observability config guide and Vercel deployment guide to use the correct API.
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [[`b291760`](https://github.com/mastra-ai/mastra/commit/b291760df9d6c7e4fc72606c8f0a4af2cf6e946c), [`3ffb8b7`](https://github.com/mastra-ai/mastra/commit/3ffb8b720e90f5e6977129ec1f6707d43c2bebe0), [`6ef59fe`](https://github.com/mastra-ai/mastra/commit/6ef59fef1da52ed8da5fbb2a892c71cf4fb6c739), [`4039488`](https://github.com/mastra-ai/mastra/commit/403948898af7293198d9e8b3e7fb47f623c78b94), [`29b7ea6`](https://github.com/mastra-ai/mastra/commit/29b7ea64e72b5523d5bdcbd34ee03d2b854d54e1), [`b2c9d70`](https://github.com/mastra-ai/mastra/commit/b2c9d70757207fb01a9069549e69b6f0d73a6636), [`a51c63d`](https://github.com/mastra-ai/mastra/commit/a51c63d8ee639e4daeba2a0be093efa6a1b5e52f), [`252f63d`](https://github.com/mastra-ai/mastra/commit/252f63d8fec723955adb2202be2f01a75ad0e69c), [`5ea76a7`](https://github.com/mastra-ai/mastra/commit/5ea76a723d966c72da9aa3ab30ae20276e049765), [`6445560`](https://github.com/mastra-ai/mastra/commit/6445560327045d20b239585fc63fed72e9ce36ec), [`e2b9f33`](https://github.com/mastra-ai/mastra/commit/e2b9f33456fd638eca555f9466c6519d8d049666), [`10959d5`](https://github.com/mastra-ai/mastra/commit/10959d509d824f682d40ff96e05ee044aec3b0e5), [`c547a77`](https://github.com/mastra-ai/mastra/commit/c547a7729bdf64dfc2df29c965046c0712a18f10), [`a0085fa`](https://github.com/mastra-ai/mastra/commit/a0085fa0934e52c37c8c8b3d75a6bb5cd199af36), [`a2ba369`](https://github.com/mastra-ai/mastra/commit/a2ba369e796dfab610f41c6875965b488272fa55), [`ffc3c17`](https://github.com/mastra-ai/mastra/commit/ffc3c17274ea17c11aa6f73d3140649cd7fc8abc), [`81542c1`](https://github.com/mastra-ai/mastra/commit/81542c1835c35bc32f2ce4fa9136ee11993cd299), [`3908e53`](https://github.com/mastra-ai/mastra/commit/3908e53ce04bbea04f5e0c097d7aa298c35fabee), [`cb24ce7`](https://github.com/mastra-ai/mastra/commit/cb24ce76bd16ca88eb6a963f6277f8780e703029), [`02705fd`](https://github.com/mastra-ai/mastra/commit/02705fd2f5a9062210d64ea061adeeb10dc9452e), [`ae51e81`](https://github.com/mastra-ai/mastra/commit/ae51e818825582d42500338dfc1929a082eff0ba), [`6f304ef`](https://github.com/mastra-ai/mastra/commit/6f304ef319e99725e884bdb8d3193c001b6e5964), [`5f9858f`](https://github.com/mastra-ai/mastra/commit/5f9858f791f1137ca7d52d23559fb4568f7a9026)]:
25
+ - @mastra/core@1.50.0
26
+
27
+ ## 1.16.0-alpha.0
28
+
29
+ ### Minor Changes
30
+
31
+ - Added `flush()` to `ObservabilityEntrypoint` so `mastra.observability.flush()` works directly in serverless environments. ([#18873](https://github.com/mastra-ai/mastra/pull/18873))
32
+
33
+ Previously, `flush()` only existed on individual `ObservabilityInstance` objects, requiring users to call `mastra.observability.getDefaultInstance()?.flush()`. The entrypoint-level `flush()` delegates to all registered instances, matching the existing `shutdown()` pattern.
34
+
35
+ ```ts
36
+ // Before (broken — getObservability() didn't exist, flush() wasn't on the entrypoint)
37
+ const observability = mastra.getObservability();
38
+ await observability.flush();
39
+
40
+ // After
41
+ await mastra.observability.flush();
42
+ ```
43
+
44
+ Fixed the serverless flush docs in the observability config guide and Vercel deployment guide to use the correct API.
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [[`3ffb8b7`](https://github.com/mastra-ai/mastra/commit/3ffb8b720e90f5e6977129ec1f6707d43c2bebe0), [`5ea76a7`](https://github.com/mastra-ai/mastra/commit/5ea76a723d966c72da9aa3ab30ae20276e049765), [`6445560`](https://github.com/mastra-ai/mastra/commit/6445560327045d20b239585fc63fed72e9ce36ec), [`a2ba369`](https://github.com/mastra-ai/mastra/commit/a2ba369e796dfab610f41c6875965b488272fa55), [`ae51e81`](https://github.com/mastra-ai/mastra/commit/ae51e818825582d42500338dfc1929a082eff0ba), [`6f304ef`](https://github.com/mastra-ai/mastra/commit/6f304ef319e99725e884bdb8d3193c001b6e5964)]:
49
+ - @mastra/core@1.50.0-alpha.1
50
+
3
51
  ## 1.15.2
4
52
 
5
53
  ### Patch Changes
package/dist/default.d.ts CHANGED
@@ -51,6 +51,8 @@ export declare class Observability extends MastraBase implements ObservabilityEn
51
51
  setConfigSelector(selector: ConfigSelector): void;
52
52
  /** Remove all registered instances and reset the registry. */
53
53
  clear(): void;
54
+ /** Flush all registered instances without shutting down. */
55
+ flush(): Promise<void>;
54
56
  /** Shut down all registered instances, flushing any pending data. */
55
57
  shutdown(): Promise<void>;
56
58
  /**
@@ -1 +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,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B,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIjD,8DAA8D;IAC9D,KAAK,IAAI,IAAI;IAIb,4DAA4D;IACtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,qEAAqE;IAC/D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;;;;;;;OAQG;IACH,2BAA2B,IAAI,wBAAwB,GAAG,SAAS;CA2DpE"}
package/dist/index.cjs CHANGED
@@ -8830,6 +8830,13 @@ var ObservabilityRegistry = class {
8830
8830
  }
8831
8831
  return deleted;
8832
8832
  }
8833
+ /**
8834
+ * Flush all registered instances without shutting down.
8835
+ */
8836
+ async flush() {
8837
+ const flushPromises = Array.from(this.#instances.values()).map((instance) => instance.flush());
8838
+ await Promise.allSettled(flushPromises);
8839
+ }
8833
8840
  /**
8834
8841
  * Shutdown all instances and clear the registry
8835
8842
  */
@@ -9273,6 +9280,10 @@ var Observability = class extends base.MastraBase {
9273
9280
  clear() {
9274
9281
  this.#registry.clear();
9275
9282
  }
9283
+ /** Flush all registered instances without shutting down. */
9284
+ async flush() {
9285
+ await this.#registry.flush();
9286
+ }
9276
9287
  /** Shut down all registered instances, flushing any pending data. */
9277
9288
  async shutdown() {
9278
9289
  await this.#registry.shutdown();