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

Copy cortex/pkg/ruler package dependency into Loki #5089

Merged
merged 14 commits into from
Jan 12, 2022

Conversation

DylanGuedes
Copy link
Contributor

@DylanGuedes DylanGuedes commented Jan 10, 2022

What this PR does / why we need it:
As a part of removing Loki dependency on cortex packages, we decided to copy the ruler package from cortex to Loki itself.
Note that I decided to copy it into a base subpackage instead of merging with existing ruler package to make reviewing this easier. If you prefer that I try merging them into a single package at this same PR, just let me know.

Which issue(s) this PR fixes:
N/A

Special notes for your reviewer:

  • Note that I decided to copy it into a base subpackage instead of merging it with the existing ruler package to make reviewing this easier. If you prefer that I try merging them into a single package at this same PR, just let me know.

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

@DylanGuedes DylanGuedes changed the title Fork cortex ruler Copy cortex/pkg/ruler package dependency into Loki Jan 10, 2022
@DylanGuedes DylanGuedes marked this pull request as ready for review January 10, 2022 20:57
@DylanGuedes DylanGuedes requested a review from a team as a code owner January 10, 2022 20:57
@DylanGuedes
Copy link
Contributor Author

I recommend reviewing this commit-by-commit.

@@ -8,15 +8,15 @@ import (
"io/ioutil"
"strings"

"github.com/cortexproject/cortex/pkg/chunk"
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace with the Loki one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. pushed a few commits changing it, wdyt?

@@ -1,4 +1,4 @@
package ruler
package base

import (
"github.com/prometheus/client_golang/prometheus"
Copy link
Contributor

Choose a reason for hiding this comment

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

The util package below could be avoided ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, unfortunately. However, we are already working on forking util.

@@ -1,4 +1,4 @@
package ruler
package base

import (
"context"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the util package of cortex below ?

"testing"
"time"

"github.com/cortexproject/cortex/pkg/util"
Copy link
Contributor

Choose a reason for hiding this comment

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

same we should get those function in loki.

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

@cyriltovena cyriltovena merged commit 3d7e9ce into grafana:main Jan 12, 2022
gotjosh added a commit that referenced this pull request Feb 10, 2022
We copied over the ruler code as part of #5089, and it seems that at the same time we stopped depending on the object storage implementation of Cortex. Turns out, there are (slight) differences between the clients which meant that response returned by the API when we try to get a rule group that is not found had changed.

This ensures that is consistent with the error assertion that we have in the code for the ruler.
dannykopping pushed a commit that referenced this pull request Feb 10, 2022
* Ruler: Rule group not found API message

We copied over the ruler code as part of #5089, and it seems that at the same time we stopped depending on the object storage implementation of Cortex. Turns out, there are (slight) differences between the clients which meant that response returned by the API when we try to get a rule group that is not found had changed.

This ensures that is consistent with the error assertion that we have in the code for the ruler.

* Use the method from the interfaace to determine object storage

* also include DeleteObject

* appease the linter
chaudum pushed a commit that referenced this pull request Feb 10, 2022
We copied over the ruler code as part of #5089, and it seems that at the same time we stopped depending on the object storage implementation of Cortex. Turns out, there are (slight) differences between the clients which meant that response returned by the API when we try to get a rule group that is not found had changed.

This ensures that is consistent with the error assertion that we have in the code for the ruler.
dannykopping pushed a commit that referenced this pull request Feb 10, 2022
* Ruler: Rule group not found API message

We copied over the ruler code as part of #5089, and it seems that at the same time we stopped depending on the object storage implementation of Cortex. Turns out, there are (slight) differences between the clients which meant that response returned by the API when we try to get a rule group that is not found had changed.

This ensures that is consistent with the error assertion that we have in the code for the ruler.

* Use the method from the interfaace to determine object storage

* also include DeleteObject

* appease the linter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants