-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Added support for tail to query frontend #2032
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2032 +/- ##
==========================================
- Coverage 64.46% 64.43% -0.04%
==========================================
Files 131 131
Lines 10038 10046 +8
==========================================
+ Hits 6471 6473 +2
- Misses 3084 3091 +7
+ Partials 483 482 -1
|
We skip the frontend on our side for tail request, but I'm not against this, although this means support will be limited. WDYT @slim-bean ? If we're good I'll review this ! |
Hi @cyriltovena thanks for your reply. I think it is good to have direct support for this in the query frontend. It simplifies the setup when you are not using a proxy. I get that you can route the traffic based on path directly to the querier or to query frontend. Yes the support is limited, but the features we are losing are related to auth. And when you are using auth you already have to use some auth proxy, therefore, it is not an issue anymore. Am I correct? But it definitely should be described in the docs somehow. |
@cyriltovena did you have time to look at it? |
I'm waiting for feedback from someone else, I'm not against it at all ! |
I'll bring this up in the next meeting see if what the team thinks about it. |
Good intent here! Thank you for contributing this. It goes a step closer to have simpler Loki deployments. E.g. on kubernetes, where you need to maintain three distinct services one for writes to the distributor, one for reads to the frontend and one for tails to the queriers. However, I ack to maintainers' comments, that a simple reverse proxy would fix the need to have the tail endpoint on the proxy. Thanks again for bringing this up and all the effort! |
We don’t see any issues with this if you replace your implementation with this https://golang.org/pkg/net/http/httputil/#ReverseProxy since go1.12 it supports websockets. 🙏 |
Agree with @cyriltovena. I think we'll be able to get this merged. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Not stale. I will prepare it with the use of the |
…on, added tailproxy config
Codecov Report
@@ Coverage Diff @@
## master #2032 +/- ##
==========================================
- Coverage 61.67% 61.60% -0.08%
==========================================
Files 160 160
Lines 13569 13582 +13
==========================================
- Hits 8369 8367 -2
- Misses 4577 4592 +15
Partials 623 623
|
Thanks for making these changes, will take a look today or tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pkg/loki/modules.go
Outdated
@@ -308,7 +320,7 @@ func (t *Loki) initQueryFrontend() (_ services.Service, err error) { | |||
t.server.HTTP.Handle("/api/prom/label/{name}/values", frontendHandler) | |||
t.server.HTTP.Handle("/api/prom/series", frontendHandler) | |||
// fallback route | |||
t.server.HTTP.PathPrefix("/").Handler(frontendHandler) | |||
t.server.HTTP.PathPrefix("/").Handler(tailProxy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value for tailproxy.downstream-url
is empty string and not everyone would want to set it but here we use it anyways. I think we should use it only when a value is set for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh great point I will fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great point thanks, I will fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about this solution ef61f93?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! A little nitpick here, then LGTM.
pkg/loki/loki.go
Outdated
@@ -55,6 +56,7 @@ type Config struct { | |||
TableManager chunk.TableManagerConfig `yaml:"table_manager,omitempty"` | |||
Worker frontend.WorkerConfig `yaml:"frontend_worker,omitempty"` | |||
Frontend frontend.Config `yaml:"frontend,omitempty"` | |||
TailProxy tailproxy.Config `yaml:"tail_proxy,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to what @sandeepsukhani mentioned, I think this should be part of the frontend config rather than it's own top level value because it's only used in the frontend.
We may need to extend our frontend config definition to be something like
type Config struct {
frontend.Config `yaml:",inline"`
tail_proxy_url string `yaml:"tail_proxy_url"`
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good idea. I did it like this because I knew it does not belong to Cortex.
This is better I will prepare it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit: i love the podracer gif :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owen-d what do think about it now? I used embedded struct as you proposed and IMHO it is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
* don't exec create keyspace if it exists Signed-off-by: Wing924 <weihe924stephen@gmail.com> * fix Signed-off-by: Wing924 <weihe924stephen@gmail.com> * fix Signed-off-by: Wing924 <weihe924stephen@gmail.com>
What this PR does / why we need it:
Which issue(s) this PR fixes:
First I wanted to create issue for this. Then I checked in the code and saw that it is not implemented and decided to try to implement it.
Special notes for your reviewer:
WsTailProxy
in the correct place?Checklist