@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.mjs CHANGED
@@ -211,7 +211,21 @@ function installEveTurnSpanProcessor(traceApi) {
211
211
  }
212
212
  var installState = { installed: false };
213
213
 
214
- // ../core/dist/chunk-SK6EJEO7.js
214
+ // ../core/dist/chunk-WKRW55KX.js
215
+ function runWithTracingSuppressed(fn) {
216
+ const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
217
+ if (typeof hook !== "function") return fn();
218
+ let started = false;
219
+ try {
220
+ return hook(() => {
221
+ started = true;
222
+ return fn();
223
+ });
224
+ } catch (err) {
225
+ if (started) throw err;
226
+ return fn();
227
+ }
228
+ }
215
229
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
216
230
  var MAX_RETRY_DELAY_MS = 3e4;
217
231
  function wait(ms) {
@@ -294,15 +308,17 @@ async function postJson(url, body, headers, opts) {
294
308
  const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
295
309
  await withRetry(
296
310
  async () => {
297
- const resp = await fetch(url, {
298
- method: "POST",
299
- headers: {
300
- "Content-Type": "application/json",
301
- ...headers
302
- },
303
- body: JSON.stringify(body),
304
- signal: AbortSignal.timeout(timeoutMs)
305
- });
311
+ const resp = await runWithTracingSuppressed(
312
+ () => fetch(url, {
313
+ method: "POST",
314
+ headers: {
315
+ "Content-Type": "application/json",
316
+ ...headers
317
+ },
318
+ body: JSON.stringify(body),
319
+ signal: AbortSignal.timeout(timeoutMs)
320
+ })
321
+ );
306
322
  if (!resp.ok) {
307
323
  const text = await resp.text().catch(() => "");
308
324
  const err = new Error(
@@ -438,6 +454,31 @@ var DEFAULT_REDACT_ATTRIBUTE_KEYS = [
438
454
  ];
439
455
  new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
440
456
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
457
+ var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
458
+ "OpenTelemetry SDK Context Key SUPPRESS_TRACING"
459
+ );
460
+ function findOtelContextManager() {
461
+ var _a;
462
+ for (const sym of Object.getOwnPropertySymbols(globalThis)) {
463
+ if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
464
+ const api = globalThis[sym];
465
+ const cm = api == null ? void 0 : api.context;
466
+ if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
467
+ return cm;
468
+ }
469
+ }
470
+ return void 0;
471
+ }
472
+ function installTracingSuppressionHook() {
473
+ if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
474
+ const hook = (fn) => {
475
+ const cm = findOtelContextManager();
476
+ if (!cm) return fn();
477
+ return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
478
+ };
479
+ globalThis.RAINDROP_SUPPRESS_TRACING = hook;
480
+ }
481
+ installTracingSuppressionHook();
441
482
 
442
483
  // src/internal/limits.ts
443
484
  var DEFAULT_MAX_TEXT_FIELD_CHARS2 = 1e6;
@@ -688,7 +729,7 @@ var RaindropEveSpanExporter = class {
688
729
  // package.json
689
730
  var package_default = {
690
731
  name: "@raindrop-ai/eve",
691
- version: "0.0.15"};
732
+ version: "0.0.16"};
692
733
 
693
734
  // src/internal/version.ts
694
735
  var libraryName = package_default.name;