Skip to content

Commit 2049e21

Browse files
JPeer264getsantry[bot]coolguyzone
authored
feat(effect): Add initial Effect SDK docs (#16992)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR This adds the docs for the new `@sentry/effect` SDK. For the first time ever auto-metrics are now in the examples, meaning the `metrics` button has been added in the `onboarding.tsx`. Not sure if there is a better term than `Metrics`, but I think that is pretty much nailing what it does. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [x] Urgent(ish) deadline (GA date, etc.): We released today: March 17th, 2026. But it is ok to review that at a later point as it is in alpha currently - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com> Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
1 parent 0ba3ffe commit 2049e21

6 files changed

Lines changed: 224 additions & 17 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title: Effect
2+
description: Learn how to set up Sentry in your Effect application with first-class integration for tracing, logging, and metrics.
3+
sdk: sentry.javascript.effect
4+
categories:
5+
- javascript
6+
- server
7+
- server-node
8+
- browser
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
title: Effect
3+
sdk: sentry.javascript.effect
4+
description: Learn how to set up Sentry in your Effect application with first-class integration for tracing, logging, and metrics.
5+
---
6+
7+
<Alert>
8+
9+
This SDK is currently in **ALPHA**. Alpha features are still in progress, may have bugs, and might include breaking changes.
10+
Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns.
11+
12+
</Alert>
13+
14+
This guide will show you how to integrate Sentry into your [Effect](https://effect.website/) project using the `@sentry/effect` SDK.
15+
16+
<PlatformContent includePath="getting-started-prerequisites" />
17+
18+
## Step 1: Install
19+
20+
Choose the features you want to configure, and this guide will show you how:
21+
22+
<OnboardingOptionButtons
23+
options={[
24+
"error-monitoring",
25+
"performance",
26+
"logs",
27+
"metrics",
28+
]}
29+
/>
30+
31+
<PlatformContent includePath="getting-started-features-expandable" />
32+
33+
### Install the Sentry SDK
34+
35+
```bash {tabTitle:npm}
36+
npm install @sentry/effect --save
37+
```
38+
39+
```bash {tabTitle:yarn}
40+
yarn add @sentry/effect
41+
```
42+
43+
```bash {tabTitle:pnpm}
44+
pnpm add @sentry/effect
45+
```
46+
47+
## Step 2: Configure
48+
49+
The SDK provides an `effectLayer` that initializes Sentry. You can compose it with additional Effect layers to enable tracing, logging, and metrics.
50+
51+
### Server Usage
52+
53+
```typescript {filename:main.ts}
54+
import * as Sentry from "@sentry/effect/server";
55+
import { NodeRuntime } from "@effect/platform-node";
56+
// ___PRODUCT_OPTION_START___ logs
57+
import * as Logger from "effect/Logger";
58+
// ___PRODUCT_OPTION_END___ logs
59+
import * as Layer from "effect/Layer";
60+
import { HttpLive } from "./Http.js";
61+
62+
const SentryLive = Layer.mergeAll(
63+
Sentry.effectLayer({
64+
dsn: "___PUBLIC_DSN___",
65+
// ___PRODUCT_OPTION_START___ performance
66+
67+
// Set tracesSampleRate to 1.0 to capture 100%
68+
// of transactions for tracing.
69+
// We recommend adjusting this value in production.
70+
tracesSampleRate: 1.0,
71+
// ___PRODUCT_OPTION_END___ performance
72+
// ___PRODUCT_OPTION_START___ logs
73+
74+
// Enable logs to be sent to Sentry
75+
enableLogs: true,
76+
// ___PRODUCT_OPTION_END___ logs
77+
}),
78+
// ___PRODUCT_OPTION_START___ performance
79+
80+
// Enable Effect tracing
81+
Layer.setTracer(Sentry.SentryEffectTracer),
82+
// ___PRODUCT_OPTION_END___ performance
83+
// ___PRODUCT_OPTION_START___ logs
84+
85+
// Forward Effect logs to Sentry
86+
Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),
87+
// ___PRODUCT_OPTION_END___ logs
88+
// ___PRODUCT_OPTION_START___ metrics
89+
90+
// Forward Effect metrics to Sentry
91+
Sentry.SentryEffectMetricsLayer,
92+
// ___PRODUCT_OPTION_END___ metrics
93+
);
94+
95+
const MainLive = HttpLive.pipe(Layer.provide(SentryLive));
96+
97+
MainLive.pipe(Layer.launch, NodeRuntime.runMain);
98+
```
99+
100+
### Client Usage
101+
102+
```typescript {filename:main.ts}
103+
import * as Sentry from "@sentry/effect/client";
104+
// ___PRODUCT_OPTION_START___ logs
105+
import { Logger } from "effect";
106+
// ___PRODUCT_OPTION_END___ logs
107+
import { Layer } from "effect";
108+
109+
const SentryLive = Layer.mergeAll(
110+
Sentry.effectLayer({
111+
dsn: "___PUBLIC_DSN___",
112+
// ___PRODUCT_OPTION_START___ performance
113+
114+
// Set tracesSampleRate to 1.0 to capture 100%
115+
// of transactions for tracing.
116+
// We recommend adjusting this value in production.
117+
tracesSampleRate: 1.0,
118+
integrations: [Sentry.browserTracingIntegration()],
119+
// ___PRODUCT_OPTION_END___ performance
120+
// ___PRODUCT_OPTION_START___ logs
121+
122+
// Enable logs to be sent to Sentry
123+
enableLogs: true,
124+
// ___PRODUCT_OPTION_END___ logs
125+
}),
126+
// ___PRODUCT_OPTION_START___ performance
127+
128+
// Enable Effect tracing
129+
Layer.setTracer(Sentry.SentryEffectTracer),
130+
// ___PRODUCT_OPTION_END___ performance
131+
// ___PRODUCT_OPTION_START___ logs
132+
133+
// Forward Effect logs to Sentry
134+
Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),
135+
// ___PRODUCT_OPTION_END___ logs
136+
);
137+
138+
const MainLive = YourAppLayer.pipe(Layer.provide(SentryLive));
139+
```
140+
141+
## Features
142+
143+
The SDK provides composable layers for Effect integration:
144+
145+
<OnboardingOption optionId="performance">
146+
- **Tracing** via `Sentry.SentryEffectTracer`: Effect spans are automatically traced as Sentry spans with distributed tracing support
147+
</OnboardingOption>
148+
<OnboardingOption optionId="logs">
149+
- **Logging** via `Sentry.SentryEffectLogger`: Effect logs are forwarded to Sentry (requires `enableLogs: true`)
150+
</OnboardingOption>
151+
<OnboardingOption optionId="metrics">
152+
- **Metrics** via `Sentry.SentryEffectMetricsLayer`: Effect metrics (counters, gauges, histograms) are sent to Sentry
153+
</OnboardingOption>
154+
155+
## Step 3: Verify
156+
157+
Add a test error to verify your setup:
158+
159+
```typescript
160+
import { Effect } from "effect";
161+
import * as Sentry from "@sentry/effect/server";
162+
163+
const program = Effect.gen(function* () {
164+
yield* Effect.fail(new Error("Sentry Test Error"));
165+
});
166+
167+
// Run with your layer that includes Sentry.effectLayer
168+
```
169+
170+
Head over to your project on [Sentry.io](https://sentry.io) to view the collected data.
171+
172+
## Next Steps
173+
174+
- Learn how to [manually capture errors](/platforms/javascript/guides/effect/usage/)
175+
- Continue to [customize your configuration](/platforms/javascript/guides/effect/configuration/)
176+
- Get familiar with [Sentry's product features](/product/) like tracing, insights, and alerts
177+
178+
<Expandable permalink={false} title="Are you having problems setting up the SDK?">
179+
180+
- Find various topics in <PlatformLink to="/troubleshooting">Troubleshooting</PlatformLink>
181+
- [Get support](https://sentry.zendesk.com/hc/en-us/)
182+
183+
</Expandable>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"next-themes": "^0.3.0",
9292
"nextjs-toploader": "^1.6.6",
9393
"p-limit": "^6.2.0",
94-
"platformicons": "^9.0.7",
94+
"platformicons": "^9.2.1",
9595
"prism-sentry": "^1.0.2",
9696
"react": "^19.2.4",
9797
"react-dom": "^19.2.4",

pnpm-lock.yaml

Lines changed: 15 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/onboarding/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const OPTION_IDS = [
2323
'source-context',
2424
'dsym',
2525
'opentelemetry',
26+
'metrics',
2627
] as const;
2728

2829
const OPTION_IDS_SET = new Set(OPTION_IDS);
@@ -106,6 +107,15 @@ const optionDetails: Record<
106107
</span>
107108
),
108109
},
110+
metrics: {
111+
name: 'Metrics',
112+
description: (
113+
<span>
114+
Send metrics from your application to Sentry for viewing alongside relevant errors
115+
and searching by metric name or attributes.
116+
</span>
117+
),
118+
},
109119
dsym: {
110120
name: 'dSYM',
111121
description: (

src/components/platformIcon.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import DotnetSVG from 'platformicons/svg/dotnet.svg';
4040
import DotnetcoreSVG from 'platformicons/svg/dotnetcore.svg';
4141
import DotnetfxSVG from 'platformicons/svg/dotnetfx.svg';
4242
import EchoSVG from 'platformicons/svg/echo.svg';
43+
import EffectSVG from 'platformicons/svg/effect.svg';
4344
import ElectronSVG from 'platformicons/svg/electron.svg';
4445
import ElixirSVG from 'platformicons/svg/elixir.svg';
4546
import EmberSVG from 'platformicons/svg/ember.svg';
@@ -190,6 +191,7 @@ import DotnetSVGLarge from 'platformicons/svg_80x80/dotnet.svg';
190191
import DotnetcoreSVGLarge from 'platformicons/svg_80x80/dotnetcore.svg';
191192
import DotnetfxSVGLarge from 'platformicons/svg_80x80/dotnetfx.svg';
192193
import EchoSVGLarge from 'platformicons/svg_80x80/echo.svg';
194+
import EffectSVGLarge from 'platformicons/svg_80x80/effect.svg';
193195
import ElectronSVGLarge from 'platformicons/svg_80x80/electron.svg';
194196
import ElixirSVGLarge from 'platformicons/svg_80x80/elixir.svg';
195197
import EmberSVGLarge from 'platformicons/svg_80x80/ember.svg';
@@ -478,6 +480,10 @@ const formatToSVG = {
478480
sm: EchoSVG,
479481
lg: EchoSVGLarge,
480482
},
483+
effect: {
484+
sm: EffectSVG,
485+
lg: EffectSVGLarge,
486+
},
481487
electron: {
482488
sm: ElectronSVG,
483489
lg: ElectronSVGLarge,
@@ -985,6 +991,7 @@ export const PLATFORM_TO_ICON = {
985991
'javascript-cordova': 'cordova',
986992
'javascript-cloudflare': 'cloudflare',
987993
'javascript-deno': 'deno',
994+
'javascript-effect': 'effect',
988995
'javascript-electron': 'electron',
989996
'javascript-ember': 'ember',
990997
'javascript-express': 'express',

0 commit comments

Comments
 (0)