Skip to content

Commit 65cced9

Browse files
JPeer264claude
andauthored
feat(effect): Add base skaffolding for Effect.ts (#19622)
This is one of many PRs to create the effect SDK. Once this has been merged I will open the draft PR for the effect sdk and create the plan in there. (the almost final SDK can be viewed here: https://github.com/getsentry/sentry-javascript/tree/jp/effect-sdk. It might be that some specifics change, especially when having browser + server split, and with tracing) --- This PR focuses on the base skaffolding of `@sentry/effect`. This on its own is not really doing anything except setting up the skaffold. The README already reflects the actual usage, while the export doesn't exist yet, this will come in another PR (also `init` is exposed here, just for the sake of completeness) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d975bcd commit 65cced9

File tree

14 files changed

+309
-0
lines changed

14 files changed

+309
-0
lines changed

dev-packages/e2e-tests/verdaccio-config/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ packages:
7474
unpublish: $all
7575
# proxy: npmjs # Don't proxy for E2E tests!
7676

77+
'@sentry/effect':
78+
access: $all
79+
publish: $all
80+
unpublish: $all
81+
# proxy: npmjs # Don't proxy for E2E tests!
82+
7783
'@sentry/ember':
7884
access: $all
7985
publish: $all

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"packages/core",
6161
"packages/cloudflare",
6262
"packages/deno",
63+
"packages/effect",
6364
"packages/ember",
6465
"packages/eslint-config-sdk",
6566
"packages/eslint-plugin-sdk",

packages/effect/.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
node: true,
5+
},
6+
overrides: [
7+
{
8+
files: ['vite.config.ts', 'vitest.config.ts'],
9+
parserOptions: {
10+
project: ['tsconfig.vite.json'],
11+
},
12+
},
13+
],
14+
extends: ['../../.eslintrc.js'],
15+
};

packages/effect/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Functional Software Inc. dba Sentry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/effect/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Official Sentry SDK for Effect.ts (Alpha)
2+
3+
[![npm version](https://img.shields.io/npm/v/@sentry/effect.svg)](https://www.npmjs.com/package/@sentry/effect)
4+
[![npm dm](https://img.shields.io/npm/dm/@sentry/effect.svg)](https://www.npmjs.com/package/@sentry/effect)
5+
[![npm dt](https://img.shields.io/npm/dt/@sentry/effect.svg)](https://www.npmjs.com/package/@sentry/effect)
6+
7+
> NOTICE: This package is in alpha state and may be subject to breaking changes.
8+
9+
## Getting Started
10+
11+
This SDK does not have docs yet. Stay tuned.
12+
13+
## Usage
14+
15+
```typescript
16+
import * as Sentry from '@sentry/effect/server';
17+
import { NodeRuntime } from '@effect/platform-node';
18+
import { Layer } from 'effect';
19+
import { HttpLive } from './Http.js';
20+
21+
const MainLive = HttpLive.pipe(
22+
Layer.provide(
23+
Sentry.effectLayer({
24+
dsn: '__DSN__',
25+
enableLogs: true,
26+
enableMetrics: true,
27+
}),
28+
),
29+
);
30+
31+
MainLive.pipe(Layer.launch, NodeRuntime.runMain);
32+
```
33+
34+
The `effectLayer` function initializes Sentry and returns an Effect Layer that provides:
35+
36+
- Distributed tracing with automatic HTTP header extraction/injection
37+
- Effect spans traced as Sentry spans
38+
- Effect logs forwarded to Sentry (when `enableLogs` is set)
39+
- Effect metrics sent to Sentry (when `enableMetrics` is set)
40+
41+
## Links
42+
43+
<!-- - [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/effect/) -->
44+
45+
- [Sentry.io](https://sentry.io/?utm_source=github&utm_medium=npm_effect)
46+
- [Sentry Discord Server](https://discord.gg/Ww9hbqr)
47+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/sentry)

packages/effect/package.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "@sentry/effect",
3+
"version": "10.42.0",
4+
"description": "Official Sentry SDK for Effect",
5+
"repository": "git://github.com/getsentry/sentry-javascript.git",
6+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/effect",
7+
"author": "Sentry",
8+
"license": "MIT",
9+
"engines": {
10+
"node": ">=18"
11+
},
12+
"files": [
13+
"/build"
14+
],
15+
"main": "build/cjs/index.js",
16+
"module": "build/esm/index.js",
17+
"types": "build/types/index.d.ts",
18+
"exports": {
19+
"./package.json": "./package.json",
20+
".": {
21+
"import": {
22+
"types": "./build/types/index.d.ts",
23+
"default": "./build/esm/index.js"
24+
},
25+
"require": {
26+
"types": "./build/types/index.d.ts",
27+
"default": "./build/cjs/index.js"
28+
}
29+
}
30+
},
31+
"typesVersions": {
32+
"<5.0": {
33+
"build/types/index.d.ts": [
34+
"build/types-ts3.8/index.d.ts"
35+
]
36+
}
37+
},
38+
"publishConfig": {
39+
"access": "public"
40+
},
41+
"dependencies": {
42+
"@sentry/core": "10.42.0"
43+
},
44+
"scripts": {
45+
"build": "run-p build:transpile build:types",
46+
"build:dev": "yarn build",
47+
"build:transpile": "rollup -c rollup.npm.config.mjs",
48+
"build:types": "run-s build:types:core build:types:downlevel",
49+
"build:types:core": "tsc -p tsconfig.types.json",
50+
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
51+
"build:watch": "run-p build:transpile:watch",
52+
"build:dev:watch": "yarn build:watch",
53+
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
54+
"build:tarball": "npm pack",
55+
"circularDepCheck": "madge --circular src/index.ts",
56+
"clean": "rimraf build coverage sentry-effect-*.tgz",
57+
"fix": "eslint . --format stylish --fix",
58+
"lint": "eslint . --format stylish",
59+
"test": "vitest run",
60+
"test:watch": "vitest --watch",
61+
"yalc:publish": "yalc publish --push --sig"
62+
},
63+
"volta": {
64+
"extends": "../../package.json"
65+
},
66+
"sideEffects": false
67+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
2+
3+
export default makeNPMConfigVariants(
4+
makeBaseNPMConfig({
5+
packageSpecificConfig: {
6+
output: {
7+
preserveModulesRoot: 'src',
8+
},
9+
},
10+
}),
11+
);

packages/effect/src/index.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
export type {
2+
Breadcrumb,
3+
BreadcrumbHint,
4+
Context,
5+
Contexts,
6+
RequestEventData,
7+
SdkInfo,
8+
Event,
9+
EventHint,
10+
ErrorEvent,
11+
Exception,
12+
SeverityLevel,
13+
StackFrame,
14+
Stacktrace,
15+
Thread,
16+
User,
17+
Session,
18+
CaptureContext,
19+
ExclusiveEventHintOrCaptureContext,
20+
Log,
21+
LogSeverityLevel,
22+
Span,
23+
} from '@sentry/core';
24+
25+
export {
26+
addEventProcessor,
27+
addBreadcrumb,
28+
addIntegration,
29+
captureException,
30+
captureEvent,
31+
captureFeedback,
32+
captureMessage,
33+
close,
34+
createTransport,
35+
lastEventId,
36+
flush,
37+
getClient,
38+
isInitialized,
39+
isEnabled,
40+
getCurrentScope,
41+
getIsolationScope,
42+
getGlobalScope,
43+
setCurrentClient,
44+
Scope,
45+
continueTrace,
46+
getTraceData,
47+
suppressTracing,
48+
SDK_VERSION,
49+
setContext,
50+
setExtra,
51+
setExtras,
52+
setTag,
53+
setTags,
54+
setUser,
55+
withScope,
56+
withIsolationScope,
57+
functionToStringIntegration,
58+
eventFiltersIntegration,
59+
dedupeIntegration,
60+
parameterize,
61+
startSession,
62+
captureSession,
63+
endSession,
64+
spanToJSON,
65+
spanToTraceHeader,
66+
spanToBaggageHeader,
67+
updateSpanName,
68+
metrics,
69+
getActiveSpan,
70+
getRootSpan,
71+
startSpan,
72+
startInactiveSpan,
73+
startSpanManual,
74+
withActiveSpan,
75+
startNewTrace,
76+
getSpanDescendants,
77+
setMeasurement,
78+
getSpanStatusFromHttpCode,
79+
setHttpStatus,
80+
} from '@sentry/core';
81+
82+
export {
83+
SEMANTIC_ATTRIBUTE_SENTRY_OP,
84+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
85+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
86+
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
87+
} from '@sentry/core';

packages/effect/test/index.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { describe, expect, it } from 'vitest';
2+
import * as index from '../src';
3+
4+
describe('effect index export', () => {
5+
it('has correct exports', () => {
6+
expect(index.captureException).toBeDefined();
7+
});
8+
});

packages/effect/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"outDir": "build"
6+
},
7+
"include": ["src/**/*"]
8+
}

0 commit comments

Comments
 (0)