@sentry/effect 10.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/build/cjs/client/index.js +44 -0
- package/build/cjs/client/index.js.map +1 -0
- package/build/cjs/client/sdk.js +23 -0
- package/build/cjs/client/sdk.js.map +1 -0
- package/build/cjs/index.client.js +27 -0
- package/build/cjs/index.client.js.map +1 -0
- package/build/cjs/index.server.js +27 -0
- package/build/cjs/index.server.js.map +1 -0
- package/build/cjs/logger.js +43 -0
- package/build/cjs/logger.js.map +1 -0
- package/build/cjs/metrics.js +120 -0
- package/build/cjs/metrics.js.map +1 -0
- package/build/cjs/server/index.js +44 -0
- package/build/cjs/server/index.js.map +1 -0
- package/build/cjs/server/sdk.js +23 -0
- package/build/cjs/server/sdk.js.map +1 -0
- package/build/cjs/tracer.js +145 -0
- package/build/cjs/tracer.js.map +1 -0
- package/build/esm/client/index.js +41 -0
- package/build/esm/client/index.js.map +1 -0
- package/build/esm/client/sdk.js +21 -0
- package/build/esm/client/sdk.js.map +1 -0
- package/build/esm/index.client.js +7 -0
- package/build/esm/index.client.js.map +1 -0
- package/build/esm/index.server.js +7 -0
- package/build/esm/index.server.js.map +1 -0
- package/build/esm/logger.js +41 -0
- package/build/esm/logger.js.map +1 -0
- package/build/esm/metrics.js +118 -0
- package/build/esm/metrics.js.map +1 -0
- package/build/esm/package.json +1 -0
- package/build/esm/server/index.js +41 -0
- package/build/esm/server/index.js.map +1 -0
- package/build/esm/server/sdk.js +21 -0
- package/build/esm/server/sdk.js.map +1 -0
- package/build/esm/tracer.js +143 -0
- package/build/esm/tracer.js.map +1 -0
- package/build/types/client/index.d.ts +33 -0
- package/build/types/client/index.d.ts.map +1 -0
- package/build/types/client/sdk.d.ts +10 -0
- package/build/types/client/sdk.d.ts.map +1 -0
- package/build/types/index.client.d.ts +7 -0
- package/build/types/index.client.d.ts.map +1 -0
- package/build/types/index.server.d.ts +7 -0
- package/build/types/index.server.d.ts.map +1 -0
- package/build/types/index.types.d.ts +16 -0
- package/build/types/index.types.d.ts.map +1 -0
- package/build/types/logger.d.ts +6 -0
- package/build/types/logger.d.ts.map +1 -0
- package/build/types/metrics.d.ts +17 -0
- package/build/types/metrics.d.ts.map +1 -0
- package/build/types/server/index.d.ts +34 -0
- package/build/types/server/index.d.ts.map +1 -0
- package/build/types/server/sdk.d.ts +10 -0
- package/build/types/server/sdk.d.ts.map +1 -0
- package/build/types/tracer.d.ts +6 -0
- package/build/types/tracer.d.ts.map +1 -0
- package/build/types-ts3.8/client/index.d.ts +33 -0
- package/build/types-ts3.8/client/sdk.d.ts +10 -0
- package/build/types-ts3.8/index.client.d.ts +7 -0
- package/build/types-ts3.8/index.server.d.ts +7 -0
- package/build/types-ts3.8/index.types.d.ts +16 -0
- package/build/types-ts3.8/logger.d.ts +6 -0
- package/build/types-ts3.8/metrics.d.ts +17 -0
- package/build/types-ts3.8/server/index.d.ts +34 -0
- package/build/types-ts3.8/server/sdk.d.ts +10 -0
- package/build/types-ts3.8/tracer.d.ts +6 -0
- package/package.json +99 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { suspend, empty } from 'effect/Layer';
|
|
2
|
+
import { init } from './sdk.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Sentry Effect client layer.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates an Effect Layer that initializes Sentry for browser clients.
|
|
10
|
+
*
|
|
11
|
+
* To enable Effect tracing, logs, or metrics, compose with the respective layers:
|
|
12
|
+
* - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing
|
|
13
|
+
* - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs
|
|
14
|
+
* - `Sentry.SentryEffectMetricsLayer` for metrics
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import * as Sentry from '@sentry/effect/client';
|
|
19
|
+
* import { Layer, Logger, LogLevel } from 'effect';
|
|
20
|
+
*
|
|
21
|
+
* const SentryLive = Layer.mergeAll(
|
|
22
|
+
* Sentry.effectLayer({
|
|
23
|
+
* dsn: '__DSN__',
|
|
24
|
+
* integrations: [Sentry.browserTracingIntegration()],
|
|
25
|
+
* tracesSampleRate: 1.0,
|
|
26
|
+
* }),
|
|
27
|
+
* Layer.setTracer(Sentry.SentryEffectTracer),
|
|
28
|
+
* Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function effectLayer(options) {
|
|
33
|
+
return suspend(() => {
|
|
34
|
+
init(options);
|
|
35
|
+
|
|
36
|
+
return empty;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { effectLayer, init };
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/client/index.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport type * as EffectLayer from 'effect/Layer';\nimport { empty as emptyLayer, suspend as suspendLayer } from 'effect/Layer';\nimport { init } from './sdk';\n\nexport { init } from './sdk';\n\n/**\n * Options for the Sentry Effect client layer.\n */\nexport type EffectClientLayerOptions = BrowserOptions;\n\n/**\n * Creates an Effect Layer that initializes Sentry for browser clients.\n *\n * To enable Effect tracing, logs, or metrics, compose with the respective layers:\n * - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing\n * - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs\n * - `Sentry.SentryEffectMetricsLayer` for metrics\n *\n * @example\n * ```typescript\n * import * as Sentry from '@sentry/effect/client';\n * import { Layer, Logger, LogLevel } from 'effect';\n *\n * const SentryLive = Layer.mergeAll(\n * Sentry.effectLayer({\n * dsn: '__DSN__',\n * integrations: [Sentry.browserTracingIntegration()],\n * tracesSampleRate: 1.0,\n * }),\n * Layer.setTracer(Sentry.SentryEffectTracer),\n * Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),\n * );\n * ```\n */\nexport function effectLayer(options: EffectClientLayerOptions): EffectLayer.Layer<never, never, never> {\n return suspendLayer(() => {\n init(options);\n\n return emptyLayer;\n });\n}\n"],"names":["suspendLayer","emptyLayer"],"mappings":";;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,OAAO,EAAoE;AACvG,EAAE,OAAOA,OAAY,CAAC,MAAM;AAC5B,IAAI,IAAI,CAAC,OAAO,CAAC;;AAEjB,IAAI,OAAOC,KAAU;AACrB,EAAE,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { init as init$1 } from '@sentry/browser';
|
|
2
|
+
import { applySdkMetadata } from '@sentry/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Initializes the Sentry Effect SDK for browser clients.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Configuration options for the SDK
|
|
8
|
+
* @returns The initialized Sentry client, or undefined if initialization failed
|
|
9
|
+
*/
|
|
10
|
+
function init(options) {
|
|
11
|
+
const opts = {
|
|
12
|
+
...options,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
applySdkMetadata(opts, 'effect', ['effect', 'browser']);
|
|
16
|
+
|
|
17
|
+
return init$1(opts);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { init };
|
|
21
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\n\n/**\n * Initializes the Sentry Effect SDK for browser clients.\n *\n * @param options - Configuration options for the SDK\n * @returns The initialized Sentry client, or undefined if initialization failed\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'effect', ['effect', 'browser']);\n\n return initBrowser(opts);\n}\n"],"names":["initBrowser"],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;;AAEzD,EAAE,OAAOA,MAAW,CAAC,IAAI,CAAC;AAC1B;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@sentry/browser';
|
|
2
|
+
export { effectLayer } from './client/index.js';
|
|
3
|
+
export { SentryEffectTracer } from './tracer.js';
|
|
4
|
+
export { SentryEffectLogger } from './logger.js';
|
|
5
|
+
export { SentryEffectMetricsLayer } from './metrics.js';
|
|
6
|
+
export { init } from './client/sdk.js';
|
|
7
|
+
//# sourceMappingURL=index.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@sentry/node-core/light';
|
|
2
|
+
export { effectLayer } from './server/index.js';
|
|
3
|
+
export { SentryEffectTracer } from './tracer.js';
|
|
4
|
+
export { SentryEffectLogger } from './logger.js';
|
|
5
|
+
export { SentryEffectMetricsLayer } from './metrics.js';
|
|
6
|
+
export { init } from './server/sdk.js';
|
|
7
|
+
//# sourceMappingURL=index.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { logger } from '@sentry/core';
|
|
2
|
+
import * as Logger from 'effect/Logger';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Effect Logger that sends logs to Sentry.
|
|
6
|
+
*/
|
|
7
|
+
const SentryEffectLogger = Logger.make(({ logLevel, message }) => {
|
|
8
|
+
let msg;
|
|
9
|
+
if (typeof message === 'string') {
|
|
10
|
+
msg = message;
|
|
11
|
+
} else if (Array.isArray(message) && message.length === 1) {
|
|
12
|
+
const firstElement = message[0];
|
|
13
|
+
msg = typeof firstElement === 'string' ? firstElement : JSON.stringify(firstElement);
|
|
14
|
+
} else {
|
|
15
|
+
msg = JSON.stringify(message);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
switch (logLevel._tag) {
|
|
19
|
+
case 'Fatal':
|
|
20
|
+
logger.fatal(msg);
|
|
21
|
+
break;
|
|
22
|
+
case 'Error':
|
|
23
|
+
logger.error(msg);
|
|
24
|
+
break;
|
|
25
|
+
case 'Warning':
|
|
26
|
+
logger.warn(msg);
|
|
27
|
+
break;
|
|
28
|
+
case 'Info':
|
|
29
|
+
logger.info(msg);
|
|
30
|
+
break;
|
|
31
|
+
case 'Debug':
|
|
32
|
+
logger.debug(msg);
|
|
33
|
+
break;
|
|
34
|
+
case 'Trace':
|
|
35
|
+
logger.trace(msg);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export { SentryEffectLogger };
|
|
41
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sources":["../../src/logger.ts"],"sourcesContent":["import { logger as sentryLogger } from '@sentry/core';\nimport * as Logger from 'effect/Logger';\n\n/**\n * Effect Logger that sends logs to Sentry.\n */\nexport const SentryEffectLogger = Logger.make(({ logLevel, message }) => {\n let msg: string;\n if (typeof message === 'string') {\n msg = message;\n } else if (Array.isArray(message) && message.length === 1) {\n const firstElement = message[0];\n msg = typeof firstElement === 'string' ? firstElement : JSON.stringify(firstElement);\n } else {\n msg = JSON.stringify(message);\n }\n\n switch (logLevel._tag) {\n case 'Fatal':\n sentryLogger.fatal(msg);\n break;\n case 'Error':\n sentryLogger.error(msg);\n break;\n case 'Warning':\n sentryLogger.warn(msg);\n break;\n case 'Info':\n sentryLogger.info(msg);\n break;\n case 'Debug':\n sentryLogger.debug(msg);\n break;\n case 'Trace':\n sentryLogger.trace(msg);\n break;\n case 'All':\n case 'None':\n break;\n default:\n logLevel satisfies never;\n }\n});\n"],"names":["sentryLogger"],"mappings":";;;AAGA;AACA;AACA;AACO,MAAM,kBAAA,GAAqB,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAA,EAAS,KAAK;AACzE,EAAE,IAAI,GAAG;AACT,EAAE,IAAI,OAAO,OAAA,KAAY,QAAQ,EAAE;AACnC,IAAI,GAAA,GAAM,OAAO;AACjB,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAA,IAAK,OAAO,CAAC,MAAA,KAAW,CAAC,EAAE;AAC7D,IAAI,MAAM,YAAA,GAAe,OAAO,CAAC,CAAC,CAAC;AACnC,IAAI,GAAA,GAAM,OAAO,YAAA,KAAiB,QAAA,GAAW,YAAA,GAAe,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;AACxF,EAAE,OAAO;AACT,IAAI,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AACjC,EAAE;;AAEF,EAAE,QAAQ,QAAQ,CAAC,IAAI;AACvB,IAAI,KAAK,OAAO;AAChB,MAAMA,MAAY,CAAC,KAAK,CAAC,GAAG,CAAC;AAC7B,MAAM;AACN,IAAI,KAAK,OAAO;AAChB,MAAMA,MAAY,CAAC,KAAK,CAAC,GAAG,CAAC;AAC7B,MAAM;AACN,IAAI,KAAK,SAAS;AAClB,MAAMA,MAAY,CAAC,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM;AACN,IAAI,KAAK,MAAM;AACf,MAAMA,MAAY,CAAC,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM;AACN,IAAI,KAAK,OAAO;AAChB,MAAMA,MAAY,CAAC,KAAK,CAAC,GAAG,CAAC;AAC7B,MAAM;AACN,IAAI,KAAK,OAAO;AAChB,MAAMA,MAAY,CAAC,KAAK,CAAC,GAAG,CAAC;AAC7B,MAAM;AAMN;AACA,CAAC;;;;"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { metrics } from '@sentry/core';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import { scopedDiscard } from 'effect/Layer';
|
|
4
|
+
import * as Metric from 'effect/Metric';
|
|
5
|
+
import * as MetricKeyType from 'effect/MetricKeyType';
|
|
6
|
+
import * as MetricState from 'effect/MetricState';
|
|
7
|
+
import * as Schedule from 'effect/Schedule';
|
|
8
|
+
|
|
9
|
+
function labelsToAttributes(labels) {
|
|
10
|
+
return labels.reduce((acc, label) => ({ ...acc, [label.key]: label.value }), {});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function sendMetricToSentry(pair) {
|
|
14
|
+
const { metricKey, metricState } = pair;
|
|
15
|
+
const name = metricKey.name;
|
|
16
|
+
const attributes = labelsToAttributes(metricKey.tags);
|
|
17
|
+
|
|
18
|
+
if (MetricState.isCounterState(metricState)) {
|
|
19
|
+
const value = Number(metricState.count);
|
|
20
|
+
metrics.count(name, value, { attributes });
|
|
21
|
+
} else if (MetricState.isGaugeState(metricState)) {
|
|
22
|
+
const value = Number(metricState.value);
|
|
23
|
+
metrics.gauge(name, value, { attributes });
|
|
24
|
+
} else if (MetricState.isHistogramState(metricState)) {
|
|
25
|
+
metrics.gauge(`${name}.sum`, metricState.sum, { attributes });
|
|
26
|
+
metrics.gauge(`${name}.count`, metricState.count, { attributes });
|
|
27
|
+
metrics.gauge(`${name}.min`, metricState.min, { attributes });
|
|
28
|
+
metrics.gauge(`${name}.max`, metricState.max, { attributes });
|
|
29
|
+
} else if (MetricState.isSummaryState(metricState)) {
|
|
30
|
+
metrics.gauge(`${name}.sum`, metricState.sum, { attributes });
|
|
31
|
+
metrics.gauge(`${name}.count`, metricState.count, { attributes });
|
|
32
|
+
metrics.gauge(`${name}.min`, metricState.min, { attributes });
|
|
33
|
+
metrics.gauge(`${name}.max`, metricState.max, { attributes });
|
|
34
|
+
} else if (MetricState.isFrequencyState(metricState)) {
|
|
35
|
+
for (const [word, count] of metricState.occurrences) {
|
|
36
|
+
metrics.count(name, count, {
|
|
37
|
+
attributes: { ...attributes, word },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getMetricId(pair) {
|
|
44
|
+
const tags = pair.metricKey.tags.map(t => `${t.key}=${t.value}`).join(',');
|
|
45
|
+
return `${pair.metricKey.name}:${tags}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function sendDeltaMetricToSentry(
|
|
49
|
+
pair,
|
|
50
|
+
previousCounterValues,
|
|
51
|
+
) {
|
|
52
|
+
const { metricKey, metricState } = pair;
|
|
53
|
+
const name = metricKey.name;
|
|
54
|
+
const attributes = labelsToAttributes(metricKey.tags);
|
|
55
|
+
const metricId = getMetricId(pair);
|
|
56
|
+
|
|
57
|
+
if (MetricState.isCounterState(metricState)) {
|
|
58
|
+
const currentValue = Number(metricState.count);
|
|
59
|
+
|
|
60
|
+
const previousValue = previousCounterValues.get(metricId) ?? 0;
|
|
61
|
+
const delta = currentValue - previousValue;
|
|
62
|
+
|
|
63
|
+
if (delta > 0) {
|
|
64
|
+
metrics.count(name, delta, { attributes });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
previousCounterValues.set(metricId, currentValue);
|
|
68
|
+
} else {
|
|
69
|
+
sendMetricToSentry(pair);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Flushes all Effect metrics to Sentry.
|
|
75
|
+
* @param previousCounterValues - Map tracking previous counter values for delta calculation
|
|
76
|
+
*/
|
|
77
|
+
function flushMetricsToSentry(previousCounterValues) {
|
|
78
|
+
const snapshot = Metric.unsafeSnapshot();
|
|
79
|
+
|
|
80
|
+
snapshot.forEach((pair) => {
|
|
81
|
+
if (MetricKeyType.isCounterKey(pair.metricKey.keyType)) {
|
|
82
|
+
sendDeltaMetricToSentry(pair, previousCounterValues);
|
|
83
|
+
} else {
|
|
84
|
+
sendMetricToSentry(pair);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function createMetricsReporterEffect(previousCounterValues) {
|
|
90
|
+
const schedule = Schedule.spaced('10 seconds');
|
|
91
|
+
|
|
92
|
+
return Effect.repeat(
|
|
93
|
+
Effect.sync(() => flushMetricsToSentry(previousCounterValues)),
|
|
94
|
+
schedule,
|
|
95
|
+
).pipe(Effect.asVoid, Effect.interruptible);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Effect Layer that periodically flushes metrics to Sentry.
|
|
100
|
+
* The layer manages its own state for delta counter calculations,
|
|
101
|
+
* which is automatically cleaned up when the layer is finalized.
|
|
102
|
+
*/
|
|
103
|
+
const SentryEffectMetricsLayer = scopedDiscard(
|
|
104
|
+
Effect.gen(function* () {
|
|
105
|
+
const previousCounterValues = new Map();
|
|
106
|
+
|
|
107
|
+
yield* Effect.acquireRelease(Effect.void, () =>
|
|
108
|
+
Effect.sync(() => {
|
|
109
|
+
previousCounterValues.clear();
|
|
110
|
+
}),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
yield* Effect.forkScoped(createMetricsReporterEffect(previousCounterValues));
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
export { SentryEffectMetricsLayer };
|
|
118
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sources":["../../src/metrics.ts"],"sourcesContent":["import { metrics as sentryMetrics } from '@sentry/core';\nimport * as Effect from 'effect/Effect';\nimport type * as Layer from 'effect/Layer';\nimport { scopedDiscard } from 'effect/Layer';\nimport * as Metric from 'effect/Metric';\nimport * as MetricKeyType from 'effect/MetricKeyType';\nimport type * as MetricPair from 'effect/MetricPair';\nimport * as MetricState from 'effect/MetricState';\nimport * as Schedule from 'effect/Schedule';\n\ntype MetricAttributes = Record<string, string>;\n\nfunction labelsToAttributes(labels: ReadonlyArray<{ key: string; value: string }>): MetricAttributes {\n return labels.reduce((acc, label) => ({ ...acc, [label.key]: label.value }), {});\n}\n\nfunction sendMetricToSentry(pair: MetricPair.MetricPair.Untyped): void {\n const { metricKey, metricState } = pair;\n const name = metricKey.name;\n const attributes = labelsToAttributes(metricKey.tags);\n\n if (MetricState.isCounterState(metricState)) {\n const value = Number(metricState.count);\n sentryMetrics.count(name, value, { attributes });\n } else if (MetricState.isGaugeState(metricState)) {\n const value = Number(metricState.value);\n sentryMetrics.gauge(name, value, { attributes });\n } else if (MetricState.isHistogramState(metricState)) {\n sentryMetrics.gauge(`${name}.sum`, metricState.sum, { attributes });\n sentryMetrics.gauge(`${name}.count`, metricState.count, { attributes });\n sentryMetrics.gauge(`${name}.min`, metricState.min, { attributes });\n sentryMetrics.gauge(`${name}.max`, metricState.max, { attributes });\n } else if (MetricState.isSummaryState(metricState)) {\n sentryMetrics.gauge(`${name}.sum`, metricState.sum, { attributes });\n sentryMetrics.gauge(`${name}.count`, metricState.count, { attributes });\n sentryMetrics.gauge(`${name}.min`, metricState.min, { attributes });\n sentryMetrics.gauge(`${name}.max`, metricState.max, { attributes });\n } else if (MetricState.isFrequencyState(metricState)) {\n for (const [word, count] of metricState.occurrences) {\n sentryMetrics.count(name, count, {\n attributes: { ...attributes, word },\n });\n }\n }\n}\n\nfunction getMetricId(pair: MetricPair.MetricPair.Untyped): string {\n const tags = pair.metricKey.tags.map(t => `${t.key}=${t.value}`).join(',');\n return `${pair.metricKey.name}:${tags}`;\n}\n\nfunction sendDeltaMetricToSentry(\n pair: MetricPair.MetricPair.Untyped,\n previousCounterValues: Map<string, number>,\n): void {\n const { metricKey, metricState } = pair;\n const name = metricKey.name;\n const attributes = labelsToAttributes(metricKey.tags);\n const metricId = getMetricId(pair);\n\n if (MetricState.isCounterState(metricState)) {\n const currentValue = Number(metricState.count);\n\n const previousValue = previousCounterValues.get(metricId) ?? 0;\n const delta = currentValue - previousValue;\n\n if (delta > 0) {\n sentryMetrics.count(name, delta, { attributes });\n }\n\n previousCounterValues.set(metricId, currentValue);\n } else {\n sendMetricToSentry(pair);\n }\n}\n\n/**\n * Flushes all Effect metrics to Sentry.\n * @param previousCounterValues - Map tracking previous counter values for delta calculation\n */\nfunction flushMetricsToSentry(previousCounterValues: Map<string, number>): void {\n const snapshot = Metric.unsafeSnapshot();\n\n snapshot.forEach((pair: MetricPair.MetricPair.Untyped) => {\n if (MetricKeyType.isCounterKey(pair.metricKey.keyType)) {\n sendDeltaMetricToSentry(pair, previousCounterValues);\n } else {\n sendMetricToSentry(pair);\n }\n });\n}\n\n/**\n * Creates a metrics flusher with its own isolated state for delta tracking.\n * Useful for testing scenarios where you need to control the lifecycle.\n * @internal\n */\nexport function createMetricsFlusher(): {\n flush: () => void;\n clear: () => void;\n} {\n const previousCounterValues = new Map<string, number>();\n return {\n flush: () => flushMetricsToSentry(previousCounterValues),\n clear: () => previousCounterValues.clear(),\n };\n}\n\nfunction createMetricsReporterEffect(previousCounterValues: Map<string, number>): Effect.Effect<void, never, never> {\n const schedule = Schedule.spaced('10 seconds');\n\n return Effect.repeat(\n Effect.sync(() => flushMetricsToSentry(previousCounterValues)),\n schedule,\n ).pipe(Effect.asVoid, Effect.interruptible);\n}\n\n/**\n * Effect Layer that periodically flushes metrics to Sentry.\n * The layer manages its own state for delta counter calculations,\n * which is automatically cleaned up when the layer is finalized.\n */\nexport const SentryEffectMetricsLayer: Layer.Layer<never, never, never> = scopedDiscard(\n Effect.gen(function* () {\n const previousCounterValues = new Map<string, number>();\n\n yield* Effect.acquireRelease(Effect.void, () =>\n Effect.sync(() => {\n previousCounterValues.clear();\n }),\n );\n\n yield* Effect.forkScoped(createMetricsReporterEffect(previousCounterValues));\n }),\n);\n"],"names":["sentryMetrics"],"mappings":";;;;;;;;AAYA,SAAS,kBAAkB,CAAC,MAAM,EAAmE;AACrG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,MAAM,EAAE,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,KAAA,EAAO,CAAC,EAAE,EAAE,CAAC;AAClF;;AAEA,SAAS,kBAAkB,CAAC,IAAI,EAAuC;AACvE,EAAE,MAAM,EAAE,SAAS,EAAE,WAAA,EAAY,GAAI,IAAI;AACzC,EAAE,MAAM,IAAA,GAAO,SAAS,CAAC,IAAI;AAC7B,EAAE,MAAM,aAAa,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC;;AAEvD,EAAE,IAAI,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;AAC/C,IAAI,MAAM,QAAQ,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3C,IAAIA,OAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,UAAA,EAAY,CAAC;AACpD,EAAE,CAAA,MAAO,IAAI,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;AACpD,IAAI,MAAM,QAAQ,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3C,IAAIA,OAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,UAAA,EAAY,CAAC;AACpD,EAAE,CAAA,MAAO,IAAI,WAAW,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE;AACxD,IAAIA,OAAa,CAAC,KAAK,CAAC,CAAC,EAAA,IAAA,CAAA,IAAA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","sideEffects":false}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { suspend, empty } from 'effect/Layer';
|
|
2
|
+
import { init } from './sdk.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Sentry Effect server layer.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates an Effect Layer that initializes Sentry for Node.js servers.
|
|
10
|
+
*
|
|
11
|
+
* To enable Effect tracing, logs, or metrics, compose with the respective layers:
|
|
12
|
+
* - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing
|
|
13
|
+
* - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs
|
|
14
|
+
* - `Sentry.SentryEffectMetricsLayer` for metrics
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import * as Sentry from '@sentry/effect/server';
|
|
19
|
+
* import { NodeRuntime } from '@effect/platform-node';
|
|
20
|
+
* import { Layer, Logger } from 'effect';
|
|
21
|
+
* import { HttpLive } from './Http.js';
|
|
22
|
+
*
|
|
23
|
+
* const SentryLive = Layer.mergeAll(
|
|
24
|
+
* Sentry.effectLayer({ dsn: '__DSN__' }),
|
|
25
|
+
* Layer.setTracer(Sentry.SentryEffectTracer),
|
|
26
|
+
* Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),
|
|
27
|
+
* );
|
|
28
|
+
*
|
|
29
|
+
* const MainLive = HttpLive.pipe(Layer.provide(SentryLive));
|
|
30
|
+
* MainLive.pipe(Layer.launch, NodeRuntime.runMain);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function effectLayer(options) {
|
|
34
|
+
return suspend(() => {
|
|
35
|
+
init(options);
|
|
36
|
+
return empty;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { effectLayer, init };
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/server/index.ts"],"sourcesContent":["import type { NodeOptions } from '@sentry/node-core/light';\nimport type * as EffectLayer from 'effect/Layer';\nimport { empty as emptyLayer, suspend as suspendLayer } from 'effect/Layer';\nimport { init } from './sdk';\n\nexport { init } from './sdk';\n\n/**\n * Options for the Sentry Effect server layer.\n */\nexport type EffectServerLayerOptions = NodeOptions;\n\n/**\n * Creates an Effect Layer that initializes Sentry for Node.js servers.\n *\n * To enable Effect tracing, logs, or metrics, compose with the respective layers:\n * - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing\n * - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs\n * - `Sentry.SentryEffectMetricsLayer` for metrics\n *\n * @example\n * ```typescript\n * import * as Sentry from '@sentry/effect/server';\n * import { NodeRuntime } from '@effect/platform-node';\n * import { Layer, Logger } from 'effect';\n * import { HttpLive } from './Http.js';\n *\n * const SentryLive = Layer.mergeAll(\n * Sentry.effectLayer({ dsn: '__DSN__' }),\n * Layer.setTracer(Sentry.SentryEffectTracer),\n * Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),\n * );\n *\n * const MainLive = HttpLive.pipe(Layer.provide(SentryLive));\n * MainLive.pipe(Layer.launch, NodeRuntime.runMain);\n * ```\n */\nexport function effectLayer(options: EffectServerLayerOptions): EffectLayer.Layer<never, never, never> {\n return suspendLayer(() => {\n init(options);\n return emptyLayer;\n });\n}\n"],"names":["suspendLayer","emptyLayer"],"mappings":";;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,OAAO,EAAoE;AACvG,EAAE,OAAOA,OAAY,CAAC,MAAM;AAC5B,IAAI,IAAI,CAAC,OAAO,CAAC;AACjB,IAAI,OAAOC,KAAU;AACrB,EAAE,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { applySdkMetadata } from '@sentry/core';
|
|
2
|
+
import { init as init$1 } from '@sentry/node-core/light';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Initializes the Sentry Effect SDK for Node.js servers.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Configuration options for the SDK
|
|
8
|
+
* @returns The initialized Sentry client, or undefined if initialization failed
|
|
9
|
+
*/
|
|
10
|
+
function init(options) {
|
|
11
|
+
const opts = {
|
|
12
|
+
...options,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
applySdkMetadata(opts, 'effect', ['effect', 'node-light']);
|
|
16
|
+
|
|
17
|
+
return init$1(opts);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { init };
|
|
21
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import type { Client } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeOptions } from '@sentry/node-core/light';\nimport { init as initNode } from '@sentry/node-core/light';\n\n/**\n * Initializes the Sentry Effect SDK for Node.js servers.\n *\n * @param options - Configuration options for the SDK\n * @returns The initialized Sentry client, or undefined if initialization failed\n */\nexport function init(options: NodeOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'effect', ['effect', 'node-light']);\n\n return initNode(opts);\n}\n"],"names":["initNode"],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAmC;AAC/D,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;;AAE5D,EAAE,OAAOA,MAAQ,CAAC,IAAI,CAAC;AACvB;;;;"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { withActiveSpan, getActiveSpan, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
|
+
import * as Exit from 'effect/Exit';
|
|
3
|
+
import * as Option from 'effect/Option';
|
|
4
|
+
import * as EffectTracer from 'effect/Tracer';
|
|
5
|
+
|
|
6
|
+
function deriveOrigin(name) {
|
|
7
|
+
if (name.startsWith('http.server') || name.startsWith('http.client')) {
|
|
8
|
+
return 'auto.http.effect';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return 'auto.function.effect';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SENTRY_SPAN_SYMBOL = Symbol.for('@sentry/effect.SentrySpan');
|
|
15
|
+
|
|
16
|
+
function nanosToHrTime(nanos) {
|
|
17
|
+
const seconds = Number(nanos / BigInt(1000000000));
|
|
18
|
+
const remainingNanos = Number(nanos % BigInt(1000000000));
|
|
19
|
+
return [seconds, remainingNanos];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function isSentrySpan(span) {
|
|
23
|
+
return SENTRY_SPAN_SYMBOL in span;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class SentrySpanWrapper {
|
|
27
|
+
|
|
28
|
+
constructor(
|
|
29
|
+
name,
|
|
30
|
+
parent,
|
|
31
|
+
context,
|
|
32
|
+
links,
|
|
33
|
+
startTime,
|
|
34
|
+
kind,
|
|
35
|
+
existingSpan,
|
|
36
|
+
) {this.name = name;this.context = context;this.kind = kind;
|
|
37
|
+
this[SENTRY_SPAN_SYMBOL] = true ;
|
|
38
|
+
this._tag = 'Span' ;
|
|
39
|
+
this.attributes = new Map();
|
|
40
|
+
this.parent = parent;
|
|
41
|
+
this.links = [...links];
|
|
42
|
+
this.sentrySpan = existingSpan;
|
|
43
|
+
|
|
44
|
+
const spanContext = this.sentrySpan.spanContext();
|
|
45
|
+
this.spanId = spanContext.spanId;
|
|
46
|
+
this.traceId = spanContext.traceId;
|
|
47
|
+
this.sampled = this.sentrySpan.isRecording();
|
|
48
|
+
this.status = {
|
|
49
|
+
_tag: 'Started',
|
|
50
|
+
startTime,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
attribute(key, value) {
|
|
55
|
+
if (!this.sentrySpan.isRecording()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.sentrySpan.setAttribute(key, value );
|
|
60
|
+
this.attributes.set(key, value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
addLinks(links) {
|
|
64
|
+
this.links.push(...links);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
end(endTime, exit) {
|
|
68
|
+
this.status = {
|
|
69
|
+
_tag: 'Ended',
|
|
70
|
+
endTime,
|
|
71
|
+
exit,
|
|
72
|
+
startTime: this.status.startTime,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (!this.sentrySpan.isRecording()) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (Exit.isFailure(exit)) {
|
|
80
|
+
const cause = exit.cause;
|
|
81
|
+
const message =
|
|
82
|
+
cause._tag === 'Fail' ? String(cause.error) : cause._tag === 'Die' ? String(cause.defect) : 'internal_error';
|
|
83
|
+
this.sentrySpan.setStatus({ code: 2, message });
|
|
84
|
+
} else {
|
|
85
|
+
this.sentrySpan.setStatus({ code: 1 });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
this.sentrySpan.end(nanosToHrTime(endTime));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
event(name, startTime, attributes) {
|
|
92
|
+
if (!this.sentrySpan.isRecording()) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.sentrySpan.addEvent(name, attributes , nanosToHrTime(startTime));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function createSentrySpan(
|
|
101
|
+
name,
|
|
102
|
+
parent,
|
|
103
|
+
context,
|
|
104
|
+
links,
|
|
105
|
+
startTime,
|
|
106
|
+
kind,
|
|
107
|
+
) {
|
|
108
|
+
const parentSentrySpan =
|
|
109
|
+
Option.isSome(parent) && isSentrySpan(parent.value) ? parent.value.sentrySpan : (getActiveSpan() ?? null);
|
|
110
|
+
|
|
111
|
+
const newSpan = startInactiveSpan({
|
|
112
|
+
name,
|
|
113
|
+
startTime: nanosToHrTime(startTime),
|
|
114
|
+
attributes: {
|
|
115
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: deriveOrigin(name),
|
|
116
|
+
},
|
|
117
|
+
...(parentSentrySpan ? { parentSpan: parentSentrySpan } : {}),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
return new SentrySpanWrapper(name, parent, context, links, startTime, kind, newSpan);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const makeSentryTracer = () =>
|
|
124
|
+
EffectTracer.make({
|
|
125
|
+
span(name, parent, context, links, startTime, kind) {
|
|
126
|
+
return createSentrySpan(name, parent, context, links, startTime, kind);
|
|
127
|
+
},
|
|
128
|
+
context(execution, fiber) {
|
|
129
|
+
const currentSpan = fiber.currentSpan;
|
|
130
|
+
if (currentSpan === undefined || !isSentrySpan(currentSpan)) {
|
|
131
|
+
return execution();
|
|
132
|
+
}
|
|
133
|
+
return withActiveSpan(currentSpan.sentrySpan, execution);
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Effect Layer that sets up the Sentry tracer for Effect spans.
|
|
139
|
+
*/
|
|
140
|
+
const SentryEffectTracer = makeSentryTracer();
|
|
141
|
+
|
|
142
|
+
export { SentryEffectTracer };
|
|
143
|
+
//# sourceMappingURL=tracer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer.js","sources":["../../src/tracer.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, withActiveSpan } from '@sentry/core';\nimport type * as Context from 'effect/Context';\nimport * as Exit from 'effect/Exit';\nimport * as Option from 'effect/Option';\nimport * as EffectTracer from 'effect/Tracer';\n\nfunction deriveOrigin(name: string): string {\n if (name.startsWith('http.server') || name.startsWith('http.client')) {\n return 'auto.http.effect';\n }\n\n return 'auto.function.effect';\n}\n\ntype HrTime = [number, number];\n\nconst SENTRY_SPAN_SYMBOL = Symbol.for('@sentry/effect.SentrySpan');\n\nfunction nanosToHrTime(nanos: bigint): HrTime {\n const seconds = Number(nanos / BigInt(1_000_000_000));\n const remainingNanos = Number(nanos % BigInt(1_000_000_000));\n return [seconds, remainingNanos];\n}\n\ninterface SentrySpanLike extends EffectTracer.Span {\n readonly [SENTRY_SPAN_SYMBOL]: true;\n readonly sentrySpan: Span;\n}\n\nfunction isSentrySpan(span: EffectTracer.AnySpan): span is SentrySpanLike {\n return SENTRY_SPAN_SYMBOL in span;\n}\n\nclass SentrySpanWrapper implements SentrySpanLike {\n public readonly [SENTRY_SPAN_SYMBOL]: true;\n public readonly _tag: 'Span';\n public readonly spanId: string;\n public readonly traceId: string;\n public readonly attributes: Map<string, unknown>;\n public readonly sampled: boolean;\n public readonly parent: Option.Option<EffectTracer.AnySpan>;\n public readonly links: Array<EffectTracer.SpanLink>;\n public status: EffectTracer.SpanStatus;\n public readonly sentrySpan: Span;\n\n public constructor(\n public readonly name: string,\n parent: Option.Option<EffectTracer.AnySpan>,\n public readonly context: Context.Context<never>,\n links: ReadonlyArray<EffectTracer.SpanLink>,\n startTime: bigint,\n public readonly kind: EffectTracer.SpanKind,\n existingSpan: Span,\n ) {\n this[SENTRY_SPAN_SYMBOL] = true as const;\n this._tag = 'Span' as const;\n this.attributes = new Map<string, unknown>();\n this.parent = parent;\n this.links = [...links];\n this.sentrySpan = existingSpan;\n\n const spanContext = this.sentrySpan.spanContext();\n this.spanId = spanContext.spanId;\n this.traceId = spanContext.traceId;\n this.sampled = this.sentrySpan.isRecording();\n this.status = {\n _tag: 'Started',\n startTime,\n };\n }\n\n public attribute(key: string, value: unknown): void {\n if (!this.sentrySpan.isRecording()) {\n return;\n }\n\n this.sentrySpan.setAttribute(key, value as Parameters<Span['setAttribute']>[1]);\n this.attributes.set(key, value);\n }\n\n public addLinks(links: ReadonlyArray<EffectTracer.SpanLink>): void {\n this.links.push(...links);\n }\n\n public end(endTime: bigint, exit: Exit.Exit<unknown, unknown>): void {\n this.status = {\n _tag: 'Ended',\n endTime,\n exit,\n startTime: this.status.startTime,\n };\n\n if (!this.sentrySpan.isRecording()) {\n return;\n }\n\n if (Exit.isFailure(exit)) {\n const cause = exit.cause;\n const message =\n cause._tag === 'Fail' ? String(cause.error) : cause._tag === 'Die' ? String(cause.defect) : 'internal_error';\n this.sentrySpan.setStatus({ code: 2, message });\n } else {\n this.sentrySpan.setStatus({ code: 1 });\n }\n\n this.sentrySpan.end(nanosToHrTime(endTime));\n }\n\n public event(name: string, startTime: bigint, attributes?: Record<string, unknown>): void {\n if (!this.sentrySpan.isRecording()) {\n return;\n }\n\n this.sentrySpan.addEvent(name, attributes as Parameters<Span['addEvent']>[1], nanosToHrTime(startTime));\n }\n}\n\nfunction createSentrySpan(\n name: string,\n parent: Option.Option<EffectTracer.AnySpan>,\n context: Context.Context<never>,\n links: ReadonlyArray<EffectTracer.SpanLink>,\n startTime: bigint,\n kind: EffectTracer.SpanKind,\n): SentrySpanLike {\n const parentSentrySpan =\n Option.isSome(parent) && isSentrySpan(parent.value) ? parent.value.sentrySpan : (getActiveSpan() ?? null);\n\n const newSpan = startInactiveSpan({\n name,\n startTime: nanosToHrTime(startTime),\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: deriveOrigin(name),\n },\n ...(parentSentrySpan ? { parentSpan: parentSentrySpan } : {}),\n });\n\n return new SentrySpanWrapper(name, parent, context, links, startTime, kind, newSpan);\n}\n\nconst makeSentryTracer = (): EffectTracer.Tracer =>\n EffectTracer.make({\n span(name, parent, context, links, startTime, kind) {\n return createSentrySpan(name, parent, context, links, startTime, kind);\n },\n context(execution, fiber) {\n const currentSpan = fiber.currentSpan;\n if (currentSpan === undefined || !isSentrySpan(currentSpan)) {\n return execution();\n }\n return withActiveSpan(currentSpan.sentrySpan, execution);\n },\n });\n\n/**\n * Effect Layer that sets up the Sentry tracer for Effect spans.\n */\nexport const SentryEffectTracer = makeSentryTracer();\n"],"names":[],"mappings":";;;;;AAOA,SAAS,YAAY,CAAC,IAAI,EAAkB;AAC5C,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAA,IAAK,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;AACxE,IAAI,OAAO,kBAAkB;AAC7B,EAAE;;AAEF,EAAE,OAAO,sBAAsB;AAC/B;;AAIA,MAAM,qBAAqB,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC;;AAElE,SAAS,aAAa,CAAC,KAAK,EAAkB;AAC9C,EAAE,MAAM,OAAA,GAAU,MAAM,CAAC,KAAA,GAAQ,MAAM,CAAC,UAAa,CAAC,CAAC;AACvD,EAAE,MAAM,cAAA,GAAiB,MAAM,CAAC,KAAA,GAAQ,MAAM,CAAC,UAAa,CAAC,CAAC;AAC9D,EAAE,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC;AAClC;;AAOA,SAAS,YAAY,CAAC,IAAI,EAAgD;AAC1E,EAAE,OAAO,kBAAA,IAAsB,IAAI;AACnC;;AAEA,MAAM,mBAA4C;;AAYlD,GAAS,WAAW;AACpB,MAAoB,IAAI;AACxB,IAAI,MAAM;AACV,MAAoB,OAAO;AAC3B,IAAI,KAAK;AACT,IAAI,SAAS;AACb,MAAoB,IAAI;AACxB,IAAI,YAAY;AAChB,IAAI,CAAA,IAAA,CAAA,IAAA,GAAA,IAAA,CAAA,IAAA,CAAA,OAAA,GAAA,OAAA,CAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACJ,I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0,0 +1,33 @@
|
|
|
1
|
+
import type { BrowserOptions } from '@sentry/browser';
|
|
2
|
+
import type * as EffectLayer from 'effect/Layer';
|
|
3
|
+
export { init } from './sdk';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Sentry Effect client layer.
|
|
6
|
+
*/
|
|
7
|
+
export type EffectClientLayerOptions = BrowserOptions;
|
|
8
|
+
/**
|
|
9
|
+
* Creates an Effect Layer that initializes Sentry for browser clients.
|
|
10
|
+
*
|
|
11
|
+
* To enable Effect tracing, logs, or metrics, compose with the respective layers:
|
|
12
|
+
* - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing
|
|
13
|
+
* - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs
|
|
14
|
+
* - `Sentry.SentryEffectMetricsLayer` for metrics
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import * as Sentry from '@sentry/effect/client';
|
|
19
|
+
* import { Layer, Logger, LogLevel } from 'effect';
|
|
20
|
+
*
|
|
21
|
+
* const SentryLive = Layer.mergeAll(
|
|
22
|
+
* Sentry.effectLayer({
|
|
23
|
+
* dsn: '__DSN__',
|
|
24
|
+
* integrations: [Sentry.browserTracingIntegration()],
|
|
25
|
+
* tracesSampleRate: 1.0,
|
|
26
|
+
* }),
|
|
27
|
+
* Layer.setTracer(Sentry.SentryEffectTracer),
|
|
28
|
+
* Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function effectLayer(options: EffectClientLayerOptions): EffectLayer.Layer<never, never, never>;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAIjD,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAMrG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BrowserOptions } from '@sentry/browser';
|
|
2
|
+
import type { Client } from '@sentry/core';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes the Sentry Effect SDK for browser clients.
|
|
5
|
+
*
|
|
6
|
+
* @param options - Configuration options for the SDK
|
|
7
|
+
* @returns The initialized Sentry client, or undefined if initialization failed
|
|
8
|
+
*/
|
|
9
|
+
export declare function init(options: BrowserOptions): Client | undefined;
|
|
10
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/client/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAQhE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@sentry/browser';
|
|
2
|
+
export { effectLayer, init } from './client/index';
|
|
3
|
+
export type { EffectClientLayerOptions } from './client/index';
|
|
4
|
+
export { SentryEffectTracer } from './tracer';
|
|
5
|
+
export { SentryEffectLogger } from './logger';
|
|
6
|
+
export { SentryEffectMetricsLayer } from './metrics';
|
|
7
|
+
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../src/index.client.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@sentry/node-core/light';
|
|
2
|
+
export { effectLayer, init } from './server/index';
|
|
3
|
+
export type { EffectServerLayerOptions } from './server/index';
|
|
4
|
+
export { SentryEffectTracer } from './tracer';
|
|
5
|
+
export { SentryEffectLogger } from './logger';
|
|
6
|
+
export { SentryEffectMetricsLayer } from './metrics';
|
|
7
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/index.server.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Client, Integration, Options, StackParser } from '@sentry/core';
|
|
2
|
+
import type * as EffectLayer from 'effect/Layer';
|
|
3
|
+
import type * as clientSdk from './index.client';
|
|
4
|
+
import type * as serverSdk from './index.server';
|
|
5
|
+
export * from './index.client';
|
|
6
|
+
export * from './index.server';
|
|
7
|
+
export type { EffectClientLayerOptions } from './index.client';
|
|
8
|
+
export type { EffectServerLayerOptions } from './index.server';
|
|
9
|
+
export declare function effectLayer(options: clientSdk.EffectClientLayerOptions | serverSdk.EffectServerLayerOptions): EffectLayer.Layer<never, never, never>;
|
|
10
|
+
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): Client | undefined;
|
|
11
|
+
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
|
|
12
|
+
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
|
|
13
|
+
export declare const getDefaultIntegrations: (options: Options) => Integration[];
|
|
14
|
+
export declare const defaultStackParser: StackParser;
|
|
15
|
+
export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
|
|
16
|
+
//# sourceMappingURL=index.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../src/index.types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAEjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,OAAO,EAAE,SAAS,CAAC,wBAAwB,GAAG,SAAS,CAAC,wBAAwB,GAC/E,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,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