Title: Add support for Effect.ts via its own SDK · Issue #19641 · getsentry/sentry-javascript · GitHub
Open Graph Title: Add support for Effect.ts via its own SDK · Issue #19641 · getsentry/sentry-javascript
X Title: Add support for Effect.ts via its own SDK · Issue #19641 · getsentry/sentry-javascript
Description: Description Add a dedicated @sentry/effect SDK that provides first-class Sentry integration for Effect applications, covering tracing, logging, and metrics (also error capture in a future releases) Why a standalone SDK instead of an inte...
Open Graph Description: Description Add a dedicated @sentry/effect SDK that provides first-class Sentry integration for Effect applications, covering tracing, logging, and metrics (also error capture in a future releases)...
X Description: Description Add a dedicated @sentry/effect SDK that provides first-class Sentry integration for Effect applications, covering tracing, logging, and metrics (also error capture in a future releases)...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/19641
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add support for Effect.ts via its own SDK","articleBody":"### Description\n\nAdd a dedicated `@sentry/effect` SDK that provides first-class Sentry integration for [Effect](https://effect.website/)\napplications, covering tracing, logging, and metrics (also error capture in a future releases)\n\n## Why a standalone SDK instead of an integration?\n\nThe original idea (#17126) was to add an `effectIntegration` to the Node SDK, potentially leveraging `@effect/opentelemetry`. After\ninvestigation, we determined this approach doesn't work well:\n\n1. **`@effect/opentelemetry` sets up its own OpenTelemetry (OTel) tracer**. this conflicts with Sentry's existing OTel setup and would result in\nduplicate or conflicting instrumentation.\n2. **Effect already has built-in tracing, metrics, and logging**. Effect's type-safe [Tracer](https://effect.website/docs/observability/tracing/), [Logger](https://effect.website/docs/observability/logging/),\nand [Metric](https://effect.website/docs/observability/metrics/) modules need dedicated bridging, not a generic OTel passthrough.\n3. **Effect uses Layers for composition** - the idiomatic way to integrate with Effect is by providing Sentry-backed Layer\nimplementations, not through a traditional SDK integration pattern.\n4. **Dual platform support needed** - Effect runs both server-side and in the browser. On the server, users may still want Sentry's\nOTel-based instrumentation for third-party libraries (e.g., `pg`), while in the browser there's no OTel. A standalone package can\ncleanly handle both via conditional exports.\n\nA standalone `@sentry/effect` package lets users simply add a Sentry layer to their Effect programs - the idiomatic Effect way.\n\n## Design decisions\n\n### `Sentry.init()` vs `Sentry.effectLayer()`\n\nWe pass Sentry config directly to `effectLayer()` so it manages the full lifecycle (init, flush, shutdown) via Effect finalizers. This\nis the idiomatic Effect pattern - the Layer owns the resource lifecycle.\n\n```typescript\nimport * as Sentry from '@sentry/effect';\n\nHttpLive.pipe(\n Layer.provide(\n Sentry.effectLayer({\n dsn: '...',\n tracesSampleRate: 1.0,\n enableLogs: true,\n enableMetrics: true,\n })\n ),\n Layer.launch,\n NodeRuntime.runMain,\n);\n```\n\n### Coexistence with Sentry/OTel integrations\n\nFor the very beginning we focus on a Effect only experience. For the future we can think of how it would look like when users want to use more integrations. A very early prototype of the Effect SDK already showed that we might have \"duplicated\" spans, which we need to think of to prevent (or document). They are not really duplicated, but there might be the case where two spans exist, which hold almost the same information, where one would be sufficient.\n\nE.g.: We do have a Postgres integration that instruments the `pg` library. If a user wants to use both the Effect SDK and the Postgres integration, they might end up with duplicated spans, as Effect is also adding spans (just [slightly different ones](https://github.com/Effect-TS/effect/blob/cf749405214282edc916a783b3417c766d2bbfe3/packages/sql/src/internal/statement.ts#L117-L130)). We need to think of a way to prevent or document to prevent this.\n\nThe following image shows a trace that uses our Postgres integration and the Effect sql spans. Both `SELECT * FROM ...` and `sql.execute` spans hold the same information which is meant with \"duplication\".\n\n\u003cimg width=\"1444\" height=\"264\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/2b9a673b-957b-4cb6-9da8-13fca7447b15\" />\n\n### Logging and Metrics\n\nWhen `enableLogs: true` is set in the `effectLayer()` options, Effect log calls (`Effect.log`, `Effect.logWarning`, `Effect.logError`,\netc.) are automatically forwarded to Sentry's structured logging with appropriate level mapping.\n\nWhen `enableMetrics: true` is set, Effect metrics (Counter, Gauge, Histogram, Summary, Frequency) are periodically flushed to Sentry.\n\nBoth are opt-in to keep the default setup lightweight.\n\n### Effect v4 ErrorReporter\n\nEffect v4 introduces an `ErrorReporter` primitive that allows hooking into Effect's error reporting pipeline. A Sentry `ErrorReporter`\nimplementation is **not included in the first draft** and will be added as a follow-up. Reference: https://github.com/Effect-TS/effect-smol/pull/1409\n\n## Proposal\n\n### `Sentry.effectLayer(options)`\n\nA single factory function that creates a composed Effect Layer providing all Sentry functionality. Accepts all standard Sentry SDK\noptions plus `enableLogs` and `enableMetrics`.\n\n### Three bridging layers\n\n> Another when we add `ErrorReporter`\n\n1. **`SentryEffectTracerLayer`** (always active) - Maps Effect spans to Sentry spans with parent-child relationships, status tracking,\nattribute propagation, and automatic `op`/`origin` detection.\n2. **`SentryEffectLogger`** (opt-in via `enableLogs`) - Forwards Effect log calls to Sentry's structured logging with level mapping.\n3. **`SentryEffectMetricsLayer`** (opt-in via `enableMetrics`) - Periodically flushes Effect metrics to Sentry.\n\n### Dual-platform support\n\nAs with Astro, Effect can run in the frontend and in the backend (Node, Deno, Bun. Therefore it would be beneficial is both platforms are supported.","author":{"url":"https://github.com/JPeer264","@type":"Person","name":"JPeer264"},"datePublished":"2026-03-05T09:33:04Z","url":"https://github.com/getsentry/sentry-javascript/issues/19641"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b036986c-21f5-18c7-dd04-49a2c7a820e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D522:18C3B1:56079E:786F20:6B0481BF |
| html-safe-nonce | 17b9bb9405c39545181aba96f632e283b28a0b40545c7e674f5ec72581446e25 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTIyOjE4QzNCMTo1NjA3OUU6Nzg2RjIwOjZCMDQ4MUJGIiwidmlzaXRvcl9pZCI6IjMyNzAzMzAxNjk4OTgwNzQ1NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 23b89f52164f264c7e8b934aa264537856c0ad7c7ce63a4de4a05edc874a62bb |
| hovercard-subject-tag | issue:4027030247 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/19641/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5c990a58b5321e4e06e7ce79e3baf28080f536072213f4488f037f24ff326a49/getsentry/sentry-javascript/issues/19641 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5c990a58b5321e4e06e7ce79e3baf28080f536072213f4488f037f24ff326a49/getsentry/sentry-javascript/issues/19641 |
| og:image:alt | Description Add a dedicated @sentry/effect SDK that provides first-class Sentry integration for Effect applications, covering tracing, logging, and metrics (also error capture in a future releases)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JPeer264 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0366ddfb372682a32e92a5d86155cb08fa83e5bbe79953a968789f2f7e24c511 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ed3f2e01f6b7672780c586c8af0e72726374d7b6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width