Skip to content

chore: update Sentry integration - #2931

Merged
wilsonrivera merged 1 commit into
mainfrom
wilson/eng-9690-controlplane-add-queuesize-to-composition-worker-span
Jun 8, 2026
Merged

chore: update Sentry integration#2931
wilsonrivera merged 1 commit into
mainfrom
wilson/eng-9690-controlplane-add-queuesize-to-composition-worker-span

Conversation

@wilsonrivera

@wilsonrivera wilsonrivera commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor

    • Restructured composition worker entry point for improved event handling and cleanup
  • Chores

    • Enhanced monitoring infrastructure with improved Sentry integration
    • Optimized task execution reliability through improved resource pool management
    • Ensured all monitoring events are properly captured and transmitted

Checklist

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

@wilsonrivera
wilsonrivera requested a review from a team as a code owner June 8, 2026 14:30

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The composition worker-pool system is enhanced with comprehensive Sentry instrumentation. The worker initializes Sentry with Fastify and Pino integrations, refactors its default export to guarantee event flushing, and the pool layer captures span context to record queue size metrics during task execution.

Changes

Composition Worker Pool Sentry Instrumentation

Layer / File(s) Summary
Worker Sentry initialization and integrations
controlplane/src/core/composition/composeGraphs.worker.ts
Imports fastifyIntegration and configures Sentry.init with fastifyIntegration() plus pinoIntegration set to emit info, warn, and error levels only.
Worker default export refactoring with Sentry flush
controlplane/src/core/composition/composeGraphs.worker.ts
Internal composeGraphsInWorker is no longer the default export. New async default export composeGraphsInWorkerActual wraps the internal function and executes Sentry.flush() in a finally block to guarantee event delivery.
Pool instrumentation with span context and queue metrics
controlplane/src/core/composition/composeGraphs.pool.ts
Sentry span callback captures the active span, initializes the worker pool, and records pool.queueSize as a span attribute before running the composition task.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • wundergraph/cosmo#2905: Both PRs modify the same composition worker/pool code to add/adjust Sentry tracing instrumentation, including Sentry init/span handling in composeGraphs.worker.ts and Sentry-span/worker-pool instrumentation in composeGraphs.pool.ts.
  • wundergraph/cosmo#2901: Both PRs modify controlplane/src/core/composition/composeGraphs.pool.ts's composeGraphsInWorker to add Sentry span instrumentation around worker pool execution with span attributes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and generic, using the non-descriptive term 'update Sentry integration' without specifying the actual changes made (span attribute tracking, worker pool queue size monitoring, or Sentry flush wrapping). Consider a more specific title like 'add queue size monitoring to composition worker span' or 'add Sentry flush wrapper to composition worker' that clearly indicates the primary change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
controlplane/src/core/composition/composeGraphs.worker.ts (1)

81-81: ⚡ Quick win

fastifyIntegration() may be ineffective in worker threads.

This worker runs in an isolated thread/child process and does not handle HTTP requests via Fastify. The fastifyIntegration() instruments Fastify's request handling, which isn't applicable here. Consider removing it from the worker's Sentry config to avoid unnecessary overhead and align the integration list with the worker's actual runtime context.

The shared sentry.config.ts includes it because the main process runs Fastify, but workers don't share that context.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controlplane/src/core/composition/composeGraphs.worker.ts` at line 81, The
worker is loading fastifyIntegration() which is irrelevant in worker threads;
update the Sentry initialization used by composeGraphs.worker.ts to remove
fastifyIntegration() from the integrations list. Locate where Sentry is
initialized (or where sentry.config.ts is imported) and either filter out
fastifyIntegration() from the integrations array before calling Sentry.init, or
create a small worker-specific integrations array that excludes
fastifyIntegration() (use the fastifyIntegration symbol to identify it). Ensure
composeGraphs.worker.ts uses the filtered/worker-specific integrations when
booting Sentry so the Fastify instrumentation is not registered in the worker.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@controlplane/src/core/composition/composeGraphs.worker.ts`:
- Line 81: The worker is loading fastifyIntegration() which is irrelevant in
worker threads; update the Sentry initialization used by composeGraphs.worker.ts
to remove fastifyIntegration() from the integrations list. Locate where Sentry
is initialized (or where sentry.config.ts is imported) and either filter out
fastifyIntegration() from the integrations array before calling Sentry.init, or
create a small worker-specific integrations array that excludes
fastifyIntegration() (use the fastifyIntegration symbol to identify it). Ensure
composeGraphs.worker.ts uses the filtered/worker-specific integrations when
booting Sentry so the Fastify instrumentation is not registered in the worker.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 06417edb-265f-4e92-8de7-cb34f6d46b7a

📥 Commits

Reviewing files that changed from the base of the PR and between 8636572 and f8691fc.

📒 Files selected for processing (2)
  • controlplane/src/core/composition/composeGraphs.pool.ts
  • controlplane/src/core/composition/composeGraphs.worker.ts

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.95%. Comparing base (474722f) to head (f8691fc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...plane/src/core/composition/composeGraphs.worker.ts 0.00% 12 Missing ⚠️

❌ Your patch check has failed because the patch coverage (25.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2931      +/-   ##
==========================================
- Coverage   66.05%   64.95%   -1.11%     
==========================================
  Files         258      327      +69     
  Lines       27309    47076   +19767     
  Branches        0     5218    +5218     
==========================================
+ Hits        18040    30578   +12538     
- Misses       7818    16474    +8656     
+ Partials     1451       24    -1427     
Files with missing lines Coverage Δ
...olplane/src/core/composition/composeGraphs.pool.ts 87.78% <100.00%> (ø)
...plane/src/core/composition/composeGraphs.worker.ts 0.00% <0.00%> (ø)

... and 583 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wilsonrivera
wilsonrivera merged commit a3c48a2 into main Jun 8, 2026
13 checks passed
@wilsonrivera
wilsonrivera deleted the wilson/eng-9690-controlplane-add-queuesize-to-composition-worker-span branch June 8, 2026 14:44
);
}

export default async function composeGraphsInWorkerActual(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick on already merged PR 😅 but the name is kinda of confusing even though I understand the intention.

Could we rename it as part of subsequent PR? Maybe use composeGraphsInWorker for this actual exported function and rename the other one to composeGraphsInWorkerWithTraces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants