@introspection-sdk/introspection-node 0.20.0 → 0.21.0
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/README.md +28 -8
- package/dist/auth.d.ts +1 -1
- package/dist/client.d.ts +4 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -7
- package/dist/client.js.map +1 -1
- package/dist/dev-target.js +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/otel/index.d.ts +1 -14
- package/dist/otel/index.d.ts.map +1 -1
- package/dist/otel/index.js +10 -18
- package/dist/otel/index.js.map +1 -1
- package/dist/otel/init.d.ts +19 -21
- package/dist/otel/init.d.ts.map +1 -1
- package/dist/otel/init.js +62 -48
- package/dist/otel/init.js.map +1 -1
- package/dist/otel/integrations/base.d.ts +17 -37
- package/dist/otel/integrations/base.d.ts.map +1 -1
- package/dist/otel/integrations/base.js +6 -13
- package/dist/otel/integrations/base.js.map +1 -1
- package/dist/otel/integrations/index.d.ts +3 -4
- package/dist/otel/integrations/index.d.ts.map +1 -1
- package/dist/otel/integrations/index.js +6 -25
- package/dist/otel/integrations/index.js.map +1 -1
- package/dist/otel/integrations/pi.d.ts.map +1 -1
- package/dist/otel/integrations/pi.js +9 -1
- package/dist/otel/integrations/pi.js.map +1 -1
- package/dist/otel/logs.d.ts +41 -8
- package/dist/otel/logs.d.ts.map +1 -1
- package/dist/otel/logs.js +95 -66
- package/dist/otel/logs.js.map +1 -1
- package/dist/otel/pi.d.ts +18 -5
- package/dist/otel/pi.d.ts.map +1 -1
- package/dist/otel/pi.js +38 -9
- package/dist/otel/pi.js.map +1 -1
- package/dist/otel/register.d.ts +2 -2
- package/dist/otel/register.d.ts.map +1 -1
- package/dist/otel/register.js +7 -9
- package/dist/otel/register.js.map +1 -1
- package/dist/otel/setup.d.ts +2 -2
- package/dist/otel/setup.d.ts.map +1 -1
- package/dist/otel/setup.js +16 -6
- package/dist/otel/setup.js.map +1 -1
- package/dist/otel/span-processor.d.ts +18 -5
- package/dist/otel/span-processor.d.ts.map +1 -1
- package/dist/otel/span-processor.js +50 -65
- package/dist/otel/span-processor.js.map +1 -1
- package/dist/resources/experiments.d.ts +10 -5
- package/dist/resources/experiments.d.ts.map +1 -1
- package/dist/resources/experiments.js +9 -25
- package/dist/resources/experiments.js.map +1 -1
- package/dist/resources/recipes.d.ts +6 -6
- package/dist/resources/recipes.d.ts.map +1 -1
- package/dist/resources/recipes.js +5 -23
- package/dist/resources/recipes.js.map +1 -1
- package/dist/resources/runtimes.d.ts +2 -2
- package/dist/resources/runtimes.d.ts.map +1 -1
- package/dist/resources/runtimes.js +2 -2
- package/dist/resources/runtimes.js.map +1 -1
- package/dist/runner.d.ts +8 -4
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +26 -18
- package/dist/runner.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +45 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +61 -2
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +18 -60
- package/.turbo/turbo-build.log +0 -4
- package/dist/converters/claude.d.ts +0 -150
- package/dist/converters/claude.d.ts.map +0 -1
- package/dist/converters/claude.js +0 -211
- package/dist/converters/claude.js.map +0 -1
- package/dist/converters/gemini.d.ts +0 -90
- package/dist/converters/gemini.d.ts.map +0 -1
- package/dist/converters/gemini.js +0 -171
- package/dist/converters/gemini.js.map +0 -1
- package/dist/converters/index.d.ts +0 -9
- package/dist/converters/index.d.ts.map +0 -1
- package/dist/converters/index.js +0 -9
- package/dist/converters/index.js.map +0 -1
- package/dist/converters/openai.d.ts +0 -51
- package/dist/converters/openai.d.ts.map +0 -1
- package/dist/converters/openai.js +0 -269
- package/dist/converters/openai.js.map +0 -1
- package/dist/converters/openinference.d.ts +0 -107
- package/dist/converters/openinference.d.ts.map +0 -1
- package/dist/converters/openinference.js +0 -553
- package/dist/converters/openinference.js.map +0 -1
- package/dist/converters/vercel.d.ts +0 -21
- package/dist/converters/vercel.d.ts.map +0 -1
- package/dist/converters/vercel.js +0 -236
- package/dist/converters/vercel.js.map +0 -1
- package/dist/otel/anthropic.d.ts +0 -63
- package/dist/otel/anthropic.d.ts.map +0 -1
- package/dist/otel/anthropic.js +0 -475
- package/dist/otel/anthropic.js.map +0 -1
- package/dist/otel/claude-hooks.d.ts +0 -346
- package/dist/otel/claude-hooks.d.ts.map +0 -1
- package/dist/otel/claude-hooks.js +0 -647
- package/dist/otel/claude-hooks.js.map +0 -1
- package/dist/otel/claude-wrapper.d.ts +0 -93
- package/dist/otel/claude-wrapper.d.ts.map +0 -1
- package/dist/otel/claude-wrapper.js +0 -155
- package/dist/otel/claude-wrapper.js.map +0 -1
- package/dist/otel/gemini.d.ts +0 -56
- package/dist/otel/gemini.d.ts.map +0 -1
- package/dist/otel/gemini.js +0 -350
- package/dist/otel/gemini.js.map +0 -1
- package/dist/otel/integrations/anthropic.d.ts +0 -10
- package/dist/otel/integrations/anthropic.d.ts.map +0 -1
- package/dist/otel/integrations/anthropic.js +0 -26
- package/dist/otel/integrations/anthropic.js.map +0 -1
- package/dist/otel/integrations/claude-agent.d.ts +0 -12
- package/dist/otel/integrations/claude-agent.d.ts.map +0 -1
- package/dist/otel/integrations/claude-agent.js +0 -28
- package/dist/otel/integrations/claude-agent.js.map +0 -1
- package/dist/otel/integrations/gemini.d.ts +0 -11
- package/dist/otel/integrations/gemini.d.ts.map +0 -1
- package/dist/otel/integrations/gemini.js +0 -23
- package/dist/otel/integrations/gemini.js.map +0 -1
- package/dist/otel/integrations/langchain.d.ts +0 -15
- package/dist/otel/integrations/langchain.d.ts.map +0 -1
- package/dist/otel/integrations/langchain.js +0 -43
- package/dist/otel/integrations/langchain.js.map +0 -1
- package/dist/otel/integrations/mastra.d.ts +0 -14
- package/dist/otel/integrations/mastra.d.ts.map +0 -1
- package/dist/otel/integrations/mastra.js +0 -31
- package/dist/otel/integrations/mastra.js.map +0 -1
- package/dist/otel/integrations/openai-agents.d.ts +0 -11
- package/dist/otel/integrations/openai-agents.d.ts.map +0 -1
- package/dist/otel/integrations/openai-agents.js +0 -30
- package/dist/otel/integrations/openai-agents.js.map +0 -1
- package/dist/otel/integrations/vercel.d.ts +0 -14
- package/dist/otel/integrations/vercel.d.ts.map +0 -1
- package/dist/otel/integrations/vercel.js +0 -20
- package/dist/otel/integrations/vercel.js.map +0 -1
- package/dist/otel/langchain-handler.d.ts +0 -112
- package/dist/otel/langchain-handler.d.ts.map +0 -1
- package/dist/otel/langchain-handler.js +0 -561
- package/dist/otel/langchain-handler.js.map +0 -1
- package/dist/otel/mastra-exporter.d.ts +0 -87
- package/dist/otel/mastra-exporter.d.ts.map +0 -1
- package/dist/otel/mastra-exporter.js +0 -530
- package/dist/otel/mastra-exporter.js.map +0 -1
- package/dist/otel/openai.d.ts +0 -20
- package/dist/otel/openai.d.ts.map +0 -1
- package/dist/otel/openai.js +0 -55
- package/dist/otel/openai.js.map +0 -1
- package/dist/otel/tracing-processor.d.ts +0 -139
- package/dist/otel/tracing-processor.d.ts.map +0 -1
- package/dist/otel/tracing-processor.js +0 -434
- package/dist/otel/tracing-processor.js.map +0 -1
- package/eslint.config.mjs +0 -4
- package/src/auth.ts +0 -236
- package/src/client.ts +0 -163
- package/src/converters/claude.ts +0 -343
- package/src/converters/gemini.ts +0 -243
- package/src/converters/index.ts +0 -50
- package/src/converters/openai.ts +0 -300
- package/src/converters/openinference.ts +0 -665
- package/src/converters/vercel.ts +0 -302
- package/src/dev-target.ts +0 -79
- package/src/http.ts +0 -43
- package/src/index.ts +0 -277
- package/src/otel/anthropic.ts +0 -619
- package/src/otel/claude-hooks.ts +0 -1116
- package/src/otel/claude-wrapper.ts +0 -239
- package/src/otel/gemini.ts +0 -483
- package/src/otel/index.ts +0 -128
- package/src/otel/init.ts +0 -411
- package/src/otel/integrations/anthropic.ts +0 -36
- package/src/otel/integrations/base.ts +0 -158
- package/src/otel/integrations/claude-agent.ts +0 -36
- package/src/otel/integrations/gemini.ts +0 -30
- package/src/otel/integrations/index.ts +0 -152
- package/src/otel/integrations/langchain.ts +0 -60
- package/src/otel/integrations/mastra.ts +0 -48
- package/src/otel/integrations/openai-agents.ts +0 -47
- package/src/otel/integrations/pi.ts +0 -28
- package/src/otel/integrations/vercel.ts +0 -26
- package/src/otel/langchain-handler.ts +0 -804
- package/src/otel/logs.ts +0 -395
- package/src/otel/mastra-exporter.ts +0 -714
- package/src/otel/openai.ts +0 -93
- package/src/otel/pi.ts +0 -94
- package/src/otel/register.ts +0 -50
- package/src/otel/setup.ts +0 -215
- package/src/otel/span-processor.ts +0 -512
- package/src/otel/tracing-processor.ts +0 -637
- package/src/pagination.ts +0 -10
- package/src/proxy-from-env.d.ts +0 -7
- package/src/resources/experiments.ts +0 -176
- package/src/resources/recipes.ts +0 -74
- package/src/resources/runtimes.ts +0 -31
- package/src/runner.ts +0 -213
- package/src/types.ts +0 -13
- package/src/utils.ts +0 -95
- package/src/version.ts +0 -2
- package/tsconfig.json +0 -8
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration discovery + setup loader for `introspection.init()`.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors the Python SDK's registry: built-in integrations are resolved
|
|
5
|
-
* lazily (a missing framework just skips its shim), `setupOnce` runs at most
|
|
6
|
-
* once per identifier per process, and an integration may `deactivate` others.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { logger } from "../../utils.js";
|
|
10
|
-
import {
|
|
11
|
-
DidNotEnable,
|
|
12
|
-
isModuleNotFound,
|
|
13
|
-
type Integration,
|
|
14
|
-
type IntegrationHandles,
|
|
15
|
-
type IntegrationSetupContext,
|
|
16
|
-
} from "./base.js";
|
|
17
|
-
|
|
18
|
-
export { DidNotEnable, isModuleNotFound };
|
|
19
|
-
export type { Integration, IntegrationHandles, IntegrationSetupContext };
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Built-in integrations, loaded lazily. Each integration probes its optional
|
|
23
|
-
* framework package at runtime, so importing the OTel barrel never requires
|
|
24
|
-
* every optional framework SDK to be installed.
|
|
25
|
-
*/
|
|
26
|
-
const BUILTIN_INTEGRATIONS: ReadonlyArray<
|
|
27
|
-
() => Promise<{ default: Integration }>
|
|
28
|
-
> = [
|
|
29
|
-
() => import("./anthropic.js"),
|
|
30
|
-
() => import("./gemini.js"),
|
|
31
|
-
() => import("./openai-agents.js"),
|
|
32
|
-
() => import("./vercel.js"),
|
|
33
|
-
() => import("./claude-agent.js"),
|
|
34
|
-
() => import("./langchain.js"),
|
|
35
|
-
() => import("./mastra.js"),
|
|
36
|
-
() => import("./pi.js"),
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
const installed = new Set<string>();
|
|
40
|
-
// Teardown callbacks returned by integration setupOnce (e.g. uninstrument a
|
|
41
|
-
// prototype patch), run by teardownIntegrations() on shutdown.
|
|
42
|
-
const teardowns: Array<() => void> = [];
|
|
43
|
-
|
|
44
|
-
async function availableIntegrations(
|
|
45
|
-
integrations: Integration[],
|
|
46
|
-
): Promise<Integration[]> {
|
|
47
|
-
const available: Integration[] = [];
|
|
48
|
-
|
|
49
|
-
for (const integration of integrations) {
|
|
50
|
-
if (integration.isAvailable && !(await integration.isAvailable())) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
available.push(integration);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return available;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Return the built-in integrations whose framework is importable.
|
|
61
|
-
*
|
|
62
|
-
* Missing optional peer packages are expected and skipped quietly. Any OTHER
|
|
63
|
-
* failure is surfaced at warn level rather than silently swallowed — it's a
|
|
64
|
-
* bug, not an absent peer.
|
|
65
|
-
*/
|
|
66
|
-
export async function discoverIntegrations(): Promise<Integration[]> {
|
|
67
|
-
const found: Integration[] = [];
|
|
68
|
-
for (const load of BUILTIN_INTEGRATIONS) {
|
|
69
|
-
try {
|
|
70
|
-
const mod = await load();
|
|
71
|
-
if (mod.default) found.push(mod.default);
|
|
72
|
-
} catch (e) {
|
|
73
|
-
if (isModuleNotFound(e)) {
|
|
74
|
-
logger.debug(
|
|
75
|
-
`Skipping integration (framework not installed): ${String(e)}`,
|
|
76
|
-
);
|
|
77
|
-
} else {
|
|
78
|
-
logger.warn(
|
|
79
|
-
`Integration failed to load with an unexpected error (skipping): ${String(e)}`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return availableIntegrations(found);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Run each integration's `setupOnce` once, honouring `deactivates`.
|
|
89
|
-
*
|
|
90
|
-
* @returns the set of identifiers installed so far this process.
|
|
91
|
-
*/
|
|
92
|
-
export async function setupIntegrations(
|
|
93
|
-
integrations: Integration[],
|
|
94
|
-
ctx: IntegrationSetupContext,
|
|
95
|
-
): Promise<Set<string>> {
|
|
96
|
-
// First-wins de-dupe by identifier.
|
|
97
|
-
const byId = new Map<string, Integration>();
|
|
98
|
-
for (const integration of await availableIntegrations(integrations)) {
|
|
99
|
-
if (!byId.has(integration.identifier)) {
|
|
100
|
-
byId.set(integration.identifier, integration);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const disabled = new Set<string>();
|
|
105
|
-
for (const integration of byId.values()) {
|
|
106
|
-
for (const id of integration.deactivates ?? []) disabled.add(id);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
for (const [identifier, integration] of byId) {
|
|
110
|
-
if (disabled.has(identifier)) {
|
|
111
|
-
logger.debug(
|
|
112
|
-
`Skipping ${identifier} (deactivated by another integration)`,
|
|
113
|
-
);
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
if (installed.has(identifier)) continue;
|
|
117
|
-
try {
|
|
118
|
-
const teardown = await integration.setupOnce(ctx);
|
|
119
|
-
if (typeof teardown === "function") teardowns.push(teardown);
|
|
120
|
-
installed.add(identifier);
|
|
121
|
-
} catch (e) {
|
|
122
|
-
if (e instanceof DidNotEnable) {
|
|
123
|
-
logger.debug(`Could not enable ${identifier}: ${e.message}`);
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
throw e;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return new Set(installed);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Run every integration teardown and clear the run-once guard, so the next
|
|
135
|
-
* `setupIntegrations()` (e.g. after `introspection.shutdown()` + a fresh
|
|
136
|
-
* `init()`) re-installs against the rebuilt provider instead of being skipped.
|
|
137
|
-
*/
|
|
138
|
-
export function teardownIntegrations(): void {
|
|
139
|
-
for (const teardown of teardowns.splice(0)) {
|
|
140
|
-
try {
|
|
141
|
-
teardown();
|
|
142
|
-
} catch (e) {
|
|
143
|
-
logger.debug(`Error tearing down integration: ${String(e)}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
installed.clear();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/** Clear the run-once guard (running teardowns). Test-only utility. */
|
|
150
|
-
export function resetInstalledForTests(): void {
|
|
151
|
-
teardownIntegrations();
|
|
152
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LangChain / LangGraph integration.
|
|
3
|
-
*
|
|
4
|
-
* The callback handler is attached per-invoke (`chain.invoke(input, { callbacks
|
|
5
|
-
* })`), so this integration builds the handler — pre-bound to the `init()`
|
|
6
|
-
* token — and publishes it via `introspection.getLangchainHandler()`.
|
|
7
|
-
*
|
|
8
|
-
* Deactivates the Anthropic integration: when LangChain drives the Anthropic
|
|
9
|
-
* model, the handler already traces the call, so the prototype-level Anthropic
|
|
10
|
-
* patch would double-trace it.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
importOptionalPeer,
|
|
15
|
-
isOptionalPeerInstalled,
|
|
16
|
-
OPTIONAL_PEERS,
|
|
17
|
-
type Integration,
|
|
18
|
-
} from "./base.js";
|
|
19
|
-
import type { IntrospectionCallbackHandler } from "../langchain-handler.js";
|
|
20
|
-
|
|
21
|
-
const importLocal = (specifier: string) =>
|
|
22
|
-
import(specifier) as Promise<{
|
|
23
|
-
IntrospectionCallbackHandler: new (
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
options: any,
|
|
26
|
-
) => IntrospectionCallbackHandler;
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
|
-
const integration: Integration = {
|
|
30
|
-
identifier: "langchain",
|
|
31
|
-
isAvailable: () => isOptionalPeerInstalled(OPTIONAL_PEERS.langchainCallbacks),
|
|
32
|
-
// Intentional, and matches the Python SDK: when @langchain/core is present,
|
|
33
|
-
// auto-discovery skips the always-on raw-Anthropic prototype patch so a
|
|
34
|
-
// LangChain → ChatAnthropic call isn't traced twice (once by LangChain's
|
|
35
|
-
// callback handler, once by the raw `messages.create` patch).
|
|
36
|
-
//
|
|
37
|
-
// Trade-off (by design): if an app has BOTH @langchain/core installed AND
|
|
38
|
-
// makes raw `@anthropic-ai/sdk` calls outside LangChain, those raw calls
|
|
39
|
-
// won't be auto-traced. To trace them, instrument explicitly with
|
|
40
|
-
// `new AnthropicInstrumentor().instrumentClass(...)`, or call
|
|
41
|
-
// `init({ autoDiscover: false, integrations: [anthropicIntegration] })`.
|
|
42
|
-
deactivates: ["anthropic"],
|
|
43
|
-
async setupOnce({ token, serviceName, baseUrl, advanced, handles }) {
|
|
44
|
-
await importOptionalPeer(OPTIONAL_PEERS.langchainCallbacks);
|
|
45
|
-
const { IntrospectionCallbackHandler } = await importLocal(
|
|
46
|
-
"../langchain-handler.js",
|
|
47
|
-
);
|
|
48
|
-
handles.langchainHandler = new IntrospectionCallbackHandler({
|
|
49
|
-
token,
|
|
50
|
-
serviceName,
|
|
51
|
-
baseUrl,
|
|
52
|
-
additionalHeaders: advanced?.additionalHeaders,
|
|
53
|
-
advanced: advanced?.spanExporter
|
|
54
|
-
? { spanExporter: advanced.spanExporter }
|
|
55
|
-
: undefined,
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default integration;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mastra integration.
|
|
3
|
-
*
|
|
4
|
-
* The Mastra exporter is wired into Mastra's `observability.configs` rather
|
|
5
|
-
* than globally, so this integration builds the exporter — pre-bound to the
|
|
6
|
-
* `init()` token — and publishes it via `introspection.getMastraExporter()`.
|
|
7
|
-
*
|
|
8
|
-
* Importing `../mastra-exporter.js` (which requires `@mastra/observability`)
|
|
9
|
-
* is the presence gate: a missing Mastra makes discovery skip this shim.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
importOptionalPeer,
|
|
14
|
-
isOptionalPeerInstalled,
|
|
15
|
-
OPTIONAL_PEERS,
|
|
16
|
-
type Integration,
|
|
17
|
-
} from "./base.js";
|
|
18
|
-
|
|
19
|
-
const importLocal = (specifier: string) =>
|
|
20
|
-
import(specifier) as Promise<{
|
|
21
|
-
IntrospectionMastraExporter: new (
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
options: any,
|
|
24
|
-
) => unknown;
|
|
25
|
-
}>;
|
|
26
|
-
|
|
27
|
-
const integration: Integration = {
|
|
28
|
-
identifier: "mastra",
|
|
29
|
-
isAvailable: () =>
|
|
30
|
-
isOptionalPeerInstalled(OPTIONAL_PEERS.mastraObservability),
|
|
31
|
-
async setupOnce({ token, baseUrl, advanced, handles }) {
|
|
32
|
-
await importOptionalPeer(OPTIONAL_PEERS.mastraObservability);
|
|
33
|
-
const { IntrospectionMastraExporter } = await importLocal(
|
|
34
|
-
"../mastra-exporter.js",
|
|
35
|
-
);
|
|
36
|
-
handles.mastraExporter = new IntrospectionMastraExporter({
|
|
37
|
-
token,
|
|
38
|
-
baseUrl,
|
|
39
|
-
additionalHeaders: advanced?.additionalHeaders,
|
|
40
|
-
debug: advanced?.debug,
|
|
41
|
-
advanced: advanced?.spanExporter
|
|
42
|
-
? { spanExporter: advanced.spanExporter }
|
|
43
|
-
: undefined,
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default integration;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI Agents SDK integration.
|
|
3
|
-
*
|
|
4
|
-
* Registers an {@link IntrospectionTracingProcessor} with the Agents SDK's
|
|
5
|
-
* global trace pipeline. `addTraceProcessor` appends, preserving any processors
|
|
6
|
-
* other integrations (e.g. a vendor exporter) already registered.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { IntrospectionTracingProcessor } from "../tracing-processor.js";
|
|
10
|
-
import {
|
|
11
|
-
importOptionalPeer,
|
|
12
|
-
isOptionalPeerInstalled,
|
|
13
|
-
OPTIONAL_PEERS,
|
|
14
|
-
type Integration,
|
|
15
|
-
} from "./base.js";
|
|
16
|
-
|
|
17
|
-
interface OpenAIAgentsModule {
|
|
18
|
-
addTraceProcessor?: (processor: IntrospectionTracingProcessor) => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const integration: Integration = {
|
|
22
|
-
identifier: "openai_agents",
|
|
23
|
-
isAvailable: () => isOptionalPeerInstalled(OPTIONAL_PEERS.openaiAgents),
|
|
24
|
-
async setupOnce({ token, serviceName, baseUrl, advanced }) {
|
|
25
|
-
const { addTraceProcessor } = await importOptionalPeer<OpenAIAgentsModule>(
|
|
26
|
-
OPTIONAL_PEERS.openaiAgents,
|
|
27
|
-
);
|
|
28
|
-
if (!addTraceProcessor) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
"Invalid @openai/agents module: addTraceProcessor missing",
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
addTraceProcessor(
|
|
34
|
-
new IntrospectionTracingProcessor({
|
|
35
|
-
token,
|
|
36
|
-
serviceName,
|
|
37
|
-
baseUrl,
|
|
38
|
-
additionalHeaders: advanced?.additionalHeaders,
|
|
39
|
-
advanced: advanced?.spanExporter
|
|
40
|
-
? { spanExporter: advanced.spanExporter }
|
|
41
|
-
: undefined,
|
|
42
|
-
}),
|
|
43
|
-
);
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default integration;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pi Agent SDK integration.
|
|
3
|
-
*
|
|
4
|
-
* The Pi instrumentor wraps a specific `Agent` instance, so this integration
|
|
5
|
-
* builds the instrumentor — bound to the shared provider's global tracer — and
|
|
6
|
-
* publishes it via `introspection.instrumentPi(agent, meta)`.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { IntrospectionPiInstrumentor } from "../pi.js";
|
|
10
|
-
import {
|
|
11
|
-
importOptionalPeer,
|
|
12
|
-
isOptionalPeerInstalled,
|
|
13
|
-
OPTIONAL_PEERS,
|
|
14
|
-
type Integration,
|
|
15
|
-
} from "./base.js";
|
|
16
|
-
|
|
17
|
-
const integration: Integration = {
|
|
18
|
-
identifier: "pi",
|
|
19
|
-
isAvailable: () => isOptionalPeerInstalled(OPTIONAL_PEERS.piAgentCore),
|
|
20
|
-
async setupOnce({ handles }) {
|
|
21
|
-
await importOptionalPeer(OPTIONAL_PEERS.piAgentCore);
|
|
22
|
-
// The instrumentor emits onto the global tracer, which `init()` has just
|
|
23
|
-
// registered with the shared IntrospectionSpanProcessor.
|
|
24
|
-
handles.piInstrumentor = new IntrospectionPiInstrumentor();
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default integration;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vercel AI SDK integration.
|
|
3
|
-
*
|
|
4
|
-
* The AI SDK emits `ai.*` / `gen_ai.*` attributes natively via OTel when
|
|
5
|
-
* `experimental_telemetry` is enabled. The shared provider already carries an
|
|
6
|
-
* {@link IntrospectionSpanProcessor}, which converts those `ai.*` attributes to
|
|
7
|
-
* canonical `gen_ai.*` semconv at span end — so there is nothing to patch here.
|
|
8
|
-
* This integration exists so auto-discovery reports the AI SDK as detected and
|
|
9
|
-
* (via its top-level import) is skipped when `ai` is not installed.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
isOptionalPeerInstalled,
|
|
14
|
-
OPTIONAL_PEERS,
|
|
15
|
-
type Integration,
|
|
16
|
-
} from "./base.js";
|
|
17
|
-
|
|
18
|
-
const integration: Integration = {
|
|
19
|
-
identifier: "vercel",
|
|
20
|
-
isAvailable: () => isOptionalPeerInstalled(OPTIONAL_PEERS.vercelAi),
|
|
21
|
-
setupOnce() {
|
|
22
|
-
// No-op: the shared IntrospectionSpanProcessor converts AI SDK spans.
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default integration;
|