@mastra/observability 1.20.0 → 1.20.1-alpha.1
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/dist/exporters/tracking.d.ts.map +1 -1
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/metrics/pricing-data.json +315 -157
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1287,7 +1287,8 @@ const BEDROCK_GEOGRAPHY_PREFIXES = /* @__PURE__ */ new Set([
|
|
|
1287
1287
|
"eu",
|
|
1288
1288
|
"apac",
|
|
1289
1289
|
"jp",
|
|
1290
|
-
"au"
|
|
1290
|
+
"au",
|
|
1291
|
+
"in"
|
|
1291
1292
|
]);
|
|
1292
1293
|
const AI_SDK_VERCEL_GATEWAY_PROVIDER_ID = "gateway";
|
|
1293
1294
|
const AZURE_OPENAI_GATEWAY_ID = "azure-openai";
|
|
@@ -6396,6 +6397,8 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
6396
6397
|
#pendingCleanups = /* @__PURE__ */ new Map();
|
|
6397
6398
|
/** Waiting-queue replays started by setImmediate that haven't finished yet */
|
|
6398
6399
|
#activeReplays = /* @__PURE__ */ new Set();
|
|
6400
|
+
/** Hard-cap enforcements started by getTraceData() that haven't finished yet */
|
|
6401
|
+
#activeHardCapEnforcements = /* @__PURE__ */ new Set();
|
|
6399
6402
|
/** Subclass configuration with resolved values */
|
|
6400
6403
|
config;
|
|
6401
6404
|
/** Maximum attempts to process a queued event before dropping */
|
|
@@ -6481,6 +6484,15 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
6481
6484
|
}
|
|
6482
6485
|
}
|
|
6483
6486
|
/**
|
|
6487
|
+
* Wait for fire-and-forget hard-cap enforcements, so the aborts they issue are
|
|
6488
|
+
* handed to the vendor before flush() / shutdown() send or abort anything else.
|
|
6489
|
+
* Only the ones running right now are joined; enforcements started by spans that
|
|
6490
|
+
* arrive later belong to a later flush, so this never spins under traffic.
|
|
6491
|
+
*/
|
|
6492
|
+
async #drainHardCapEnforcements() {
|
|
6493
|
+
await Promise.all([...this.#activeHardCapEnforcements]);
|
|
6494
|
+
}
|
|
6495
|
+
/**
|
|
6484
6496
|
* Process all events waiting for root span.
|
|
6485
6497
|
* Takes the queue before processing, so a concurrent call can't process the same events.
|
|
6486
6498
|
* @returns The number of events that left the queue (processed, moved or dropped)
|
|
@@ -7014,9 +7026,11 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
7014
7026
|
traceId,
|
|
7015
7027
|
method
|
|
7016
7028
|
});
|
|
7017
|
-
this.#enforceHardCap().catch((error) => {
|
|
7029
|
+
const enforcement = this.#enforceHardCap().catch((error) => {
|
|
7018
7030
|
this.logger.error(`${this.name}: Error enforcing hard cap`, { error });
|
|
7019
7031
|
});
|
|
7032
|
+
this.#activeHardCapEnforcements.add(enforcement);
|
|
7033
|
+
enforcement.finally(() => this.#activeHardCapEnforcements.delete(enforcement));
|
|
7020
7034
|
}
|
|
7021
7035
|
return this.#traceMap.get(traceId);
|
|
7022
7036
|
}
|
|
@@ -7049,6 +7063,7 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
7049
7063
|
if (this.isDisabled) return;
|
|
7050
7064
|
this.logger.debug(`${this.name}: Flushing`);
|
|
7051
7065
|
if (!this.#shutdownStarted) await this.#drainWaitingQueues();
|
|
7066
|
+
await this.#drainHardCapEnforcements();
|
|
7052
7067
|
await this._flush();
|
|
7053
7068
|
}
|
|
7054
7069
|
/**
|
|
@@ -7069,6 +7084,7 @@ var TrackingExporter = class extends BaseExporter {
|
|
|
7069
7084
|
if (this.isDisabled) return;
|
|
7070
7085
|
this.#shutdownStarted = true;
|
|
7071
7086
|
await this.#drainWaitingQueues();
|
|
7087
|
+
await this.#drainHardCapEnforcements();
|
|
7072
7088
|
await this._preShutdown();
|
|
7073
7089
|
for (const [traceId, timeout] of this.#pendingCleanups) {
|
|
7074
7090
|
clearTimeout(timeout);
|