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(cardinality): Passive mode per cardinality limit #3199

Merged
merged 6 commits into from
Mar 5, 2024

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Mar 4, 2024

Makes it possible to mark individual cardinality limits per project to be marked as passive.

Initially the idea was not to add the passive flag to the individual limit and only enforce the passive property/mode in the processor. But it turns out this is more complicated than just directly discarding a passive result in the cardinality limiter. This was made easy due to already having the correct abstraction (Rejections trait) in place, it just needed to be slightly updated to be passed the limit instead of just the limit id. This approach also allows us to tag all metrics and cardinality errors with a passive tag.

#skip-changelog

@Dav1dde Dav1dde self-assigned this Mar 4, 2024
@Dav1dde Dav1dde marked this pull request as ready for review March 5, 2024 09:26
@Dav1dde Dav1dde requested a review from a team as a code owner March 5, 2024 09:26
@Dav1dde Dav1dde force-pushed the dav1d/ref/cardinality-mode branch from 768b4f3 to 81f7fb0 Compare March 5, 2024 09:26
relay-cardinality/src/config.rs Outdated Show resolved Hide resolved
Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

Might be worth a changelog entry, since it adds a new field to project configs.

&Item::new(4, MetricNamespace::Custom),
])
);
drop(rejected); // NLL are broken here without the explicit drop
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 NLL?

Copy link
Member Author

Choose a reason for hiding this comment

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

Non lexical lifetimes.

The compiler should be smart enough to see that rejected is no longer used, but without the drop I cannot call into_accepted because there is still the reference to rejected.

pub fn enforced_limits(&self) -> &HashSet<&'a str> {
///
/// This includes passive limits.
pub fn limits(&self) -> &HashSet<&'a CardinalityLimit> {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub fn limits(&self) -> &HashSet<&'a CardinalityLimit> {
pub fn exceeded_limits(&self) -> &HashSet<&'a CardinalityLimit> {

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'll do that in a follow-up, I need. a librelay release to continue and I don't feel like waiting another 30 minutes...

@Dav1dde Dav1dde merged commit f383e8f into master Mar 5, 2024
20 checks passed
@Dav1dde Dav1dde deleted the dav1d/ref/cardinality-mode branch March 5, 2024 10:29
Dav1dde added a commit that referenced this pull request Mar 5, 2024
)

Followup of #3199 

Renames the `limits` fn to a better name, adds changelog and librelay
changelog entry (project config is affected).
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