raindrop-ai 0.2.0 → 0.2.1-otelv2

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.
@@ -426,7 +426,7 @@ installTracingSuppressionHook();
426
426
  // package.json
427
427
  var package_default = {
428
428
  name: "raindrop-ai",
429
- version: "0.2.0",
429
+ version: "0.2.1",
430
430
  main: "dist/index.js",
431
431
  module: "dist/index.mjs",
432
432
  types: "dist/index.d.ts",
@@ -1971,6 +1971,53 @@ function mergeWithBestEffortLocalDebuggerProcessor(processor, localDebuggerProce
1971
1971
  }
1972
1972
  return new CompositeSpanProcessor(processor ? [processor] : [], [localDebuggerProcessor]);
1973
1973
  }
1974
+ var warnedSpanNormalizeFailure = false;
1975
+ var INVALID_OTEL_SPAN_ID = "0000000000000000";
1976
+ function normalizeSpanForV1Exporter(span) {
1977
+ var _a;
1978
+ if (!span) {
1979
+ return;
1980
+ }
1981
+ if (span.instrumentationLibrary == null && span.instrumentationScope != null) {
1982
+ try {
1983
+ span.instrumentationLibrary = span.instrumentationScope;
1984
+ } catch (error) {
1985
+ if (!warnedSpanNormalizeFailure) {
1986
+ warnedSpanNormalizeFailure = true;
1987
+ console.warn(
1988
+ "[raindrop] Could not normalize an OTEL v2 span for export (instrumentationLibrary alias failed). Spans may not reach Raindrop.",
1989
+ error instanceof Error ? error.message : error
1990
+ );
1991
+ }
1992
+ }
1993
+ }
1994
+ if (span.parentSpanId == null && ((_a = span.parentSpanContext) == null ? void 0 : _a.spanId) != null && span.parentSpanContext.spanId !== INVALID_OTEL_SPAN_ID) {
1995
+ try {
1996
+ span.parentSpanId = span.parentSpanContext.spanId;
1997
+ } catch (e) {
1998
+ }
1999
+ }
2000
+ }
2001
+ function withV2SpanCompat(processor) {
2002
+ return {
2003
+ onStart(span, parentContext) {
2004
+ processor.onStart(span, parentContext);
2005
+ },
2006
+ onEnd(span) {
2007
+ try {
2008
+ normalizeSpanForV1Exporter(span);
2009
+ } catch (e) {
2010
+ }
2011
+ processor.onEnd(span);
2012
+ },
2013
+ forceFlush() {
2014
+ return processor.forceFlush();
2015
+ },
2016
+ shutdown() {
2017
+ return processor.shutdown();
2018
+ }
2019
+ };
2020
+ }
1974
2021
  try {
1975
2022
  const _bedrockProto = BedrockInstrumentation.prototype;
1976
2023
  _bedrockProto._wrapPromise = function(span, promise) {
@@ -2426,16 +2473,18 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
2426
2473
  allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
2427
2474
  localDebuggerUrlOpt: localDebuggerUrl
2428
2475
  });
2429
- return localOnlyProcessor != null ? localOnlyProcessor : {
2430
- forceFlush: async () => {
2431
- },
2432
- onStart: () => {
2433
- },
2434
- onEnd: () => {
2435
- },
2436
- shutdown: async () => {
2476
+ return withV2SpanCompat(
2477
+ localOnlyProcessor != null ? localOnlyProcessor : {
2478
+ forceFlush: async () => {
2479
+ },
2480
+ onStart: () => {
2481
+ },
2482
+ onEnd: () => {
2483
+ },
2484
+ shutdown: async () => {
2485
+ }
2437
2486
  }
2438
- };
2487
+ );
2439
2488
  }
2440
2489
  const headers = withProjectIdHeaders(processorOptions == null ? void 0 : processorOptions.headers);
2441
2490
  const productionProcessor = traceloop3.createSpanProcessor({
@@ -2451,9 +2500,8 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
2451
2500
  allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
2452
2501
  localDebuggerUrlOpt: localDebuggerUrl
2453
2502
  });
2454
- return mergeWithBestEffortLocalDebuggerProcessor(
2455
- productionProcessor,
2456
- localDebuggerProcessor
2503
+ return withV2SpanCompat(
2504
+ mergeWithBestEffortLocalDebuggerProcessor(productionProcessor, localDebuggerProcessor)
2457
2505
  );
2458
2506
  },
2459
2507
  begin(traceContext) {
package/dist/index.js CHANGED
@@ -10305,7 +10305,7 @@ var SignalEventSchema = external_exports.object({
10305
10305
  // package.json
10306
10306
  var package_default = {
10307
10307
  name: "raindrop-ai",
10308
- version: "0.2.0",
10308
+ version: "0.2.1",
10309
10309
  main: "dist/index.js",
10310
10310
  module: "dist/index.mjs",
10311
10311
  types: "dist/index.d.ts",
@@ -11930,6 +11930,53 @@ function mergeWithBestEffortLocalDebuggerProcessor(processor, localDebuggerProce
11930
11930
  }
11931
11931
  return new CompositeSpanProcessor(processor ? [processor] : [], [localDebuggerProcessor]);
11932
11932
  }
11933
+ var warnedSpanNormalizeFailure = false;
11934
+ var INVALID_OTEL_SPAN_ID = "0000000000000000";
11935
+ function normalizeSpanForV1Exporter(span) {
11936
+ var _a;
11937
+ if (!span) {
11938
+ return;
11939
+ }
11940
+ if (span.instrumentationLibrary == null && span.instrumentationScope != null) {
11941
+ try {
11942
+ span.instrumentationLibrary = span.instrumentationScope;
11943
+ } catch (error) {
11944
+ if (!warnedSpanNormalizeFailure) {
11945
+ warnedSpanNormalizeFailure = true;
11946
+ console.warn(
11947
+ "[raindrop] Could not normalize an OTEL v2 span for export (instrumentationLibrary alias failed). Spans may not reach Raindrop.",
11948
+ error instanceof Error ? error.message : error
11949
+ );
11950
+ }
11951
+ }
11952
+ }
11953
+ if (span.parentSpanId == null && ((_a = span.parentSpanContext) == null ? void 0 : _a.spanId) != null && span.parentSpanContext.spanId !== INVALID_OTEL_SPAN_ID) {
11954
+ try {
11955
+ span.parentSpanId = span.parentSpanContext.spanId;
11956
+ } catch (e) {
11957
+ }
11958
+ }
11959
+ }
11960
+ function withV2SpanCompat(processor) {
11961
+ return {
11962
+ onStart(span, parentContext) {
11963
+ processor.onStart(span, parentContext);
11964
+ },
11965
+ onEnd(span) {
11966
+ try {
11967
+ normalizeSpanForV1Exporter(span);
11968
+ } catch (e) {
11969
+ }
11970
+ processor.onEnd(span);
11971
+ },
11972
+ forceFlush() {
11973
+ return processor.forceFlush();
11974
+ },
11975
+ shutdown() {
11976
+ return processor.shutdown();
11977
+ }
11978
+ };
11979
+ }
11933
11980
  try {
11934
11981
  const _bedrockProto = import_instrumentation_bedrock.BedrockInstrumentation.prototype;
11935
11982
  _bedrockProto._wrapPromise = function(span, promise) {
@@ -12385,16 +12432,18 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
12385
12432
  allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
12386
12433
  localDebuggerUrlOpt: localDebuggerUrl
12387
12434
  });
12388
- return localOnlyProcessor != null ? localOnlyProcessor : {
12389
- forceFlush: async () => {
12390
- },
12391
- onStart: () => {
12392
- },
12393
- onEnd: () => {
12394
- },
12395
- shutdown: async () => {
12435
+ return withV2SpanCompat(
12436
+ localOnlyProcessor != null ? localOnlyProcessor : {
12437
+ forceFlush: async () => {
12438
+ },
12439
+ onStart: () => {
12440
+ },
12441
+ onEnd: () => {
12442
+ },
12443
+ shutdown: async () => {
12444
+ }
12396
12445
  }
12397
- };
12446
+ );
12398
12447
  }
12399
12448
  const headers = withProjectIdHeaders(processorOptions == null ? void 0 : processorOptions.headers);
12400
12449
  const productionProcessor = traceloop3.createSpanProcessor({
@@ -12410,9 +12459,8 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
12410
12459
  allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
12411
12460
  localDebuggerUrlOpt: localDebuggerUrl
12412
12461
  });
12413
- return mergeWithBestEffortLocalDebuggerProcessor(
12414
- productionProcessor,
12415
- localDebuggerProcessor
12462
+ return withV2SpanCompat(
12463
+ mergeWithBestEffortLocalDebuggerProcessor(productionProcessor, localDebuggerProcessor)
12416
12464
  );
12417
12465
  },
12418
12466
  begin(traceContext) {
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  setDefaultMaxTextFieldChars,
19
19
  stringifyBounded,
20
20
  tracing
21
- } from "./chunk-XUL7ADVB.mjs";
21
+ } from "./chunk-UTCK3OAC.mjs";
22
22
  import {
23
23
  __commonJS,
24
24
  __toESM
@@ -593,7 +593,7 @@ function base64ToHex(base64) {
593
593
  // package.json
594
594
  var package_default = {
595
595
  name: "raindrop-ai",
596
- version: "0.2.0",
596
+ version: "0.2.1",
597
597
  main: "dist/index.js",
598
598
  module: "dist/index.mjs",
599
599
  types: "dist/index.d.ts",
@@ -1961,6 +1961,53 @@ function mergeWithBestEffortLocalDebuggerProcessor(processor, localDebuggerProce
1961
1961
  }
1962
1962
  return new CompositeSpanProcessor(processor ? [processor] : [], [localDebuggerProcessor]);
1963
1963
  }
1964
+ var warnedSpanNormalizeFailure = false;
1965
+ var INVALID_OTEL_SPAN_ID = "0000000000000000";
1966
+ function normalizeSpanForV1Exporter(span) {
1967
+ var _a;
1968
+ if (!span) {
1969
+ return;
1970
+ }
1971
+ if (span.instrumentationLibrary == null && span.instrumentationScope != null) {
1972
+ try {
1973
+ span.instrumentationLibrary = span.instrumentationScope;
1974
+ } catch (error) {
1975
+ if (!warnedSpanNormalizeFailure) {
1976
+ warnedSpanNormalizeFailure = true;
1977
+ console.warn(
1978
+ "[raindrop] Could not normalize an OTEL v2 span for export (instrumentationLibrary alias failed). Spans may not reach Raindrop.",
1979
+ error instanceof Error ? error.message : error
1980
+ );
1981
+ }
1982
+ }
1983
+ }
1984
+ if (span.parentSpanId == null && ((_a = span.parentSpanContext) == null ? void 0 : _a.spanId) != null && span.parentSpanContext.spanId !== INVALID_OTEL_SPAN_ID) {
1985
+ try {
1986
+ span.parentSpanId = span.parentSpanContext.spanId;
1987
+ } catch (e) {
1988
+ }
1989
+ }
1990
+ }
1991
+ function withV2SpanCompat(processor) {
1992
+ return {
1993
+ onStart(span, parentContext) {
1994
+ processor.onStart(span, parentContext);
1995
+ },
1996
+ onEnd(span) {
1997
+ try {
1998
+ normalizeSpanForV1Exporter(span);
1999
+ } catch (e) {
2000
+ }
2001
+ processor.onEnd(span);
2002
+ },
2003
+ forceFlush() {
2004
+ return processor.forceFlush();
2005
+ },
2006
+ shutdown() {
2007
+ return processor.shutdown();
2008
+ }
2009
+ };
2010
+ }
1964
2011
  try {
1965
2012
  const _bedrockProto = import_instrumentation_bedrock.BedrockInstrumentation.prototype;
1966
2013
  _bedrockProto._wrapPromise = function(span, promise) {
@@ -2416,16 +2463,18 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
2416
2463
  allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
2417
2464
  localDebuggerUrlOpt: localDebuggerUrl
2418
2465
  });
2419
- return localOnlyProcessor != null ? localOnlyProcessor : {
2420
- forceFlush: async () => {
2421
- },
2422
- onStart: () => {
2423
- },
2424
- onEnd: () => {
2425
- },
2426
- shutdown: async () => {
2466
+ return withV2SpanCompat(
2467
+ localOnlyProcessor != null ? localOnlyProcessor : {
2468
+ forceFlush: async () => {
2469
+ },
2470
+ onStart: () => {
2471
+ },
2472
+ onEnd: () => {
2473
+ },
2474
+ shutdown: async () => {
2475
+ }
2427
2476
  }
2428
- };
2477
+ );
2429
2478
  }
2430
2479
  const headers = withProjectIdHeaders(processorOptions == null ? void 0 : processorOptions.headers);
2431
2480
  const productionProcessor = traceloop3.createSpanProcessor({
@@ -2441,9 +2490,8 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
2441
2490
  allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
2442
2491
  localDebuggerUrlOpt: localDebuggerUrl
2443
2492
  });
2444
- return mergeWithBestEffortLocalDebuggerProcessor(
2445
- productionProcessor,
2446
- localDebuggerProcessor
2493
+ return withV2SpanCompat(
2494
+ mergeWithBestEffortLocalDebuggerProcessor(productionProcessor, localDebuggerProcessor)
2447
2495
  );
2448
2496
  },
2449
2497
  begin(traceContext) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "../chunk-XUL7ADVB.mjs";
3
+ } from "../chunk-UTCK3OAC.mjs";
4
4
  import "../chunk-UJCSKKID.mjs";
5
5
 
6
6
  // src/tracing/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-otelv2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -32,9 +32,9 @@
32
32
  "dist/**"
33
33
  ],
34
34
  "devDependencies": {
35
- "ai": "^6.0.0",
36
35
  "@opentelemetry/resources": "^2.0.1",
37
36
  "@types/node": "^20.11.17",
37
+ "ai": "^6.0.0",
38
38
  "msw": "^2.12.8",
39
39
  "tsup": "^8.4.0",
40
40
  "tsx": "^4.20.3",
@@ -47,8 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@opentelemetry/api": "^1.9.0",
50
- "@opentelemetry/exporter-trace-otlp-http": "^0.57.2",
51
- "@traceloop/node-server-sdk": "0.19.0-otel-v1",
50
+ "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
52
51
  "weakref": "^0.2.1",
53
52
  "zod": "^3.23.8"
54
53
  },
@@ -91,6 +90,9 @@
91
90
  },
92
91
  "clean": true
93
92
  },
93
+ "optionalDependencies": {
94
+ "@traceloop/node-server-sdk": "0.22.2"
95
+ },
94
96
  "scripts": {
95
97
  "build": "tsup",
96
98
  "dev": "tsup --watch",