-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathindex.ts
More file actions
39 lines (36 loc) · 1.13 KB
/
index.ts
File metadata and controls
39 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { NodeOptions } from '@sentry/node-core/light';
import type * as EffectLayer from 'effect/Layer';
import { buildEffectLayer } from '../utils/buildEffectLayer';
import { init } from './sdk';
export { init } from './sdk';
/**
* Options for the Sentry Effect server layer.
*/
export type EffectServerLayerOptions = NodeOptions;
/**
* Creates an Effect Layer that initializes Sentry for Node.js servers.
*
* This layer provides Effect applications with full Sentry instrumentation including:
* - Effect spans traced as Sentry spans
*
* @example
* ```typescript
* import * as Sentry from '@sentry/effect/server';
* import { NodeRuntime } from '@effect/platform-node';
* import { Layer } from 'effect';
* import { HttpLive } from './Http.js';
*
* const MainLive = HttpLive.pipe(
* Layer.provide(Sentry.effectLayer({
* dsn: '__DSN__',
* enableLogs: true,
* enableMetrics: true,
* })),
* );
*
* MainLive.pipe(Layer.launch, NodeRuntime.runMain);
* ```
*/
export function effectLayer(options: EffectServerLayerOptions): EffectLayer.Layer<never, never, never> {
return buildEffectLayer(options, init(options));
}