-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathindex.ts
More file actions
38 lines (35 loc) · 1.18 KB
/
index.ts
File metadata and controls
38 lines (35 loc) · 1.18 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
import type { BrowserOptions } from '@sentry/browser';
import type * as EffectLayer from 'effect/Layer';
import { suspend as suspendLayer } from 'effect/Layer';
import { buildEffectLayer } from '../utils/buildEffectLayer';
import { init } from './sdk';
export { init } from './sdk';
/**
* Options for the Sentry Effect client layer.
*/
export type EffectClientLayerOptions = BrowserOptions;
/**
* Creates an Effect Layer that initializes Sentry for browser clients.
*
* This layer provides Effect applications with full Sentry instrumentation including:
* - Effect spans traced as Sentry spans
*
* @example
* ```typescript
* import * as Sentry from '@sentry/effect/client';
* import { Layer, Effect } from 'effect';
*
* const ApiClientWithSentry = ApiClientLive.pipe(
* Layer.provide(Sentry.effectLayer({
* dsn: '__DSN__',
* integrations: [Sentry.browserTracingIntegration()],
* tracesSampleRate: 1.0,
* })),
* );
*
* Effect.runPromise(Effect.provide(myEffect, ApiClientWithSentry));
* ```
*/
export function effectLayer(options: EffectClientLayerOptions): EffectLayer.Layer<never, never, never> {
return suspendLayer(() => buildEffectLayer(options, init(options)));
}