Skip to content

feat(effect): Add extra opt-in for logs and metrics#19755

Merged
JPeer264 merged 2 commits intojp/add-effect-sdkfrom
jp/add-effect-sdk-stack/5.5
Mar 11, 2026
Merged

feat(effect): Add extra opt-in for logs and metrics#19755
JPeer264 merged 2 commits intojp/add-effect-sdkfrom
jp/add-effect-sdk-stack/5.5

Conversation

@JPeer264
Copy link
Member

This PR is now adding a different naming schema for enabling logs and metrics based on: https://develop.sentry.dev/sdk/telemetry/metrics/#auto-emitted-metrics

For the logs I also added them, which might not make the most sense, as enableLogs is now false by default, which means that there is a double opt-in needed to make logs work via Effect.log.

The naming is TBD, but this is the best I came up with: enableEffectLogs & enableEffectMetrics

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.63 kB added added
@sentry/browser - with treeshaking flags 24.14 kB added added
@sentry/browser (incl. Tracing) 42.44 kB added added
@sentry/browser (incl. Tracing, Profiling) 47.1 kB added added
@sentry/browser (incl. Tracing, Replay) 81.25 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.88 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 85.95 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 98.21 kB added added
@sentry/browser (incl. Feedback) 42.44 kB added added
@sentry/browser (incl. sendFeedback) 30.3 kB added added
@sentry/browser (incl. FeedbackAsync) 35.36 kB added added
@sentry/browser (incl. Metrics) 26.8 kB added added
@sentry/browser (incl. Logs) 26.94 kB added added
@sentry/browser (incl. Metrics & Logs) 27.62 kB added added
@sentry/react 27.39 kB added added
@sentry/react (incl. Tracing) 44.78 kB added added
@sentry/vue 30.08 kB added added
@sentry/vue (incl. Tracing) 44.31 kB added added
@sentry/svelte 25.66 kB added added
CDN Bundle 28.18 kB added added
CDN Bundle (incl. Tracing) 43.26 kB added added
CDN Bundle (incl. Logs, Metrics) 29.02 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 44.11 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 68.1 kB added added
CDN Bundle (incl. Tracing, Replay) 80.14 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 85.66 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.54 kB added added
CDN Bundle - uncompressed 82.39 kB added added
CDN Bundle (incl. Tracing) - uncompressed 128.11 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.23 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.94 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.89 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 245 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.81 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.91 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 260.72 kB added added
@sentry/nextjs (client) 47.19 kB added added
@sentry/sveltekit (client) 42.9 kB added added
@sentry/node-core 52.25 kB added added
@sentry/node 174.7 kB added added
@sentry/node - without tracing 97.4 kB added added
@sentry/aws-serverless 113.2 kB added added

* dsn: '__DSN__',
* enableLogs: true,
* enableMetrics: true,
* enableEffectLogs: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: We should probably keep enableLogs in the example too, otherwise you wouldn't get logs just with this right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true, let's keep that in.

Base automatically changed from jp/add-effect-sdk-stack/5 to jp/add-effect-sdk March 11, 2026 10:47
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

attributes: { ...attributes, word },
});
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frequency metrics overcounted on every periodic flush

High Severity

Frequency metrics use sentryMetrics.count with cumulative occurrence values from metricState.occurrences, but unlike counter metrics, they bypass the delta calculation in sendDeltaMetricToSentry. Since flushMetricsToSentry runs every 10 seconds via the layer's scheduler, each flush re-sends the full cumulative count. After N flushes, Sentry shows roughly N × actual_count for each word. Frequency metrics need the same delta treatment that counters receive.

Additional Locations (1)
Fix in Cursor Fix in Web

@JPeer264 JPeer264 force-pushed the jp/add-effect-sdk-stack/5.5 branch from 87daa55 to 5beef22 Compare March 11, 2026 13:03
@JPeer264 JPeer264 requested a review from andreiborza March 11, 2026 13:03
Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JPeer264 JPeer264 force-pushed the jp/add-effect-sdk-stack/5.5 branch from 5beef22 to 930bbf5 Compare March 11, 2026 13:40
@JPeer264 JPeer264 merged commit 6b4cf4e into jp/add-effect-sdk Mar 11, 2026
10 checks passed
@JPeer264 JPeer264 deleted the jp/add-effect-sdk-stack/5.5 branch March 11, 2026 13:41
@github-actions
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,461 - - added
GET With Sentry 1,749 18% - added
GET With Sentry (error only) 6,136 65% - added
POST Baseline 1,191 - - added
POST With Sentry 598 50% - added
POST With Sentry (error only) 1,070 90% - added
MYSQL Baseline 3,304 - - added
MYSQL With Sentry 500 15% - added
MYSQL With Sentry (error only) 2,673 81% - added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants