Skip to content

feat(core): Add effectLayer for Effect#19591

Draft
JPeer264 wants to merge 2 commits intodevelopfrom
jp/add-effect
Draft

feat(core): Add effectLayer for Effect#19591
JPeer264 wants to merge 2 commits intodevelopfrom
jp/add-effect

Conversation

@JPeer264
Copy link
Member

@JPeer264 JPeer264 commented Mar 2, 2026

This is a PoC showing how Effect can be integrated into Sentry. This is now inside @sentry/core exported as @sentry/core/effect to make the build work. Here we had to change the rollup config to make it work, which I personally want to avoid.

Usage

The basic usage in an effect world would look like this:

// instrument.js
import * as Sentry from '@sentry/node';

Sentry.init({ dsn: '' });

For ESM and node we need to --import the instrument file to make it work: node --import ./src/instrument.js effect-app.js and the main entrypoint of Effect would look like this:

import * as Sentry from '@sentry/core/effect';

HttpLive.pipe(Layer.provide(Sentry.effectLayer), Layer.launch, NodeRuntime.runMain);
                            ^^^^^^^^^^^^^^^^^^

Open questions

  • Is @sentry/core/effect the way to go or is @sentry/effect the better move
  • Would a manual change in packages/core/rollup.npm.config.mjs, maybe we need something more generic
  • Is effect as optionalPeerDependency ok?

Todos

  • More granular E2E tests
  • Add unit / integration tests
  • Add ErrorReporter

@JPeer264 JPeer264 self-assigned this Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.63 kB - -
@sentry/browser - with treeshaking flags 24.13 kB - -
@sentry/browser (incl. Tracing) 42.43 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.09 kB - -
@sentry/browser (incl. Tracing, Replay) 81.25 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.87 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 85.95 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.21 kB - -
@sentry/browser (incl. Feedback) 42.44 kB - -
@sentry/browser (incl. sendFeedback) 30.29 kB - -
@sentry/browser (incl. FeedbackAsync) 35.35 kB - -
@sentry/browser (incl. Metrics) 26.8 kB - -
@sentry/browser (incl. Logs) 26.94 kB - -
@sentry/browser (incl. Metrics & Logs) 27.61 kB - -
@sentry/react 27.38 kB - -
@sentry/react (incl. Tracing) 44.77 kB - -
@sentry/vue 30.08 kB - -
@sentry/vue (incl. Tracing) 44.3 kB - -
@sentry/svelte 25.66 kB - -
CDN Bundle 28.17 kB - -
CDN Bundle (incl. Tracing) 43.26 kB - -
CDN Bundle (incl. Logs, Metrics) 29.01 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.1 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.09 kB - -
CDN Bundle (incl. Tracing, Replay) 80.14 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 85.65 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.53 kB - -
CDN Bundle - uncompressed 82.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 128.07 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.19 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.9 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.85 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.95 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 260.67 kB - -
@sentry/nextjs (client) 47.18 kB - -
@sentry/sveltekit (client) 42.89 kB - -
@sentry/node-core 52.24 kB +0.02% +8 B 🔺
@sentry/node 174.69 kB +0.01% +3 B 🔺
@sentry/node - without tracing 97.39 kB +0.02% +10 B 🔺
@sentry/aws-serverless 113.19 kB +0.01% +6 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,078 - 8,536 +6%
GET With Sentry 1,642 18% 1,652 -1%
GET With Sentry (error only) 5,957 66% 6,092 -2%
POST Baseline 1,138 - 1,168 -3%
POST With Sentry 549 48% 572 -4%
POST With Sentry (error only) 1,006 88% 1,030 -2%
MYSQL Baseline 3,227 - 3,237 -0%
MYSQL With Sentry 446 14% 443 +1%
MYSQL With Sentry (error only) 2,584 80% 2,655 -3%

View base workflow run

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