-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathbuildEffectLayer.ts
More file actions
24 lines (21 loc) · 754 Bytes
/
buildEffectLayer.ts
File metadata and controls
24 lines (21 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import type * as EffectLayer from 'effect/Layer';
import { empty as emptyLayer } from 'effect/Layer';
import { SentryEffectTracerLayer } from '../tracer';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface EffectLayerBaseOptions {}
/**
* Builds an Effect layer that integrates Sentry tracing.
*
* Returns an empty layer if no Sentry client is available. Otherwise, starts with
* the Sentry tracer layer and optionally merges logging and metrics layers based
* on the provided options.
*/
export function buildEffectLayer<T extends EffectLayerBaseOptions>(
options: T,
client: unknown,
): EffectLayer.Layer<never, never, never> {
if (!client) {
return emptyLayer;
}
return SentryEffectTracerLayer;
}