Skip to content
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

ref(processor): Remove the config from the state #4393

Merged
merged 8 commits into from
Dec 17, 2024

Conversation

iambriccardo
Copy link
Member

@iambriccardo iambriccardo commented Dec 16, 2024

This PR removes the config from the processor state.

#skip-changelog

@iambriccardo iambriccardo changed the title riccardo/ref/remove state field 6 ref(processor): Remove the config from the state Dec 16, 2024
}

/// New type representing the normalization state of the event.
#[derive(Copy, Clone)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Just moved everything.

@iambriccardo iambriccardo marked this pull request as ready for review December 16, 2024 15:06
@iambriccardo iambriccardo requested a review from a team as a code owner December 16, 2024 15:06
@iambriccardo iambriccardo requested a review from jjbayer December 16, 2024 15:06
/// based on a feature flag.
///
/// If the project config did not come from the upstream, we keep the items.
fn should_filter(config: &Config, feature: Feature, project_info: &ProjectInfo) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Arguably you could just pass the mode in here, since that's the only relevant part of the config. This extends up to the callers of this function.

Copy link
Member

Choose a reason for hiding this comment

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

nit: The argument list is now the feature sandwiched by two configs, I would either choose (config, project_info, feature) or (feature, config, project_info).

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do! I did the same for other functions, thanks for the nit!

@@ -72,6 +72,7 @@ pub fn validate_and_set_dsc(
/// Computes the sampling decision on the incoming event
pub fn run<Group>(
state: &mut ProcessEnvelopeState<Group>,
config: Arc<Config>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise, I believe this can just be processing_enabled: bool.

Copy link
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

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

LGTM, apart from the fact that in a lot of places you pass around the config when only one of its fields is actually required. Still, that might be a deliberate abstraction.

@iambriccardo
Copy link
Member Author

LGTM, apart from the fact that in a lot of places you pass around the config when only one of its fields is actually required. Still, that might be a deliberate abstraction.

Yes, this is a great comment. I plan to improve those things in a second pass. Right now I am aiming for chirurgical changes.

@iambriccardo iambriccardo force-pushed the riccardo/ref/remove-state-field-6 branch from 060fe31 to a133f4f Compare December 16, 2024 16:01
@iambriccardo iambriccardo merged commit 2fcf51a into master Dec 17, 2024
23 checks passed
@iambriccardo iambriccardo deleted the riccardo/ref/remove-state-field-6 branch December 17, 2024 08:39
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.

3 participants