-
-
Notifications
You must be signed in to change notification settings - Fork 190
chore: Deprecate the enable_metrics option
#1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -251,9 +251,11 @@ pub struct ClientOptions { | |
| /// `false`. The panic occurs at initialization-time. | ||
| #[deprecated = "this option is a deprecated no-op"] | ||
| pub enable_logs: bool, | ||
| /// Whether metric capture APIs should capture metrics. | ||
| /// Deprecated no-op. | ||
| /// | ||
| /// See [`enable_metrics`](method@ClientOptions::enable_metrics) for details. | ||
| /// 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The updated docs for the Evidence
Also found at 3 additional locations
Identified by Warden · docs-review · CN8-BFY There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| /// Callback that is executed for each [`Metric`] before sending. | ||
| /// | ||
|
|
@@ -698,12 +700,19 @@ impl ClientOptions { | |
| } | ||
| } | ||
|
|
||
| /// Enables or disables [metric capture APIs](field@ClientOptions::enable_metrics). | ||
| /// This function is effectively a no-op, as it sets the deprecated, no-op field | ||
| /// [`enable_metrics`](field@ClientOptions::enable_metrics). | ||
| /// | ||
| /// To stop sending metrics, simply remove any calls to our metrics APIs. We only capture | ||
| /// logs if you explicitly call the relevant APIs. | ||
| /// | ||
| /// The `metrics` feature is required to capture metrics. Defaults to `true`. | ||
| /// 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 function sets a no-op option"] | ||
| #[inline] | ||
| pub fn enable_metrics(self, enable_metrics: bool) -> Self { | ||
| Self { | ||
| #[expect(deprecated, reason = "need to set deprecated field")] | ||
| enable_metrics, | ||
| ..self | ||
| } | ||
|
|
@@ -832,7 +841,11 @@ impl fmt::Debug for ClientOptions { | |
| &self.enable_logs, | ||
| ) | ||
| .field("before_send_log", &before_send_log) | ||
| .field("enable_metrics", &self.enable_metrics) | ||
| .field( | ||
| "enable_metrics", | ||
| #[expect(deprecated, reason = "still need to debug-log this field")] | ||
| &self.enable_metrics, | ||
| ) | ||
| .field("before_send_metric", &before_send_metric) | ||
| .field("org_id", &self.org_id) | ||
| .field("strict_trace_continuation", &self.strict_trace_continuation) | ||
|
|
@@ -874,6 +887,7 @@ impl Default for ClientOptions { | |
| #[expect(deprecated, reason = "still need to set deprecated fields")] | ||
| enable_logs: true, | ||
| before_send_log: None, | ||
| #[expect(deprecated, reason = "still need to set deprecated fields")] | ||
| enable_metrics: true, | ||
| before_send_metric: None, | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client::with_optionsdocs omit newenable_metricspanicThe
# Panicsdocs forwith_optionswere not updated to mention the newenable_metricsdebug_assert!, so users are only warned about theenable_logspanic condition.Evidence
with_optionsrustdoc (lines 173-174) says: "Panics in debug builds if the deprecated no-op fieldenable_logsis set tofalse."debug_assert!(options.enable_metrics)insidewith_optionsat lines 184-188.#[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:256Identified by Warden · docs-review · D8M-MS5