toad-eye 2.4.3 → 2.4.4

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.
@@ -3,7 +3,7 @@ import { resourceFromAttributes } from "@opentelemetry/resources";
3
3
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
4
4
  import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
5
5
  import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
6
- import { TraceIdRatioBasedSampler, ParentBasedSampler, } from "@opentelemetry/sdk-trace-node";
6
+ import { TraceIdRatioBasedSampler, ParentBasedSampler, BatchSpanProcessor, } from "@opentelemetry/sdk-trace-node";
7
7
  import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
8
8
  import { initMetrics, resetMetrics } from "./metrics.js";
9
9
  import { resetCustomPricing } from "./pricing.js";
@@ -74,9 +74,11 @@ export function initObservability(config) {
74
74
  exporter: metricExporter,
75
75
  exportIntervalMillis: isCloudMode ? 10_000 : 5_000,
76
76
  });
77
- // Add Vercel AI SDK SpanProcessor if 'ai' is in instrument list
77
+ // When custom SpanProcessors are needed (e.g., Vercel AI SDK),
78
+ // we must also include a BatchSpanProcessor for trace export —
79
+ // NodeSDK won't create one automatically when spanProcessors is provided.
78
80
  const spanProcessors = config.instrument?.includes("ai")
79
- ? [new ToadEyeAISpanProcessor()]
81
+ ? [new BatchSpanProcessor(traceExporter), new ToadEyeAISpanProcessor()]
80
82
  : [];
81
83
  // SDK-side head sampling (default: 1.0 = send everything to Collector)
82
84
  const sdkRate = config.sampling?.sdkRate ?? 1.0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toad-eye",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Auto-instrumentation, cost tracking, budget guards, and observability for LLM services",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",