@inference-net/otel-cf-workers 2.3.0 → 2.4.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/dist/index.js CHANGED
@@ -96,7 +96,7 @@ function passthroughGet(target, prop, thisArg) {
96
96
  }
97
97
  }
98
98
 
99
- const PACKAGE_VERSION = "2.3.0";
99
+ const PACKAGE_VERSION = "2.4.0";
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";
@@ -292,12 +292,13 @@ class OTLPExporter {
292
292
  headers: this.headers,
293
293
  body
294
294
  };
295
- unwrap(fetch)(this.url, params).then((response) => {
295
+ unwrap(fetch)(this.url, params).then(async (response) => {
296
296
  if (response.ok) {
297
297
  onSuccess();
298
298
  } else {
299
299
  onError(new OTLPExporterError(`Exporter received a statusCode: ${response.status}`));
300
300
  }
301
+ await response.body?.cancel();
301
302
  }).catch((error) => {
302
303
  onError(new OTLPExporterError(`Exception during export: ${error.toString()}`, error.code, error.stack));
303
304
  });
@@ -3783,6 +3784,7 @@ class OTLPTransport {
3783
3784
  if (!response.ok) {
3784
3785
  throw new OTLPExporterError(`Exporter received a statusCode: ${response.status}`);
3785
3786
  }
3787
+ await response.body?.cancel();
3786
3788
  }
3787
3789
  transformToOTLP(logs) {
3788
3790
  const resourceLogsMap = /* @__PURE__ */ new Map();