Skip to content

fix: use release-health flag in sentry-actix and remove it from subcrates where unneeded#787

Merged
lcian merged 7 commits intomasterfrom
lcian/release-health-flags
May 8, 2025
Merged

fix: use release-health flag in sentry-actix and remove it from subcrates where unneeded#787
lcian merged 7 commits intomasterfrom
lcian/release-health-flags

Conversation

@lcian
Copy link
Copy Markdown
Member

@lcian lcian commented May 7, 2025

Removes the release-health feature from sentry-tower and sentry-tracing, where it was used unnecessarily.

It's still a feature flag, enabled by default, in sentry-actix, as it's used there to create a session per request.
This was the default behavior previously, with no way of opting out, so it makes sense to keep it enabled by default there.

default = ["release-health"]

I've fixed it to actually be used in the code because compilation would fail otherwise due to the hub.start_session(); call.

There is no change to the sentry crate, where this flag is part of the default features as intended:

"release-health",

Note that sentry has no way to bring in sentry-actix via feature flags.
Is there a reason for that?
I'll create a separate PR to enable it, similarly to other integrations.

@lcian lcian requested a review from Swatinem May 7, 2025 14:21
Comment thread sentry-actix/src/lib.rs Outdated
@@ -294,6 +296,7 @@ where
.map(|client| client.options().max_request_body_size)
.unwrap_or(MaxRequestBodySize::None);
if track_sessions {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you should probably move the #[cfg] up to where you define this field. I believe the client options auto_session_tracking is also not available with this feature, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

At the moment the option is available even without the flag, I've just added a doc line on it to make it clear that the feature flag needs to be enabled for that option to have any effect.

But, I think both auto_session_tracking and session_mode in ClientOptions should instead not be available if the feature is not enabled.
This way, if someone uses those options but their deps don't bring in sentry-core/release-health, it will fail to compile. Better than no-opping silently.

I will update the PR.

@lcian
Copy link
Copy Markdown
Member Author

lcian commented May 8, 2025

Now it should be good.

@lcian lcian requested a review from Swatinem May 8, 2025 12:57
Comment thread sentry-core/src/session.rs Outdated
}

#[test]
#[cfg(feature = "release-health")]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we are still running this test in CI, are we?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually the whole session.rs is wrapped in:

#[cfg(feature = "release-health")]
mod session_impl {

So effectively these extra cfg macros inside it are useless. Removed them.

@lcian lcian requested a review from Swatinem May 8, 2025 15:06
@lcian lcian merged commit b69d82a into master May 8, 2025
14 checks passed
@lcian lcian deleted the lcian/release-health-flags branch May 8, 2025 15:40
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