Skip to content

chore: Deprecate the enable_metrics option - #1300

Open
szokeasaurusrex wants to merge 2 commits into
szokeasaurusrex/enable-logs-deprecationfrom
szokeasaurusrex/enable-metrics-deprecation
Open

chore: Deprecate the enable_metrics option#1300
szokeasaurusrex wants to merge 2 commits into
szokeasaurusrex/enable-logs-deprecationfrom
szokeasaurusrex/enable-metrics-deprecation

Conversation

@szokeasaurusrex

@szokeasaurusrex szokeasaurusrex commented Aug 13, 2026

Copy link
Copy Markdown
Member

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

@linear-code

linear-code Bot commented Aug 13, 2026

Copy link
Copy Markdown

RUST-275

@szokeasaurusrex
szokeasaurusrex marked this pull request as ready for review August 13, 2026 11:21
@szokeasaurusrex
szokeasaurusrex requested a review from a team as a code owner August 13, 2026 11:21
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/enable-metrics-deprecation branch from dd57b8b to f023c37 Compare August 13, 2026 12:11
Comment on lines 173 to 175
/// 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_options rustdoc (lines 173-174) says: "Panics in debug builds if the deprecated no-op field enable_logs is set to false."
  • The hunk adds debug_assert!(options.enable_metrics) inside with_options at 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-706 in the enable_metrics builder docs read: "We only capture logs if you explicitly call the relevant APIs."
  • The preceding enable_logs builder at clientoptions.rs:690 correctly says "We only capture logs if you explicitly call the relevant APIs or if you enable an integration that captures logs."
  • The enable_metrics builder docs immediately above the typo correctly say "To stop sending metrics, simply remove any calls to our metrics APIs."
  • The enable_metrics method 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:120
  • sentry-core/src/clientoptions.rs:707
  • sentry-core/src/clientoptions.rs:845-848

Identified by Warden · docs-review · CN8-BFY

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/enable-metrics-deprecation branch from f023c37 to 469f7a8 Compare August 13, 2026 13:53
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.

Deprecate and no-op-ify enable_metrics

2 participants