Skip to content

Decouple ruler dependency controller from concurrency controller#13527

Merged
gotjosh merged 1 commit intoprometheus:mainfrom
pracucci:decouple-rule-concurrency-and-dependency-controller
Feb 2, 2024
Merged

Decouple ruler dependency controller from concurrency controller#13527
gotjosh merged 1 commit intoprometheus:mainfrom
pracucci:decouple-rule-concurrency-and-dependency-controller

Conversation

@pracucci
Copy link
Copy Markdown
Contributor

@pracucci pracucci commented Feb 2, 2024

This PR is a follow up of #12946. In #12946 we had RuleConcurrencyController RuleEligible() and Invalidate() whose design have potential side effects (see discussion).

In this PR I'm proposing two changes:

  1. Decouple the dependency controller from concurrency controller
  2. Expose the information whether a Rule has dependants and/or dependencies through the RuleDetail (this also covers an use case we have in Mimir, where we need to distinguish between the two)

In addition, after this PR projects vendoring the ruler (like Loki, Mimir, Cortex, ...) can:

  • Inject custom dependency controller
  • Inject custom concurrency controller
  • Receive the information whether a rule's query has dependants and/or dependencies through the RuleDetail

Notes about naming

Why did I call the fields / functions "no dependent/cy rules" (negative) instead of a positive "dependent/cy rules"? Reason is that I wanted the zero value to be the safest option (so zero value means "it's not guaranteed that there are no dependents/cies").

@pracucci pracucci marked this pull request as ready for review February 2, 2024 09:33
Copy link
Copy Markdown
Member

@gotjosh gotjosh left a comment

Choose a reason for hiding this comment

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

LGTM - I don't have a single comment great work and thank you very much for your contribution.

@gotjosh
Copy link
Copy Markdown
Member

gotjosh commented Feb 2, 2024

I am going to merge as I don't think this is controversial - it's mostly a code refactor and doesn't really change the original functionality.

@gotjosh gotjosh merged commit aa845f7 into prometheus:main Feb 2, 2024
@pracucci pracucci deleted the decouple-rule-concurrency-and-dependency-controller branch February 2, 2024 17:09
gotjosh added a commit that referenced this pull request Jul 19, 2024
Even though the main purpose of this refactor is to modify the interface of the concurrency controller to accept a Context. I did two drive-by modifications that I think are sensible:

1. I have moved the check for dependencies on rules to the controller itself - this aligns with how the controller should behave as it is a deciding factor on wether we should run concurrently or not.
2. I cleaned up some unused methods from the days of the old interface before #13527 changed it.

Signed-off-by: gotjosh <[email protected]>
gotjosh added a commit that referenced this pull request Jul 22, 2024
* Rules: Refactor concurrency controller interface

Even though the main purpose of this refactor is to modify the interface of the concurrency controller to accept a Context. I did two drive-by modifications that I think are sensible:

1. I have moved the check for dependencies on rules to the controller itself - this aligns with how the controller should behave as it is a deciding factor on wether we should run concurrently or not.
2. I cleaned up some unused methods from the days of the old interface before #13527 changed it.

Signed-off-by: gotjosh <[email protected]>
---------

Signed-off-by: gotjosh <[email protected]>
kushalShukla-web pushed a commit to kushalShukla-web/prometheus that referenced this pull request Jul 23, 2024
* Rules: Refactor concurrency controller interface

Even though the main purpose of this refactor is to modify the interface of the concurrency controller to accept a Context. I did two drive-by modifications that I think are sensible:

1. I have moved the check for dependencies on rules to the controller itself - this aligns with how the controller should behave as it is a deciding factor on wether we should run concurrently or not.
2. I cleaned up some unused methods from the days of the old interface before prometheus#13527 changed it.

Signed-off-by: gotjosh <[email protected]>
---------

Signed-off-by: gotjosh <[email protected]>
Signed-off-by: kushagra Shukla <[email protected]>
kushalShukla-web pushed a commit to kushalShukla-web/prometheus that referenced this pull request Jul 25, 2024
* Rules: Refactor concurrency controller interface

Even though the main purpose of this refactor is to modify the interface of the concurrency controller to accept a Context. I did two drive-by modifications that I think are sensible:

1. I have moved the check for dependencies on rules to the controller itself - this aligns with how the controller should behave as it is a deciding factor on wether we should run concurrently or not.
2. I cleaned up some unused methods from the days of the old interface before prometheus#13527 changed it.

Signed-off-by: gotjosh <[email protected]>
---------

Signed-off-by: gotjosh <[email protected]>
kushalShukla-web pushed a commit to kushalShukla-web/prometheus that referenced this pull request Jul 25, 2024
* Rules: Refactor concurrency controller interface

Even though the main purpose of this refactor is to modify the interface of the concurrency controller to accept a Context. I did two drive-by modifications that I think are sensible:

1. I have moved the check for dependencies on rules to the controller itself - this aligns with how the controller should behave as it is a deciding factor on wether we should run concurrently or not.
2. I cleaned up some unused methods from the days of the old interface before prometheus#13527 changed it.

Signed-off-by: gotjosh <[email protected]>
---------

Signed-off-by: gotjosh <[email protected]>
Signed-off-by: Kushal Shukla <[email protected]>
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