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

fix(profiling): Expand all Profile items in an envelope #1465

Merged
merged 5 commits into from
Sep 14, 2022

Conversation

phacops
Copy link
Contributor

@phacops phacops commented Sep 13, 2022

This fixes the last 2 remaing issues introduced by my recent PRs:

  • remove Profile items if the organization doesn't have profiling enabled
  • expand all Profile items in an envelope as opposed to jus the first one

@phacops phacops requested a review from a team September 13, 2022 00:15
@@ -850,27 +850,24 @@ impl EnvelopeProcessor {

/// Remove profiles if the feature flag is not enabled
fn process_profiles(&self, state: &mut ProcessEnvelopeState) {
let profiling_enabled = state.project_state.has_feature(Feature::Profiling);
Copy link
Member

@jjbayer jjbayer Sep 13, 2022

Choose a reason for hiding this comment

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

This should work, even for external Relays, because features is part of LimitedProjectConfig.

https://github.com/getsentry/relay/blob/master/relay-server/src/actors/project.rs#L177

envelope.add_item(item);
}
}
Ok(mut payloads) => new_profiles.append(&mut payloads),
Copy link
Member

Choose a reason for hiding this comment

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

What's the advantage of introducing the intermediate vector new_profiles here, instead of calling envelope.add_item directly?

Copy link
Member

Choose a reason for hiding this comment

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

That would create an endless loop in the outer loop, since that runs until there's no more profiling item in the envelope.

let context = &state.envelope_context;
let new_profiles: &mut Vec<Vec<u8>> = &mut Vec::new();
Copy link
Member

Choose a reason for hiding this comment

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

This could be declared a Vec directly and use type inference.

@phacops phacops merged commit f9973a6 into master Sep 14, 2022
@phacops phacops deleted the pierre/profiling-try-to-expand-all-items branch September 14, 2022 18:35
jan-auer added a commit that referenced this pull request Sep 15, 2022
* master:
  fix(profiling): Expand all Profile items in an envelope (#1465)
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.

None yet

3 participants