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

feat(spooler): Add last_peek value in the priority #3922

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

iambriccardo
Copy link
Member

@iambriccardo iambriccardo commented Aug 13, 2024

This PR adds the last_peek field to the Priority struct, which defines the priority of the stacks.

The rationale behind the implementation is that assuming we have the same readiness and received_at time and keep peeking the stack, we will always get the same element. We want to avoid this and rather have a different element returned at every peek to avoid blocking stacks.

Closes: https://github.com/getsentry/team-ingest/issues/523

@iambriccardo iambriccardo marked this pull request as ready for review August 13, 2024 10:16
@iambriccardo iambriccardo requested a review from a team as a code owner August 13, 2024 10:16
@@ -20,6 +20,7 @@
- Extract `user.geo.country_code` into span indexed. ([#3911](https://github.com/getsentry/relay/pull/3911))
- Add `span.system` tag to span metrics ([#3913](https://github.com/getsentry/relay/pull/3913))
- Extract client sdk from transaction into profiles. ([#3915](https://github.com/getsentry/relay/pull/3915))
- Add `last_peek` field to the `Priority` struct. ([#3922](https://github.com/getsentry/relay/pull/3922))
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need a changelog entry for this, it is a very technical description.

Comment on lines +165 to +176
let Some((
QueueItem {
key: stack_key,
value: _,
},
_,
)) = self.priority_queue.peek()
else {
return Ok(None);
};

let stack_key = *stack_key;
Copy link
Member

Choose a reason for hiding this comment

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

Untested:

Suggested change
let Some((
QueueItem {
key: stack_key,
value: _,
},
_,
)) = self.priority_queue.peek()
else {
return Ok(None);
};
let stack_key = *stack_key;
let Some((
QueueItem {
key: &stack_key,
value: _,
},
_,
)) = self.priority_queue.peek()
else {
return Ok(None);
};

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried already but it was not possible :(

@iambriccardo iambriccardo merged commit 5c4de42 into master Aug 14, 2024
24 checks passed
@iambriccardo iambriccardo deleted the riccardo/feat/last_peek branch August 14, 2024 08:09
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