Skip to content

test(server-utils): Cover the Flue instrumentation - #24266

Draft
RulaKhaled wants to merge 1 commit into
feat/flue-instrumentation-basefrom
feat/flue-instrumentation-tests
Draft

test(server-utils): Cover the Flue instrumentation#24266
RulaKhaled wants to merge 1 commit into
feat/flue-instrumentation-basefrom
feat/flue-instrumentation-tests

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #24265 — review that first; this diff is tests only.

Unit (15 cases): span shapes and ops, the conversation id lifted off the re-entered agent operation, the usage/cost mapping, the all-zero-usage guard on failed turns, tool spans and their error status, content recording with its recordInputs/recordOutputs gating, and dispose.

Integration: drives an agent through a tool call and asserts the full invoke_agentchat / execute_tool hierarchy, including that tool spans are siblings of chat under the agent invocation rather than children — matching how Flue's own OpenTelemetry adapter projects them.

The scenario uses pi-ai's built-in faux provider rather than a mock HTTP server, so responses are scripted in-process and no provider key is needed. It is ESM only — @flue/runtime has no require export condition, so the cjs mode returns early — and @flue/runtime is installed per-suite because its engines.node >= 22.19 would break yarn install on the Node 20 lane. Guarded by conditionalTest({ min: 22 }), so it skips on the repo's default Node 20; verified on Node 24.

Both suites were mutation-tested rather than just run green: reverting the zero-usage guard, the conversation-id lift and the tool-span handling each produced a failure. One test passed vacuously on the first attempt and was fixed.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.81 kB added added
@sentry/browser - with treeshaking flags 27.12 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 27.01 kB added added
@sentry/browser (incl. Tracing) 49.22 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.22 kB added added
@sentry/browser (incl. Tracing, Profiling) 52.15 kB added added
@sentry/browser (incl. Tracing, Replay) 88.76 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.94 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 93.44 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 106.38 kB added added
@sentry/browser (incl. Feedback) 46.3 kB added added
@sentry/browser (incl. sendFeedback) 33.87 kB added added
@sentry/browser (incl. FeedbackAsync) 38.99 kB added added
@sentry/browser (incl. Metrics) 29.84 kB added added
@sentry/browser (incl. Logs) 30.1 kB added added
@sentry/browser (incl. Metrics & Logs) 30.78 kB added added
@sentry/react 30.57 kB added added
@sentry/react (incl. Tracing) 51.57 kB added added
@sentry/vue 36.07 kB added added
@sentry/vue (incl. Tracing) 51.49 kB added added
@sentry/svelte 28.85 kB added added
CDN Bundle 30.56 kB added added
CDN Bundle (incl. Tracing) 49.76 kB added added
CDN Bundle (incl. Logs, Metrics) 32.83 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 51.7 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 73.48 kB added added
CDN Bundle (incl. Tracing, Replay) 87.28 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.2 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 93.21 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.22 kB added added
CDN Bundle - uncompressed 90.47 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.17 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.04 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.13 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.3 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.76 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.71 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.46 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.4 kB added added
@sentry/nextjs (client) 54.03 kB added added
@sentry/sveltekit (client) 49.68 kB added added
@sentry/core/server 36.99 kB added added
@sentry/core/browser 13.55 kB added added
@sentry/node 127.9 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.61 kB added added
@sentry/node - without tracing 88.73 kB added added
@sentry/node - without channel injection 107.15 kB added added
@sentry/aws-serverless 97.12 kB added added
@sentry/cloudflare (withSentry) - minified 202.05 kB added added
@sentry/cloudflare (withSentry) 502.91 kB added added

@RulaKhaled
RulaKhaled force-pushed the feat/flue-instrumentation-tests branch from 89239da to deb3330 Compare September 9, 2026 19:00
@RulaKhaled
RulaKhaled force-pushed the feat/flue-instrumentation-tests branch from deb3330 to bdda8e5 Compare September 9, 2026 19:08
@RulaKhaled
RulaKhaled force-pushed the feat/flue-instrumentation-base branch from 9fb3fcd to d62f4f2 Compare September 10, 2026 07:41
@RulaKhaled
RulaKhaled force-pushed the feat/flue-instrumentation-tests branch from bdda8e5 to 612798a Compare September 10, 2026 07:41
Unit tests over `createFlueInstrumentation` for the span shapes, the conversation
id lifted off the re-entered agent operation, the usage/cost mapping, the
all-zero-usage guard on failed turns, tool spans, content recording and its
`recordInputs`/`recordOutputs` gating, and dispose.

The integration test drives a real agent through a tool call using `pi-ai`'s
`faux` provider, so the run is deterministic and needs no provider key or mock
server. ESM only: `@flue/runtime` has no `require` export condition, and it is
installed per-suite because its `engines.node >= 22.19` would break `yarn
install` on the Node 20 CI matrix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@RulaKhaled
RulaKhaled force-pushed the feat/flue-instrumentation-base branch from d62f4f2 to a0e8143 Compare September 11, 2026 06:13
@RulaKhaled
RulaKhaled force-pushed the feat/flue-instrumentation-tests branch from 612798a to 411cfed Compare September 11, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant