@raindrop-ai/eve 0.0.15 → 0.0.16

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
@@ -216,7 +216,21 @@ function installEveTurnSpanProcessor(traceApi) {
216
216
  }
217
217
  var installState = { installed: false };
218
218
 
219
- // ../core/dist/chunk-SK6EJEO7.js
219
+ // ../core/dist/chunk-WKRW55KX.js
220
+ function runWithTracingSuppressed(fn) {
221
+ const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
222
+ if (typeof hook !== "function") return fn();
223
+ let started = false;
224
+ try {
225
+ return hook(() => {
226
+ started = true;
227
+ return fn();
228
+ });
229
+ } catch (err) {
230
+ if (started) throw err;
231
+ return fn();
232
+ }
233
+ }
220
234
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
221
235
  var MAX_RETRY_DELAY_MS = 3e4;
222
236
  function wait(ms) {
@@ -299,15 +313,17 @@ async function postJson(url, body, headers, opts) {
299
313
  const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
300
314
  await withRetry(
301
315
  async () => {
302
- const resp = await fetch(url, {
303
- method: "POST",
304
- headers: {
305
- "Content-Type": "application/json",
306
- ...headers
307
- },
308
- body: JSON.stringify(body),
309
- signal: AbortSignal.timeout(timeoutMs)
310
- });
316
+ const resp = await runWithTracingSuppressed(
317
+ () => fetch(url, {
318
+ method: "POST",
319
+ headers: {
320
+ "Content-Type": "application/json",
321
+ ...headers
322
+ },
323
+ body: JSON.stringify(body),
324
+ signal: AbortSignal.timeout(timeoutMs)
325
+ })
326
+ );
311
327
  if (!resp.ok) {
312
328
  const text = await resp.text().catch(() => "");
313
329
  const err = new Error(
@@ -443,6 +459,31 @@ var DEFAULT_REDACT_ATTRIBUTE_KEYS = [
443
459
  ];
444
460
  new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
445
461
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
462
+ var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
463
+ "OpenTelemetry SDK Context Key SUPPRESS_TRACING"
464
+ );
465
+ function findOtelContextManager() {
466
+ var _a;
467
+ for (const sym of Object.getOwnPropertySymbols(globalThis)) {
468
+ if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
469
+ const api = globalThis[sym];
470
+ const cm = api == null ? void 0 : api.context;
471
+ if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
472
+ return cm;
473
+ }
474
+ }
475
+ return void 0;
476
+ }
477
+ function installTracingSuppressionHook() {
478
+ if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
479
+ const hook = (fn) => {
480
+ const cm = findOtelContextManager();
481
+ if (!cm) return fn();
482
+ return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
483
+ };
484
+ globalThis.RAINDROP_SUPPRESS_TRACING = hook;
485
+ }
486
+ installTracingSuppressionHook();
446
487
 
447
488
  // src/internal/limits.ts
448
489
  var DEFAULT_MAX_TEXT_FIELD_CHARS2 = 1e6;
@@ -693,7 +734,7 @@ var RaindropEveSpanExporter = class {
693
734
  // package.json
694
735
  var package_default = {
695
736
  name: "@raindrop-ai/eve",
696
- version: "0.0.15"};
737
+ version: "0.0.16"};
697
738
 
698
739
  // src/internal/version.ts
699
740
  var libraryName = package_default.name;