Skip to content

Commit ce49d5b

Browse files
mydeaclaudeJPeer264
authored
feat(node): Add eveInstrumentation and eveIntegration for eve apps (#24539)
eve 0.62/0.63 changed its instrumentation contract in two ways that broke the `node-eve` e2e app and made gen_ai content capture awkward: a flat `agent/instrumentation.ts` is no longer discovered (it must live under `agent/instrumentation/<provider>.ts` and export `defineInstrumentation(...)`), and eve now stamps every AI SDK call with `recordInputs`/`recordOutputs: false`. That per-call flag on the `ai:telemetry` channel outranks the global `dataCollection.genAI` setting, so gen_ai message content was silently dropped — the only escape was setting `recordInputs`/`recordOutputs` per integration, which is poor DX. This adds two APIs in `@sentry/server-utils`, re-exported from the runtime packages: - **`eveIntegration()`** — marks the client so the Vercel AI channel subscriber records gen_ai inputs/outputs by default under eve. An explicit `dataCollection.genAI` or `vercelAIIntegration({ recordInputs })` still take precedence. - **`Sentry.eveInstrumentation(options)`** (in `@sentry/node`) — an all-in-one provider for a single `agent/instrumentation/*.ts` file. It runs `Sentry.init` (adding `eveIntegration`) at server startup and tags each turn's AI spans with the eve session id as the Sentry conversation id via `turn.started` / `step.attempt.started` events, replacing the separate `eveConversationHook` file. Accepts `getConversationId` to customize the id. The `node-eve` e2e app is migrated to eve `^0.63.0` and the new single-file setup. ## New Usage ```ts // agent/instrumentation/sentry.ts import * as Sentry from '@sentry/node'; import { defineInstrumentation } from 'eve/instrumentation'; export default defineInstrumentation( Sentry.eveInstrumentation({ dsn: process.env.E2E_TEST_DSN, tracesSampleRate: 1.0, }), ); ``` --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Jan Peer Stöcklmair <jan.oster94@gmail.com>
1 parent c016c09 commit ce49d5b

20 files changed

Lines changed: 284 additions & 36 deletions

File tree

dev-packages/e2e-tests/test-applications/node-eve/agent/hooks/sentry.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

dev-packages/e2e-tests/test-applications/node-eve/agent/instrumentation.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as Sentry from '@sentry/node';
2+
import { defineInstrumentation } from 'eve/instrumentation';
3+
4+
export default defineInstrumentation(
5+
Sentry.eveInstrumentation({
6+
environment: 'qa',
7+
dsn: process.env.E2E_TEST_DSN,
8+
tunnel: 'http://localhost:3031/', // proxy server
9+
tracesSampleRate: 1.0,
10+
}),
11+
);

dev-packages/e2e-tests/test-applications/node-eve/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@sentry/node": "file:../../packed/sentry-node-packed.tgz",
2727
"ai": "^7.0.82",
2828
"dataloader": "^2.2.3",
29-
"eve": "^0.52.3",
29+
"eve": "^0.63.0",
3030
"zod": "4.5.4"
3131
},
3232
"devDependencies": {

dev-packages/e2e-tests/test-applications/node-eve/tests/eve.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ test('captures Vercel AI agent spans (invoke_agent, generate_content, execute_to
7676
expect(manualSpan?.trace_id).toBe(executeTool?.trace_id);
7777
expect(manualSpan?.parent_span_id).toBe(executeTool?.span_id);
7878

79-
// `agent/hooks/sentry.ts` sets the eve session id as the conversation id via
80-
// `Sentry.eveConversationHook()`, so every gen_ai span in the turn is tagged with it — that is
79+
// `Sentry.eveInstrumentation()` (see `agent/instrumentation/sentry.ts`) sets the eve session id as
80+
// the conversation id on each turn, so every gen_ai span in the turn is tagged with it — that is
8181
// what links a multi-turn session (each turn is its own trace) into one Sentry conversation.
8282
expect(sessionId).toBeTruthy();
8383
for (const span of [invokeAgent, generateContent, executeTool]) {

packages/astro/src/index.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ export {
189189
withStreamedSpan,
190190
metrics,
191191
eveConversationHook,
192+
eveInstrumentation,
193+
eveIntegration,
192194
getInstrumentedModuleNames,
193195
} from '@sentry/node';
194196

packages/aws-serverless/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export {
175175
// oxlint-disable-next-line typescript/no-deprecated
176176
withStreamedSpan,
177177
eveConversationHook,
178+
eveInstrumentation,
179+
eveIntegration,
178180
getInstrumentedModuleNames,
179181
} from '@sentry/node';
180182

packages/bun/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ export {
192192
// oxlint-disable-next-line typescript/no-deprecated
193193
withStreamedSpan,
194194
eveConversationHook,
195+
eveInstrumentation,
196+
eveIntegration,
195197
getInstrumentedModuleNames,
196198
} from '@sentry/node';
197199

packages/cloudflare/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export {
137137
instrumentCreateReactAgent,
138138
vercelAIIntegration,
139139
eveConversationHook,
140+
eveIntegration,
140141
getInstrumentedModuleNames,
141142
} from '@sentry/server-utils';
142143

packages/deno/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export {
151151
postgresJsIntegration,
152152
tediousIntegration,
153153
eveConversationHook,
154+
eveIntegration,
154155
getInstrumentedModuleNames,
155156
} from '@sentry/server-utils';
156157
export { openTelemetryIntegration, getOtlpTracesEndpoint } from '@sentry/server-utils/no-diagnostic-channels';

0 commit comments

Comments
 (0)