chore: Deprecate the enable_metrics option - #1300
Conversation
dd57b8b to
f023c37
Compare
| /// Panics in debug builds if the deprecated no-op field | ||
| /// [`enable_logs`](field@ClientOptions::enable_logs) is set to `false`. | ||
| pub fn with_options(mut options: ClientOptions) -> Client { |
There was a problem hiding this comment.
Client::with_options docs omit new enable_metrics panic
The # Panics docs for with_options were not updated to mention the new enable_metrics debug_assert!, so users are only warned about the enable_logs panic condition.
Evidence
- The
with_optionsrustdoc (lines 173-174) says: "Panics in debug builds if the deprecated no-op fieldenable_logsis set tofalse." - The hunk adds
debug_assert!(options.enable_metrics)insidewith_optionsat lines 184-188. - The
#[expect(deprecated)]block comment was updated from singular "field" to plural "fields" to cover both assertions, confirming the docs were not kept in sync.
Also found at 1 additional location
sentry-core/src/clientoptions.rs:256
Identified by Warden · docs-review · D8M-MS5
| /// In debug builds, we panic if the Sentry client is initialized with this option set to | ||
| /// `false`. The panic occurs at initialization-time. | ||
| #[deprecated = "this option is a deprecated no-op"] | ||
| pub enable_metrics: bool, |
There was a problem hiding this comment.
enable_metrics builder docs copy-paste typo
The updated docs for the ClientOptions::enable_metrics builder method incorrectly say "We only capture logs" instead of "metrics". Fix the sentence to refer to metrics APIs.
Evidence
sentry-core/src/clientoptions.rs:705-706in theenable_metricsbuilder docs read: "We only capture logs if you explicitly call the relevant APIs."- The preceding
enable_logsbuilder atclientoptions.rs:690correctly says "We only capture logs if you explicitly call the relevant APIs or if you enable an integration that captures logs." - The
enable_metricsbuilder docs immediately above the typo correctly say "To stop sending metrics, simply remove any calls to our metrics APIs." - The
enable_metricsmethod is public and deprecated in this change set, so its rustdoc is user-facing.
Also found at 3 additional locations
sentry-core/src/client/mod.rs:120sentry-core/src/clientoptions.rs:707sentry-core/src/clientoptions.rs:845-848
Identified by Warden · docs-review · CN8-BFY
There was a problem hiding this comment.
Fix attempt detected (commit 469f7a8)
The commit directly updates the enable_metrics documentation but leaves the sentence incorrectly saying that only logs are captured instead of metrics.
The original issue appears unresolved. Please review and try again.
Evaluated by Warden
Providing the ability to disable sending metrics is somewhat of a footgun, as this flag can prevent all Sentry metrics from being sent, so this change turns that option into a no-op, ensuring metrics are always enabled. Metrics are only sent when users explicitly record them with the metrics APIs we provide. Users who do not want metrics can stop using those APIs. Resolves [#1298](#1298) Resolves [RUST-275](https://linear.app/getsentry/issue/RUST-275)
f023c37 to
469f7a8
Compare
Providing the ability to disable sending metrics is somewhat of a footgun, as this flag can prevent all Sentry metrics from being sent, so this change turns that option into a no-op, ensuring metrics are always enabled.
Metrics are only sent when users explicitly record them with the metrics APIs we provide. Users who do not want metrics can stop using those APIs.
Resolves #1298
Resolves RUST-275