@anyway-sh/node-server-sdk 0.22.8 → 0.22.9

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
@@ -66,7 +66,7 @@ class PromptNotFoundError extends TraceloopError {
66
66
  }
67
67
  }
68
68
 
69
- var version = "0.22.8";
69
+ var version = "0.22.9";
70
70
 
71
71
  /**
72
72
  * Base class for handling annotation operations with the Traceloop API.
@@ -3387,9 +3387,13 @@ const ensureSpanCompatibility = (span) => {
3387
3387
  const onSpanEnd = (originalOnEnd, instrumentationLibraries) => {
3388
3388
  return (span) => {
3389
3389
  var _a, _b, _c;
3390
+ const libName = ((_a = span.instrumentationScope) === null || _a === void 0 ? void 0 : _a.name) ||
3391
+ ((_b = span.instrumentationLibrary) === null || _b === void 0 ? void 0 : _b.name) ||
3392
+ "unknown";
3393
+ console.log(`[Anyway Debug] onSpanEnd: span="${span.name}" lib="${libName}"`);
3390
3394
  if (instrumentationLibraries &&
3391
- !instrumentationLibraries.includes(((_a = span.instrumentationScope) === null || _a === void 0 ? void 0 : _a.name) ||
3392
- ((_b = span.instrumentationLibrary) === null || _b === void 0 ? void 0 : _b.name))) {
3395
+ !instrumentationLibraries.includes(libName)) {
3396
+ console.log(`[Anyway Debug] Dropping span="${span.name}" - lib="${libName}" not in allowed list`);
3393
3397
  return;
3394
3398
  }
3395
3399
  transformAiSdkSpanAttributes(span);
@@ -3416,6 +3420,7 @@ const onSpanEnd = (originalOnEnd, instrumentationLibraries) => {
3416
3420
  cleanupExpiredSpanAgentNames();
3417
3421
  }
3418
3422
  const compatibleSpan = ensureSpanCompatibility(span);
3423
+ console.log(`[Anyway Debug] Span queued for export: "${span.name}" lib="${libName}"`);
3419
3424
  originalOnEnd(compatibleSpan);
3420
3425
  };
3421
3426
  };
@@ -3701,6 +3706,19 @@ const startTracing = (options) => {
3701
3706
  url: `${baseUrl}/v1/traces`,
3702
3707
  headers,
3703
3708
  }));
3709
+ // [Anyway Debug] Wrap exporter to log outgoing calls
3710
+ const origExport = traceExporter.export.bind(traceExporter);
3711
+ traceExporter.export = (spans, resultCallback) => {
3712
+ var _a, _b;
3713
+ console.log(`[Anyway Debug] Exporting ${spans.length} span(s) to ${baseUrl}/v1/traces`);
3714
+ for (const s of spans) {
3715
+ console.log(`[Anyway Debug] - ${s.name} (${((_a = s.instrumentationLibrary) === null || _a === void 0 ? void 0 : _a.name) || ((_b = s.instrumentationScope) === null || _b === void 0 ? void 0 : _b.name) || "unknown"})`);
3716
+ }
3717
+ return origExport(spans, (result) => {
3718
+ console.log(`[Anyway Debug] Export result: code=${result.code}${result.error ? ` error=${result.error.message}` : ""}`);
3719
+ resultCallback(result);
3720
+ });
3721
+ };
3704
3722
  _spanProcessor = createSpanProcessor({
3705
3723
  apiKey: options.apiKey,
3706
3724
  baseUrl: options.baseUrl,
@@ -3900,6 +3918,9 @@ const initialize = (options = {}) => {
3900
3918
  if (!options.silenceInitializationMessage) {
3901
3919
  console.log(`Traceloop exporting traces to ${_configuration.exporter ? "a custom exporter" : _configuration.baseUrl}`);
3902
3920
  }
3921
+ console.log(`[Anyway Debug] Trace endpoint: ${_configuration.baseUrl}/v1/traces`);
3922
+ console.log(`[Anyway Debug] API key present: ${!!_configuration.apiKey}`);
3923
+ console.log(`[Anyway Debug] Using custom exporter: ${!!_configuration.exporter}`);
3903
3924
  if (options.tracingEnabled === undefined || options.tracingEnabled) {
3904
3925
  if (options.logLevel) {
3905
3926
  diag.setLogger(new DiagConsoleLogger(), logLevelToOtelLogLevel(options.logLevel));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyway-sh/node-server-sdk",
3
- "version": "0.22.8",
3
+ "version": "0.22.9",
4
4
  "description": "Anyway Software Development Kit (SDK) for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",