Skip to content

frontend: [Refactor] Isolated middlewares from frontend to allow usage from external projects. #1332

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

Closed
wants to merge 1 commit into from

Conversation

bwplotka
Copy link
Contributor

Hello!

This work is done as part of: thanos-io/thanos#1006

PTAL @tomwilkie and thanks for guidance so far! 🥇

No logic should be changed, just refactor that allows middlewares reuse.
Feedback welcome, especially on TODOs I added, if the direction is OK.

FYI: Thanos side changes (very WIP): thanos-io/thanos#1039

Roughly, changes (sorry for biggy PR):

  • frontend.proto only specifies gRPC service
  • Middlewares with query range moves to queryrange package
  • queryrange.proto has rest (query API for range) and is in queryrange package.
  • Removed util.Logger frmo queryrange
  • Removed usages of overrides, moved to Limits interface in queryrange.
  • Ran goimports.
  • Some namings.
  • QueryRange proto generated is not commited. I know it might be non consistent, but no easy way
    for external project to regenerate it (?).
  • Removed log messages there were duplicated with return error (bad error handling).
  • Added TODOs
  • ResultCache Middleware has now config independent constructor.

TODO in followng PRs: Retry middleware & other TODOs

Signed-off-by: Bartek Plotka [email protected]

…e from external projects.

No logic should be changed, just refactor that allows middlewares reuse.

Changes:
* frontend.proto only specifies gRPC service
* Middlewares with query range moves to queryrange package
* queryrange.proto has rest (query API for range) and is in queryrange package.
* Removed util.Logger frmo queryrange
* Removed usages of overrides, moved to Limits interface in queryrange.
* Ran goimports.
* Some namings.
* QueryRange proto generated is not commited. I know it might be non consistent, but no easy way
for external project to regenerate it (?).
* Removed log messages there were duplicated with return error (bad error handling).
* Added TODOs
* ResultCache Middleware has now config independent constructor.

Question: Why all of those methods `get`, `put`, `Fetch` does not return error?

TODO in followng PRs: Retry middleware & other TODOs

Signed-off-by: Bartek Plotka <[email protected]>
@bwplotka bwplotka changed the title frontend: (Refactor) Isolated middlewares from frontend to allow usage from external projects. frontend: [Refactor] Isolated middlewares from frontend to allow usage from external projects. Apr 16, 2019
@bwplotka
Copy link
Contributor Author

Will fix build errors later on

@tomwilkie
Copy link
Contributor

Hi @bwplotka! Am on the road right now will give this a thorough look tomorrow morning on the next flight. Cheers!

@tomwilkie tomwilkie closed this Apr 17, 2019
@tomwilkie tomwilkie reopened this Apr 17, 2019
Copy link
Contributor

@bboreham bboreham left a comment

Choose a reason for hiding this comment

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

Looks broadly ok; some points below.

[[override]]
name = "github.com/prometheus/client_golang"
branch = "master"
version = "v0.9.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment giving the reason we need an override, any background why this specific version, and the conditions under which the override can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, there was comment before (TODO: Pin this version), so I just fullfillted TODO, but sure, can add more info.

Copy link
Contributor

Choose a reason for hiding this comment

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

Where do you see "TODO"? I see "Pin to master branch until there is a more recent stable release"
Can the override be removed entirely now?

Copy link
Contributor Author

@bwplotka bwplotka Apr 28, 2019

Choose a reason for hiding this comment

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

? Isn't that TODO-like comment? Didn't I do exactly what is requested as stable release is there now? 😕

"Pin to master branch until there is a more recent stable release"

Anyway, override is required due to jaeger contstraint. Commented all and added in another PR:
#1353

One it will be merged, I will remove this change from this PR.

@@ -0,0 +1,2232 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't traditionally checked in the .pb.go files.
I realise this particular one may be important to your objectives, but if we do one we should do all.

Copy link
Contributor Author

@bwplotka bwplotka Apr 17, 2019

Choose a reason for hiding this comment

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

Agree, let's discuss.

Did not try to see how painful it will be for other projects to use it without it being not commited, so need to check that first. I assume I would need to understand the gogo version of cortex and regenerate on thanos side - not fun.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Will try to cover this at the community meeting today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad - community meeting is tomorrow (2nd May)

Copy link
Contributor

Choose a reason for hiding this comment

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

From the community meeting we decided that we would generally like to check in the code with a couple caveats: #1371

I would say this PR should either not check in the pb.go or wait until after the tasks in that issue are completed. I don't want to be in a state where some files are checked in and others are not.

@@ -764,18 +764,19 @@
revision = "fb713f6d8239b57c646cae30f78e8b4b8861a1aa"

[[projects]]
branch = "master"
digest = "1:511d8b5b4cef21fdc5c660e5d9c46a2d6d039809d9600ff1518b033e300522b9"
digest = "1:4a8dc3e9c1bb30298bfee9d4b89d4b527410582901bc409a26d11fa1d471ec14"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you split the commit into one which purely updates vendor, and one which does the Cortex changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done: #1353

@bwplotka
Copy link
Contributor Author

Clearly lots of stuff changed so need to rebase (: Currently working on streaming remote read, will get back to caching on later date. Thanks for guidance so far!

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.

4 participants