Skip to content

Commit 6fa5fa8

Browse files
committed
fixup! feat(effect): Add metrics to Sentry.effectLayer
1 parent 5b1c7d8 commit 6fa5fa8

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

packages/effect/src/metrics.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ function sendMetricToSentry(pair: MetricPair.MetricPair.Untyped): void {
2020
const attributes = labelsToAttributes(metricKey.tags);
2121

2222
if (MetricState.isCounterState(metricState)) {
23-
const value = typeof metricState.count === 'bigint' ? Number(metricState.count) : metricState.count;
23+
const value = Number(metricState.count);
2424
sentryMetrics.count(name, value, { attributes });
2525
} else if (MetricState.isGaugeState(metricState)) {
26-
const value = typeof metricState.value === 'bigint' ? Number(metricState.value) : metricState.value;
26+
const value = Number(metricState.value);
2727
sentryMetrics.gauge(name, value, { attributes });
2828
} else if (MetricState.isHistogramState(metricState)) {
29-
sentryMetrics.distribution(`${name}.sum`, metricState.sum, { attributes });
29+
sentryMetrics.gauge(`${name}.sum`, metricState.sum, { attributes });
3030
sentryMetrics.gauge(`${name}.count`, metricState.count, { attributes });
3131
sentryMetrics.gauge(`${name}.min`, metricState.min, { attributes });
3232
sentryMetrics.gauge(`${name}.max`, metricState.max, { attributes });
3333
} else if (MetricState.isSummaryState(metricState)) {
34-
sentryMetrics.distribution(`${name}.sum`, metricState.sum, { attributes });
34+
sentryMetrics.gauge(`${name}.sum`, metricState.sum, { attributes });
3535
sentryMetrics.gauge(`${name}.count`, metricState.count, { attributes });
3636
sentryMetrics.gauge(`${name}.min`, metricState.min, { attributes });
3737
sentryMetrics.gauge(`${name}.max`, metricState.max, { attributes });
@@ -59,7 +59,7 @@ function sendDeltaMetricToSentry(
5959
const metricId = getMetricId(pair);
6060

6161
if (MetricState.isCounterState(metricState)) {
62-
const currentValue = typeof metricState.count === 'bigint' ? Number(metricState.count) : metricState.count;
62+
const currentValue = Number(metricState.count);
6363

6464
const previousValue = previousCounterValues.get(metricId) ?? 0;
6565
const delta = currentValue - previousValue;

packages/effect/src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type EffectServerLayerOptions = NodeOptions;
1616
* This layer provides Effect applications with full Sentry instrumentation including:
1717
* - Effect spans traced as Sentry spans
1818
* - Effect logs forwarded to Sentry (when `enableLogs` is set)
19-
19+
* - Effect metrics sent to Sentry (when `enableMetrics` is set)
2020
*
2121
* @example
2222
* ```typescript

packages/effect/test/metrics.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('createMetricsFlusher', () => {
196196

197197
flusher.flush();
198198

199-
expect(mockDistribution).toHaveBeenCalledWith('flush_test_histogram.sum', expect.any(Number), { attributes: {} });
199+
expect(mockGauge).toHaveBeenCalledWith('flush_test_histogram.sum', expect.any(Number), { attributes: {} });
200200
expect(mockGauge).toHaveBeenCalledWith('flush_test_histogram.count', expect.any(Number), { attributes: {} });
201201
expect(mockGauge).toHaveBeenCalledWith('flush_test_histogram.min', expect.any(Number), { attributes: {} });
202202
expect(mockGauge).toHaveBeenCalledWith('flush_test_histogram.max', expect.any(Number), { attributes: {} });
@@ -220,7 +220,7 @@ describe('createMetricsFlusher', () => {
220220

221221
flusher.flush();
222222

223-
expect(mockDistribution).toHaveBeenCalledWith('flush_test_summary.sum', 60, { attributes: {} });
223+
expect(mockGauge).toHaveBeenCalledWith('flush_test_summary.sum', 60, { attributes: {} });
224224
expect(mockGauge).toHaveBeenCalledWith('flush_test_summary.count', 3, { attributes: {} });
225225
expect(mockGauge).toHaveBeenCalledWith('flush_test_summary.min', 10, { attributes: {} });
226226
expect(mockGauge).toHaveBeenCalledWith('flush_test_summary.max', 30, { attributes: {} });

0 commit comments

Comments
 (0)