@introspection-sdk/introspection-node 0.4.1 → 0.4.3
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-check-types.log +4 -0
- package/.turbo/turbo-lint.log +5 -0
- package/dist/ai-sdk-integration.d.ts.map +1 -1
- package/dist/ai-sdk-integration.js +2 -2
- package/dist/claude-hooks.d.ts.map +1 -1
- package/dist/claude-hooks.js +3 -3
- package/dist/client.d.ts +42 -132
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +66 -365
- package/dist/client.js.map +1 -0
- package/dist/converters/claude.d.ts +5 -1
- package/dist/converters/claude.d.ts.map +1 -1
- package/dist/converters/claude.js +7 -0
- package/dist/converters/claude.js.map +1 -0
- package/dist/converters/gemini.d.ts +90 -0
- package/dist/converters/gemini.d.ts.map +1 -0
- package/dist/converters/gemini.js +171 -0
- package/dist/converters/gemini.js.map +1 -0
- package/dist/converters/index.d.ts +1 -1
- package/dist/converters/index.d.ts.map +1 -1
- package/dist/converters/index.js +2 -1
- package/dist/converters/index.js.map +1 -0
- package/dist/converters/openai.js +1 -0
- package/dist/converters/openai.js.map +1 -0
- package/dist/converters/openclaw.d.ts +16 -0
- package/dist/converters/openclaw.d.ts.map +1 -0
- package/dist/converters/openclaw.js +49 -0
- package/dist/converters/openinference.js +1 -0
- package/dist/converters/openinference.js.map +1 -0
- package/dist/converters/vercel.d.ts.map +1 -1
- package/dist/converters/vercel.js +31 -3
- package/dist/converters/vercel.js.map +1 -0
- package/dist/http.d.ts +36 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +145 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +24 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -32
- package/dist/index.js.map +1 -0
- package/dist/langchain-handler.d.ts.map +1 -1
- package/dist/langchain-handler.js +2 -2
- package/dist/mastra-exporter.d.ts.map +1 -1
- package/dist/mastra-exporter.js +2 -2
- package/dist/otel/anthropic.d.ts +62 -0
- package/dist/otel/anthropic.d.ts.map +1 -0
- package/dist/otel/anthropic.js +425 -0
- package/dist/otel/anthropic.js.map +1 -0
- package/dist/otel/claude-hooks.d.ts +346 -0
- package/dist/otel/claude-hooks.d.ts.map +1 -0
- package/dist/otel/claude-hooks.js +645 -0
- package/dist/otel/claude-hooks.js.map +1 -0
- package/dist/otel/claude-wrapper.d.ts +93 -0
- package/dist/otel/claude-wrapper.d.ts.map +1 -0
- package/dist/otel/claude-wrapper.js +155 -0
- package/dist/otel/claude-wrapper.js.map +1 -0
- package/dist/otel/gemini.d.ts +48 -0
- package/dist/otel/gemini.d.ts.map +1 -0
- package/dist/otel/gemini.js +297 -0
- package/dist/otel/gemini.js.map +1 -0
- package/dist/otel/index.d.ts +27 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/index.js +33 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/otel/langchain-handler.d.ts +112 -0
- package/dist/otel/langchain-handler.d.ts.map +1 -0
- package/dist/otel/langchain-handler.js +555 -0
- package/dist/otel/langchain-handler.js.map +1 -0
- package/dist/otel/logs.d.ts +82 -0
- package/dist/otel/logs.d.ts.map +1 -0
- package/dist/otel/logs.js +271 -0
- package/dist/otel/logs.js.map +1 -0
- package/dist/otel/mastra-exporter.d.ts +87 -0
- package/dist/otel/mastra-exporter.d.ts.map +1 -0
- package/dist/otel/mastra-exporter.js +525 -0
- package/dist/otel/mastra-exporter.js.map +1 -0
- package/dist/otel/pi.d.ts +59 -0
- package/dist/otel/pi.d.ts.map +1 -0
- package/dist/otel/pi.js +67 -0
- package/dist/otel/pi.js.map +1 -0
- package/dist/otel/setup.d.ts +23 -0
- package/dist/otel/setup.d.ts.map +1 -0
- package/dist/otel/setup.js +127 -0
- package/dist/otel/setup.js.map +1 -0
- package/dist/otel/span-processor.d.ts +62 -0
- package/dist/otel/span-processor.d.ts.map +1 -0
- package/dist/otel/span-processor.js +319 -0
- package/dist/otel/span-processor.js.map +1 -0
- package/dist/otel/tracing-processor.d.ts +139 -0
- package/dist/otel/tracing-processor.d.ts.map +1 -0
- package/dist/otel/tracing-processor.js +418 -0
- package/dist/otel/tracing-processor.js.map +1 -0
- package/dist/resources/experiments.d.ts +31 -0
- package/dist/resources/experiments.d.ts.map +1 -0
- package/dist/resources/experiments.js +133 -0
- package/dist/resources/experiments.js.map +1 -0
- package/dist/resources/recipes.d.ts +22 -0
- package/dist/resources/recipes.d.ts.map +1 -0
- package/dist/resources/recipes.js +61 -0
- package/dist/resources/recipes.js.map +1 -0
- package/dist/resources/runtimes.d.ts +76 -0
- package/dist/resources/runtimes.d.ts.map +1 -0
- package/dist/resources/runtimes.js +179 -0
- package/dist/resources/runtimes.js.map +1 -0
- package/dist/runner-resources/files.d.ts +35 -0
- package/dist/runner-resources/files.d.ts.map +1 -0
- package/dist/runner-resources/files.js +131 -0
- package/dist/runner-resources/files.js.map +1 -0
- package/dist/runner-resources/tasks.d.ts +39 -0
- package/dist/runner-resources/tasks.d.ts.map +1 -0
- package/dist/runner-resources/tasks.js +129 -0
- package/dist/runner-resources/tasks.js.map +1 -0
- package/dist/runner.d.ts +80 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +159 -0
- package/dist/runner.js.map +1 -0
- package/dist/span-processor.d.ts.map +1 -1
- package/dist/span-processor.js +3 -3
- package/dist/streaming.d.ts +8 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +67 -0
- package/dist/streaming.js.map +1 -0
- package/dist/tracing-processor.d.ts.map +1 -1
- package/dist/tracing-processor.js +3 -3
- package/dist/types/genai.d.ts +165 -0
- package/dist/types/genai.d.ts.map +1 -0
- package/dist/types/genai.js +82 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +14 -0
- package/dist/utils.js.map +1 -0
- package/dist/version.js +1 -0
- package/dist/version.js.map +1 -0
- package/package.json +83 -25
- package/src/client.ts +76 -471
- package/src/converters/claude.ts +11 -1
- package/src/converters/gemini.ts +243 -0
- package/src/converters/index.ts +13 -7
- package/src/converters/vercel.ts +41 -3
- package/src/http.ts +163 -0
- package/src/index.ts +110 -75
- package/src/{anthropic.ts → otel/anthropic.ts} +95 -8
- package/src/{claude-hooks.ts → otel/claude-hooks.ts} +125 -24
- package/src/{claude-wrapper.ts → otel/claude-wrapper.ts} +1 -1
- package/src/otel/gemini.ts +397 -0
- package/src/otel/index.ts +80 -0
- package/src/{langchain-handler.ts → otel/langchain-handler.ts} +56 -7
- package/src/otel/logs.ts +394 -0
- package/src/{mastra-exporter.ts → otel/mastra-exporter.ts} +86 -23
- package/src/otel/pi.ts +88 -0
- package/src/otel/setup.ts +174 -0
- package/src/{span-processor.ts → otel/span-processor.ts} +17 -10
- package/src/{tracing-processor.ts → otel/tracing-processor.ts} +100 -23
- package/src/resources/experiments.ts +170 -0
- package/src/resources/recipes.ts +73 -0
- package/src/resources/runtimes.ts +231 -0
- package/src/runner-resources/files.ts +163 -0
- package/src/runner-resources/tasks.ts +156 -0
- package/src/runner.ts +194 -0
- package/src/streaming.ts +57 -0
- package/src/utils.ts +15 -0
- package/src/ai-sdk-integration.ts +0 -689
- package/src/converters/ai-sdk.ts +0 -323
package/dist/otel/pi.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level pi Agent SDK integration for Introspection.
|
|
3
|
+
*
|
|
4
|
+
* Wraps {@link @introspection-sdk/introspection-pi} behind a zero-config
|
|
5
|
+
* interface so users don't need to manage OpenTelemetry tracers directly.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { IntrospectionPiInstrumentor, setupTracing } from "@introspection-sdk/introspection-node";
|
|
10
|
+
* import { Agent } from "@mariozechner/pi-agent-core";
|
|
11
|
+
*
|
|
12
|
+
* setupTracing({ serviceName: "my-app" });
|
|
13
|
+
* const instrumentor = new IntrospectionPiInstrumentor();
|
|
14
|
+
*
|
|
15
|
+
* const agent = new Agent({ ... });
|
|
16
|
+
* instrumentor.instrument(agent, {
|
|
17
|
+
* conversationId: "conv-123",
|
|
18
|
+
* agentId: "weather-agent",
|
|
19
|
+
* agentName: "Weather",
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* await agent.prompt("What's the weather in Tokyo?");
|
|
23
|
+
* instrumentor.stop();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import { trace } from "@opentelemetry/api";
|
|
27
|
+
import { instrumentStream, instrumentAgent, } from "@introspection-sdk/introspection-pi";
|
|
28
|
+
import { VERSION } from "../version.js";
|
|
29
|
+
/**
|
|
30
|
+
* Zero-config pi Agent SDK integration for Introspection.
|
|
31
|
+
*
|
|
32
|
+
* Uses the global OTel tracer provider (registered by {@link setupTracing}).
|
|
33
|
+
* Call {@link instrument} once per {@link Agent} instance, then {@link stop}
|
|
34
|
+
* to unsubscribe all tool instrumentation and finalize open spans.
|
|
35
|
+
*/
|
|
36
|
+
export class IntrospectionPiInstrumentor {
|
|
37
|
+
_tracer;
|
|
38
|
+
_instrumentations = [];
|
|
39
|
+
constructor(opts = {}) {
|
|
40
|
+
this._tracer = trace.getTracer(opts.tracerName ?? "introspection-pi", VERSION);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Instrument a pi {@link Agent}:
|
|
44
|
+
* - Wraps `agent.streamFn` to emit a `chat ${provider}` span per LLM call.
|
|
45
|
+
* - Subscribes to the agent loop to emit an `execute_tool ${name}` span per
|
|
46
|
+
* tool execution.
|
|
47
|
+
*
|
|
48
|
+
* @param agent - The pi Agent instance to instrument.
|
|
49
|
+
* @param meta - Identity metadata stamped on every span produced by this agent.
|
|
50
|
+
*/
|
|
51
|
+
instrument(agent, meta) {
|
|
52
|
+
agent.streamFn = instrumentStream(agent.streamFn, {
|
|
53
|
+
tracer: this._tracer,
|
|
54
|
+
meta,
|
|
55
|
+
});
|
|
56
|
+
this._instrumentations.push(instrumentAgent(agent, { tracer: this._tracer, meta }));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Unsubscribe all active tool instrumentations and finalize any open spans.
|
|
60
|
+
*/
|
|
61
|
+
stop() {
|
|
62
|
+
for (const inst of this._instrumentations)
|
|
63
|
+
inst.stop();
|
|
64
|
+
this._instrumentations = [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=pi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.js","sourceRoot":"","sources":["../../src/otel/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,eAAe,GAGhB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASxC;;;;;;GAMG;AACH,MAAM,OAAO,2BAA2B;IAC9B,OAAO,CAAqC;IAC5C,iBAAiB,GAA2B,EAAE,CAAC;IAEvD,YAAY,OAA2C,EAAE;QACvD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAC5B,IAAI,CAAC,UAAU,IAAI,kBAAkB,EACrC,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,UAAU,CAAC,KAAY,EAAE,IAAe;QACtC,KAAK,CAAC,QAAQ,GAAG,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE;YAChD,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,IAAI;SACL,CAAC,CAAC;QACH,IAAI,CAAC,iBAAiB,CAAC,IAAI,CACzB,eAAe,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CACvD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI;QACF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,iBAAiB;YAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACvD,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
2
|
+
import { type IntrospectionSpanProcessorOptions } from "./span-processor.js";
|
|
3
|
+
export type ConflictBehavior = "warn" | "throw" | "replace";
|
|
4
|
+
export interface SetupTracingOptions extends IntrospectionSpanProcessorOptions {
|
|
5
|
+
/**
|
|
6
|
+
* What to do if a context manager or propagator is already registered.
|
|
7
|
+
*
|
|
8
|
+
* - `"warn"` (default) — log a warning and continue with the existing
|
|
9
|
+
* registration. Spans still flow but baggage may not propagate as
|
|
10
|
+
* expected. Set `INTROSPECTION_STRICT_TRACING=1` to upgrade to throw.
|
|
11
|
+
* - `"throw"` — throw an error. Use in environments where a silent
|
|
12
|
+
* baggage drop is unacceptable (production telemetry pipelines).
|
|
13
|
+
* - `"replace"` — force-register over the existing manager / propagator.
|
|
14
|
+
* Useful in tests or when migrating from another tracer; can break
|
|
15
|
+
* other libraries that relied on the previous registration.
|
|
16
|
+
*/
|
|
17
|
+
onConflict?: ConflictBehavior;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Initialise Introspection tracing for a Node.js process.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setupTracing(options?: SetupTracingOptions): NodeTracerProvider;
|
|
23
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/otel/setup.ts"],"names":[],"mappings":"AA8DA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,qBAAqB,CAAC;AAI7B,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5D,MAAM,WAAW,mBAAoB,SAAQ,iCAAiC;IAC5E;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AA8DD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,kBAAkB,CAkBpB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-call tracing bootstrap for Introspection.
|
|
3
|
+
*
|
|
4
|
+
* Wires up the three things every host process needs for baggage-based
|
|
5
|
+
* agent / conversation propagation to work:
|
|
6
|
+
*
|
|
7
|
+
* 1. `AsyncLocalStorageContextManager` — without this, `context.with()` is a
|
|
8
|
+
* no-op (the default `NOOP_CONTEXT_MANAGER` silently drops the context),
|
|
9
|
+
* which makes `IntrospectionClient.withAgent()`, `.withConversation()`,
|
|
10
|
+
* etc. dead code.
|
|
11
|
+
* 2. `W3CBaggagePropagator` — so baggage is carried across HTTP boundaries
|
|
12
|
+
* via the `baggage` header (alongside W3C trace-context).
|
|
13
|
+
* 3. A registered `NodeTracerProvider` with an `IntrospectionSpanProcessor`
|
|
14
|
+
* on it — so spans are exported to Introspection and baggage values
|
|
15
|
+
* (conversation / agent IDs) are merged into span attributes at
|
|
16
|
+
* `onEnd()` time.
|
|
17
|
+
*
|
|
18
|
+
* Call this once at process start (before any instrumentors run). It is
|
|
19
|
+
* idempotent across re-invocations — the cached provider is returned and
|
|
20
|
+
* the global registrations are not touched a second time.
|
|
21
|
+
*
|
|
22
|
+
* **Loud-by-default registration.** OTel's `setGlobalContextManager` /
|
|
23
|
+
* `setGlobalPropagator` silently refuse to replace an existing
|
|
24
|
+
* registration. If anything (another lib, a stale call, a test fixture)
|
|
25
|
+
* has already installed a context manager that does NOT propagate W3C
|
|
26
|
+
* baggage, our `withAgent` / `withConversation` calls become silent
|
|
27
|
+
* no-ops and users get spans with no identity attached — exactly the
|
|
28
|
+
* footgun this SDK exists to prevent.
|
|
29
|
+
*
|
|
30
|
+
* `setupTracing` defends against that:
|
|
31
|
+
* - If no manager / propagator is registered: install ours.
|
|
32
|
+
* - If one is registered: WARN (default) or THROW (strict mode) so the
|
|
33
|
+
* host author sees it, rather than discovering missing baggage in
|
|
34
|
+
* production telemetry weeks later.
|
|
35
|
+
*
|
|
36
|
+
* Pass `{ onConflict: "throw" }` (or set `INTROSPECTION_STRICT_TRACING=1`
|
|
37
|
+
* in the env) for the strict variant. Pass `{ onConflict: "replace" }`
|
|
38
|
+
* to force replacement when you know the prior registration is wrong
|
|
39
|
+
* (e.g. test setup, or migrating from another tracer).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { setupTracing, IntrospectionClient } from "@introspection-sdk/introspection-node";
|
|
44
|
+
*
|
|
45
|
+
* setupTracing();
|
|
46
|
+
*
|
|
47
|
+
* const introspect = new IntrospectionClient();
|
|
48
|
+
*
|
|
49
|
+
* await introspect.withAgent("researcher", "researcher-1", () =>
|
|
50
|
+
* introspect.withConversation(conversationId, undefined, () =>
|
|
51
|
+
* client.messages.create({ ... }),
|
|
52
|
+
* ),
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
import { context, propagation } from "@opentelemetry/api";
|
|
57
|
+
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
|
|
58
|
+
import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator, } from "@opentelemetry/core";
|
|
59
|
+
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
60
|
+
import { logger } from "../utils.js";
|
|
61
|
+
import { IntrospectionSpanProcessor, } from "./span-processor.js";
|
|
62
|
+
let registeredProvider;
|
|
63
|
+
function defaultConflictBehavior() {
|
|
64
|
+
return process.env.INTROSPECTION_STRICT_TRACING ? "throw" : "warn";
|
|
65
|
+
}
|
|
66
|
+
function registerContextManager(behavior) {
|
|
67
|
+
const ok = context.setGlobalContextManager(new AsyncLocalStorageContextManager().enable());
|
|
68
|
+
if (ok)
|
|
69
|
+
return;
|
|
70
|
+
// OTel silently refuses replacement — we have to disable+retry to force.
|
|
71
|
+
const msg = "setupTracing: another OTel context manager was already registered. " +
|
|
72
|
+
"withAgent / withConversation baggage scopes will not propagate unless " +
|
|
73
|
+
"that manager is an AsyncLocalStorageContextManager honoring W3C baggage.";
|
|
74
|
+
if (behavior === "throw") {
|
|
75
|
+
throw new Error(`[introspection] ${msg}`);
|
|
76
|
+
}
|
|
77
|
+
if (behavior === "replace") {
|
|
78
|
+
context.disable();
|
|
79
|
+
if (!context.setGlobalContextManager(new AsyncLocalStorageContextManager().enable())) {
|
|
80
|
+
throw new Error("[introspection] setupTracing: failed to replace context manager " +
|
|
81
|
+
"even after disable(); the OTel global registry is in a bad state.");
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
logger.warn(msg);
|
|
86
|
+
}
|
|
87
|
+
function registerPropagator(behavior) {
|
|
88
|
+
const propagator = new CompositePropagator({
|
|
89
|
+
propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()],
|
|
90
|
+
});
|
|
91
|
+
const ok = propagation.setGlobalPropagator(propagator);
|
|
92
|
+
if (ok)
|
|
93
|
+
return;
|
|
94
|
+
const msg = "setupTracing: another OTel propagator was already registered. " +
|
|
95
|
+
"Cross-process baggage propagation depends on the existing propagator " +
|
|
96
|
+
"carrying the W3C `baggage` header.";
|
|
97
|
+
if (behavior === "throw") {
|
|
98
|
+
throw new Error(`[introspection] ${msg}`);
|
|
99
|
+
}
|
|
100
|
+
if (behavior === "replace") {
|
|
101
|
+
propagation.disable();
|
|
102
|
+
if (!propagation.setGlobalPropagator(propagator)) {
|
|
103
|
+
throw new Error("[introspection] setupTracing: failed to replace propagator even " +
|
|
104
|
+
"after disable(); the OTel global registry is in a bad state.");
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
logger.warn(msg);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Initialise Introspection tracing for a Node.js process.
|
|
112
|
+
*/
|
|
113
|
+
export function setupTracing(options) {
|
|
114
|
+
if (registeredProvider) {
|
|
115
|
+
return registeredProvider;
|
|
116
|
+
}
|
|
117
|
+
const behavior = options?.onConflict ?? defaultConflictBehavior();
|
|
118
|
+
registerContextManager(behavior);
|
|
119
|
+
registerPropagator(behavior);
|
|
120
|
+
const provider = new NodeTracerProvider({
|
|
121
|
+
spanProcessors: [new IntrospectionSpanProcessor(options)],
|
|
122
|
+
});
|
|
123
|
+
provider.register();
|
|
124
|
+
registeredProvider = provider;
|
|
125
|
+
return provider;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/otel/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,0BAA0B,GAE3B,MAAM,qBAAqB,CAAC;AAE7B,IAAI,kBAAkD,CAAC;AAoBvD,SAAS,uBAAuB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AACrE,CAAC;AAED,SAAS,sBAAsB,CAAC,QAA0B;IACxD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mB,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CACb,kEAAkE;gBAChE,8DAA8D,CACjE,CAAC;QACJ,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,OAA6B;IAE7B,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,MAAM,QAAQ,GACZ,OAAO,EAAE,UAAU,IAAI,uBAAuB,EAAE,CAAC;IAEnD,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACjC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAE7B,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC;QACtC,cAAc,EAAE,CAAC,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;KAC1D,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEpB,kBAAkB,GAAG,QAAQ,CAAC;IAC9B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Context } from "@opentelemetry/api";
|
|
2
|
+
import { SpanProcessor, ReadableSpan, Span } from "@opentelemetry/sdk-trace-base";
|
|
3
|
+
import type { AdvancedOptions } from "../types.js";
|
|
4
|
+
export interface IntrospectionSpanProcessorOptions {
|
|
5
|
+
/** Authentication token (env: INTROSPECTION_TOKEN) */
|
|
6
|
+
token?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Service name for telemetry (env: INTROSPECTION_SERVICE_NAME).
|
|
9
|
+
* Note: For spans, the service name is typically set on the TracerProvider's resource.
|
|
10
|
+
* This option is provided for consistency but the TracerProvider's resource takes precedence.
|
|
11
|
+
*/
|
|
12
|
+
serviceName?: string;
|
|
13
|
+
/** Advanced options for configuration and testing */
|
|
14
|
+
advanced?: AdvancedOptions;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* OTel {@link SpanProcessor} that forwards traces to the Introspection backend
|
|
18
|
+
* via OTLP, automatically converting any OpenInference spans to Gen AI
|
|
19
|
+
* semantic convention attributes.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { IntrospectionSpanProcessor } from "@introspection-sdk/introspection-node";
|
|
24
|
+
*
|
|
25
|
+
* const processor = new IntrospectionSpanProcessor({ token: "sk-intro-…" });
|
|
26
|
+
* tracerProvider.addSpanProcessor(processor);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class IntrospectionSpanProcessor implements SpanProcessor {
|
|
30
|
+
private _spanProcessor;
|
|
31
|
+
private _serviceName?;
|
|
32
|
+
private _conversationIds;
|
|
33
|
+
constructor(options?: IntrospectionSpanProcessorOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Called when a new span is started; delegates to the inner batch processor.
|
|
36
|
+
*
|
|
37
|
+
* @param span - The span that was just started.
|
|
38
|
+
* @param parentContext - The parent {@link Context}.
|
|
39
|
+
*/
|
|
40
|
+
onStart(span: Span, parentContext: Context): void;
|
|
41
|
+
/**
|
|
42
|
+
* Called when a span ends. If the span originates from an OpenInference
|
|
43
|
+
* instrumentor, its attributes are converted to `gen_ai.*` semconv keys
|
|
44
|
+
* before being forwarded.
|
|
45
|
+
*
|
|
46
|
+
* @param span - The completed {@link ReadableSpan}.
|
|
47
|
+
*/
|
|
48
|
+
onEnd(span: ReadableSpan): void;
|
|
49
|
+
/**
|
|
50
|
+
* Shut down the inner batch processor and its exporter.
|
|
51
|
+
*
|
|
52
|
+
* @returns A promise that resolves once all pending spans are flushed.
|
|
53
|
+
*/
|
|
54
|
+
shutdown(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Force-flush any buffered spans to the Introspection backend.
|
|
57
|
+
*
|
|
58
|
+
* @returns A promise that resolves once the flush completes.
|
|
59
|
+
*/
|
|
60
|
+
forceFlush(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=span-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-processor.d.ts","sourceRoot":"","sources":["../../src/otel/span-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAIR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,IAAI,EAGL,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA8FnD,MAAM,WAAW,iCAAiC;IAChD,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,0BAA2B,YAAW,aAAa;IAC9D,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAAkC;gBAE9C,OAAO,GAAE,iCAAsC;IA0H3D;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAIjD;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAgI/B;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { propagation, context as otelContext, } from "@opentelemetry/api";
|
|
2
|
+
import { BatchSpanProcessor, } from "@opentelemetry/sdk-trace-base";
|
|
3
|
+
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
4
|
+
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
|
|
5
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
|
|
6
|
+
import { ExportResultCode } from "@opentelemetry/core";
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
8
|
+
import { logger, withOtlpHttpsProxy } from "../utils.js";
|
|
9
|
+
import { isOpenInferenceSpan, replaceOpenInferenceWithGenAI, isVercelAISpan, convertVercelAIToGenAI, } from "../converters/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* A {@link ReadableSpan} wrapper that substitutes the original attributes with
|
|
12
|
+
* a converted set while delegating every other property to the original span.
|
|
13
|
+
*
|
|
14
|
+
* Used internally by {@link IntrospectionSpanProcessor} to convert
|
|
15
|
+
* OpenInference attributes to Gen AI semantic conventions on-the-fly.
|
|
16
|
+
*/
|
|
17
|
+
class ConvertedReadableSpan {
|
|
18
|
+
_original;
|
|
19
|
+
_convertedAttributes;
|
|
20
|
+
_resource;
|
|
21
|
+
constructor(original, convertedAttributes, resource) {
|
|
22
|
+
this._original = original;
|
|
23
|
+
this._convertedAttributes = convertedAttributes;
|
|
24
|
+
this._resource = resource;
|
|
25
|
+
}
|
|
26
|
+
get name() {
|
|
27
|
+
return this._original.name;
|
|
28
|
+
}
|
|
29
|
+
get kind() {
|
|
30
|
+
return this._original.kind;
|
|
31
|
+
}
|
|
32
|
+
spanContext() {
|
|
33
|
+
return this._original.spanContext();
|
|
34
|
+
}
|
|
35
|
+
get parentSpanContext() {
|
|
36
|
+
return this._original.parentSpanContext;
|
|
37
|
+
}
|
|
38
|
+
get startTime() {
|
|
39
|
+
return this._original.startTime;
|
|
40
|
+
}
|
|
41
|
+
get endTime() {
|
|
42
|
+
return this._original.endTime;
|
|
43
|
+
}
|
|
44
|
+
get status() {
|
|
45
|
+
return this._original.status;
|
|
46
|
+
}
|
|
47
|
+
get links() {
|
|
48
|
+
return this._original.links;
|
|
49
|
+
}
|
|
50
|
+
get events() {
|
|
51
|
+
return this._original.events;
|
|
52
|
+
}
|
|
53
|
+
get duration() {
|
|
54
|
+
return this._original.duration;
|
|
55
|
+
}
|
|
56
|
+
get ended() {
|
|
57
|
+
return this._original.ended;
|
|
58
|
+
}
|
|
59
|
+
get resource() {
|
|
60
|
+
return this._resource ?? this._original.resource;
|
|
61
|
+
}
|
|
62
|
+
get instrumentationScope() {
|
|
63
|
+
return this._original.instrumentationScope;
|
|
64
|
+
}
|
|
65
|
+
get droppedAttributesCount() {
|
|
66
|
+
return this._original.droppedAttributesCount;
|
|
67
|
+
}
|
|
68
|
+
get droppedEventsCount() {
|
|
69
|
+
return this._original.droppedEventsCount;
|
|
70
|
+
}
|
|
71
|
+
get droppedLinksCount() {
|
|
72
|
+
return this._original.droppedLinksCount;
|
|
73
|
+
}
|
|
74
|
+
get attributes() {
|
|
75
|
+
return this._convertedAttributes;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* OTel {@link SpanProcessor} that forwards traces to the Introspection backend
|
|
80
|
+
* via OTLP, automatically converting any OpenInference spans to Gen AI
|
|
81
|
+
* semantic convention attributes.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { IntrospectionSpanProcessor } from "@introspection-sdk/introspection-node";
|
|
86
|
+
*
|
|
87
|
+
* const processor = new IntrospectionSpanProcessor({ token: "sk-intro-…" });
|
|
88
|
+
* tracerProvider.addSpanProcessor(processor);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export class IntrospectionSpanProcessor {
|
|
92
|
+
_spanProcessor;
|
|
93
|
+
_serviceName;
|
|
94
|
+
_conversationIds = new Map();
|
|
95
|
+
constructor(options = {}) {
|
|
96
|
+
const token = options.token || process.env.INTROSPECTION_TOKEN;
|
|
97
|
+
if (!token) {
|
|
98
|
+
throw new Error("INTROSPECTION_TOKEN is required");
|
|
99
|
+
}
|
|
100
|
+
const serviceName = options.serviceName ||
|
|
101
|
+
process.env.INTROSPECTION_SERVICE_NAME ||
|
|
102
|
+
undefined; // Falls back to TracerProvider's resource
|
|
103
|
+
this._serviceName = serviceName;
|
|
104
|
+
const advanced = options.advanced || {};
|
|
105
|
+
const baseUrl = advanced.baseUrl ||
|
|
106
|
+
process.env.INTROSPECTION_BASE_OTEL_URL ||
|
|
107
|
+
"https://otel.introspection.dev";
|
|
108
|
+
const headers = {
|
|
109
|
+
Authorization: `Bearer ${token}`,
|
|
110
|
+
...(advanced.additionalHeaders || {}),
|
|
111
|
+
};
|
|
112
|
+
// Construct endpoint URL
|
|
113
|
+
let endpoint;
|
|
114
|
+
if (baseUrl.endsWith("/v1/traces")) {
|
|
115
|
+
endpoint = baseUrl;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
endpoint = `${baseUrl.replace(/\/$/, "")}/v1/traces`;
|
|
119
|
+
}
|
|
120
|
+
logger.info(`IntrospectionSpanProcessor initialized: endpoint=${endpoint}${serviceName ? `, serviceName=${serviceName}` : ""}`);
|
|
121
|
+
// Use custom spanExporter if provided (for testing), otherwise create OTLP exporter
|
|
122
|
+
const baseExporter = advanced.spanExporter ||
|
|
123
|
+
new OTLPTraceExporter(withOtlpHttpsProxy({
|
|
124
|
+
url: endpoint,
|
|
125
|
+
headers,
|
|
126
|
+
}));
|
|
127
|
+
// Wrap exporter to add v1/v2 compatibility and basic validation
|
|
128
|
+
const exporter = {
|
|
129
|
+
export: (spans, resultCallback) => {
|
|
130
|
+
// Filter and fix spans: ensure they have required properties and add v1 compatibility
|
|
131
|
+
const validSpans = spans
|
|
132
|
+
.filter((span) => {
|
|
133
|
+
// Basic validation: span must have name and resource
|
|
134
|
+
if (!span?.name || !span.resource) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
// Must have either instrumentationLibrary or instrumentationScope
|
|
138
|
+
const compatSpan = span;
|
|
139
|
+
return !!(compatSpan.instrumentationLibrary ||
|
|
140
|
+
compatSpan.instrumentationScope);
|
|
141
|
+
})
|
|
142
|
+
.map((span) => span)
|
|
143
|
+
.map((span) => {
|
|
144
|
+
// Compatibility: add instrumentationLibrary for spans that only have instrumentationScope (v2)
|
|
145
|
+
const compatSpan = span;
|
|
146
|
+
if (compatSpan.instrumentationScope &&
|
|
147
|
+
!compatSpan.instrumentationLibrary) {
|
|
148
|
+
compatSpan.instrumentationLibrary =
|
|
149
|
+
compatSpan.instrumentationScope;
|
|
150
|
+
}
|
|
151
|
+
return span;
|
|
152
|
+
});
|
|
153
|
+
if (validSpans.length === 0) {
|
|
154
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// Export with error handling
|
|
158
|
+
try {
|
|
159
|
+
baseExporter.export(validSpans, (result) => {
|
|
160
|
+
if (result.code === ExportResultCode.SUCCESS) {
|
|
161
|
+
logger.debug(`Exported ${validSpans.length} span(s) to ${endpoint}`);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
logger.error(`Failed to export ${validSpans.length} span(s): ${result.error?.message || "Unknown error"}`);
|
|
165
|
+
}
|
|
166
|
+
resultCallback(result);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
logger.error(`Export error: ${error instanceof Error ? error.message : String(error)}`);
|
|
171
|
+
resultCallback({
|
|
172
|
+
code: ExportResultCode.FAILED,
|
|
173
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
shutdown: () => baseExporter.shutdown(),
|
|
178
|
+
forceFlush: () => {
|
|
179
|
+
if (baseExporter.forceFlush) {
|
|
180
|
+
return baseExporter.forceFlush();
|
|
181
|
+
}
|
|
182
|
+
return Promise.resolve();
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
// Use BatchSpanProcessor like logfire does
|
|
186
|
+
this._spanProcessor = new BatchSpanProcessor(exporter);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Called when a new span is started; delegates to the inner batch processor.
|
|
190
|
+
*
|
|
191
|
+
* @param span - The span that was just started.
|
|
192
|
+
* @param parentContext - The parent {@link Context}.
|
|
193
|
+
*/
|
|
194
|
+
onStart(span, parentContext) {
|
|
195
|
+
this._spanProcessor.onStart(span, parentContext);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Called when a span ends. If the span originates from an OpenInference
|
|
199
|
+
* instrumentor, its attributes are converted to `gen_ai.*` semconv keys
|
|
200
|
+
* before being forwarded.
|
|
201
|
+
*
|
|
202
|
+
* @param span - The completed {@link ReadableSpan}.
|
|
203
|
+
*/
|
|
204
|
+
onEnd(span) {
|
|
205
|
+
const compatSpan = span;
|
|
206
|
+
const scopeName = compatSpan.instrumentationScope?.name ||
|
|
207
|
+
compatSpan.instrumentationLibrary?.name;
|
|
208
|
+
const isOI = isOpenInferenceSpan(scopeName) ||
|
|
209
|
+
typeof span.attributes["openinference.span.kind"] === "string";
|
|
210
|
+
const isVercel = isVercelAISpan(span.attributes);
|
|
211
|
+
// Skip Vercel AI SDK wrapper spans (ai.streamText, ai.generateText).
|
|
212
|
+
// They duplicate the child doStream/doGenerate output without proper
|
|
213
|
+
// input message windows, causing empty user messages in conversation view.
|
|
214
|
+
// This applies regardless of whether OI attributes are also present.
|
|
215
|
+
const aiOperationId = span.attributes["ai.operationId"];
|
|
216
|
+
if (typeof aiOperationId === "string" &&
|
|
217
|
+
!String(aiOperationId).includes(".do")) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// Skip spans that have no LLM-relevant data — they are infrastructure spans
|
|
221
|
+
// (e.g. Next.js route resolution, HTTP spans) that should not be exported.
|
|
222
|
+
const hasGenAi = isOI ||
|
|
223
|
+
isVercel ||
|
|
224
|
+
span.attributes["gen_ai.system"] != null ||
|
|
225
|
+
span.attributes["gen_ai.operation.name"] != null ||
|
|
226
|
+
span.attributes["gen_ai.request.model"] != null ||
|
|
227
|
+
span.attributes["gen_ai.input.messages"] != null ||
|
|
228
|
+
span.attributes["gen_ai.output.messages"] != null;
|
|
229
|
+
if (!hasGenAi)
|
|
230
|
+
return;
|
|
231
|
+
let attrs;
|
|
232
|
+
if (isOI) {
|
|
233
|
+
attrs = {
|
|
234
|
+
...replaceOpenInferenceWithGenAI(span.attributes),
|
|
235
|
+
};
|
|
236
|
+
// When both OI and Vercel attrs present, merge Vercel-specific
|
|
237
|
+
// enrichments (conversation ID from metadata, etc.)
|
|
238
|
+
if (isVercel) {
|
|
239
|
+
const vercelAttrs = convertVercelAIToGenAI(span.attributes);
|
|
240
|
+
for (const [key, value] of Object.entries(vercelAttrs)) {
|
|
241
|
+
// Prefer Vercel output messages when they contain reasoning
|
|
242
|
+
if (key === "gen_ai.output.messages" &&
|
|
243
|
+
typeof value === "string" &&
|
|
244
|
+
value.includes('"thinking"')) {
|
|
245
|
+
attrs[key] = value;
|
|
246
|
+
}
|
|
247
|
+
else if (attrs[key] === undefined) {
|
|
248
|
+
attrs[key] = value;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
logger.debug(`Converting OpenInference span: ${span.name}`);
|
|
253
|
+
}
|
|
254
|
+
else if (isVercel) {
|
|
255
|
+
attrs = {
|
|
256
|
+
...span.attributes,
|
|
257
|
+
...convertVercelAIToGenAI(span.attributes),
|
|
258
|
+
};
|
|
259
|
+
logger.debug(`Converting Vercel AI span: ${span.name}`);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
attrs = { ...span.attributes };
|
|
263
|
+
}
|
|
264
|
+
// Read baggage from active context
|
|
265
|
+
const baggage = propagation.getBaggage(otelContext.active());
|
|
266
|
+
// Conversation ID: baggage > existing attr > auto-generate per trace
|
|
267
|
+
const baggageConvId = baggage?.getEntry("gen_ai.conversation.id")?.value;
|
|
268
|
+
const existingConvId = attrs["gen_ai.conversation.id"];
|
|
269
|
+
if (baggageConvId) {
|
|
270
|
+
attrs["gen_ai.conversation.id"] = baggageConvId;
|
|
271
|
+
}
|
|
272
|
+
else if (!existingConvId) {
|
|
273
|
+
const traceId = span.spanContext().traceId;
|
|
274
|
+
if (!this._conversationIds.has(traceId)) {
|
|
275
|
+
this._conversationIds.set(traceId, `intro_conv_${randomUUID().replace(/-/g, "")}`);
|
|
276
|
+
}
|
|
277
|
+
attrs["gen_ai.conversation.id"] = this._conversationIds.get(traceId);
|
|
278
|
+
}
|
|
279
|
+
// Default gen_ai.operation.name to "chat" for spans with messages but no operation name
|
|
280
|
+
if (!attrs["gen_ai.operation.name"] &&
|
|
281
|
+
(attrs["gen_ai.input.messages"] || attrs["gen_ai.output.messages"])) {
|
|
282
|
+
attrs["gen_ai.operation.name"] = "chat";
|
|
283
|
+
}
|
|
284
|
+
// Agent name / id from baggage (baggage wins so per-call agent identity
|
|
285
|
+
// overrides any default stamped at instrumentor-construction time).
|
|
286
|
+
const baggageAgentName = baggage?.getEntry("gen_ai.agent.name")?.value;
|
|
287
|
+
if (baggageAgentName) {
|
|
288
|
+
attrs["gen_ai.agent.name"] = baggageAgentName;
|
|
289
|
+
}
|
|
290
|
+
const baggageAgentId = baggage?.getEntry("gen_ai.agent.id")?.value;
|
|
291
|
+
if (baggageAgentId) {
|
|
292
|
+
attrs["gen_ai.agent.id"] = baggageAgentId;
|
|
293
|
+
}
|
|
294
|
+
// Override resource with service name if provided
|
|
295
|
+
let resource;
|
|
296
|
+
if (this._serviceName) {
|
|
297
|
+
resource = span.resource.merge(resourceFromAttributes({ [ATTR_SERVICE_NAME]: this._serviceName }));
|
|
298
|
+
}
|
|
299
|
+
const processedSpan = new ConvertedReadableSpan(span, attrs, resource);
|
|
300
|
+
this._spanProcessor.onEnd(processedSpan);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Shut down the inner batch processor and its exporter.
|
|
304
|
+
*
|
|
305
|
+
* @returns A promise that resolves once all pending spans are flushed.
|
|
306
|
+
*/
|
|
307
|
+
async shutdown() {
|
|
308
|
+
await this._spanProcessor.shutdown();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Force-flush any buffered spans to the Introspection backend.
|
|
312
|
+
*
|
|
313
|
+
* @returns A promise that resolves once the flush completes.
|
|
314
|
+
*/
|
|
315
|
+
async forceFlush() {
|
|
316
|
+
await this._spanProcessor.forceFlush();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=span-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-processor.js","sourceRoot":"","sources":["../../src/otel/span-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,OAAO,IAAI,WAAW,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,kBAAkB,GAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAY,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAgB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAWhC;;;;;;GAMG;AACH,MAAM,qBAAqB;IACjB,SAAS,CAAe;IACxB,oBAAoB,CAAa;IACjC,SAAS,CAAY;IAE7B,YACE,QAAsB,EACtB,mBAA+B,EAC/B,QAAmB;QAEnB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;QAChD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7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