@inference-net/otel-cf-workers 2.5.0 → 2.5.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/index.d.ts +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -96,7 +96,7 @@ function passthroughGet(target, prop, thisArg) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const PACKAGE_VERSION = "2.5.
|
|
99
|
+
const PACKAGE_VERSION = "2.5.1";
|
|
100
100
|
const PACKAGE_NAME = "@inference-net/otel-cf-workers";
|
|
101
101
|
const ATTR_CLOUDFLARE_COLO = "cloudflare.colo";
|
|
102
102
|
const ATTR_CLOUDFLARE_RAY_ID = "cloudflare.ray_id";
|
|
@@ -358,9 +358,11 @@ class TraceState {
|
|
|
358
358
|
this.exportPromises.push(this.exportSpans(this.unexportedSpans));
|
|
359
359
|
this.unexportedSpans = [];
|
|
360
360
|
}
|
|
361
|
-
|
|
361
|
+
const exportCount = this.exportPromises.length;
|
|
362
|
+
if (exportCount > 0) {
|
|
362
363
|
await Promise.allSettled(this.exportPromises);
|
|
363
364
|
}
|
|
365
|
+
return this.inprogressSpans.size === 0 && this.unexportedSpans.length === 0 && this.exportPromises.length === exportCount;
|
|
364
366
|
}
|
|
365
367
|
isSpanInProgress(span) {
|
|
366
368
|
return this.inprogressSpans.has(span.spanContext().spanId);
|
|
@@ -399,11 +401,13 @@ class BatchTraceSpanProcessor {
|
|
|
399
401
|
this.getTraceState(traceId).endSpan(span);
|
|
400
402
|
}
|
|
401
403
|
async forceFlush(traceId) {
|
|
402
|
-
if (traceId) {
|
|
403
|
-
await this.
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
if (!traceId) {
|
|
405
|
+
await Promise.allSettled(Object.keys(this.traces).map((id) => this.forceFlush(id)));
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const state = this.traces[traceId];
|
|
409
|
+
if (state && await state.flush() && this.traces[traceId] === state) {
|
|
410
|
+
delete this.traces[traceId];
|
|
407
411
|
}
|
|
408
412
|
}
|
|
409
413
|
async shutdown() {
|