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

Add headers for WebSocket #1689

Merged
merged 3 commits into from
Feb 17, 2020

Conversation

shokada
Copy link
Contributor

@shokada shokada commented Feb 13, 2020

When Loki Canary connects to a gateway, the following error occurred.

failed to connect to ws://xxxx/api/prom/tail?query=%7Bstream%3D%22stdout%22%2Cname%3D%22loki-canary%22%7D with err websocket: bad handshake

Loki Canary opens a WebSocket connection to Loki, so the gateway needs to send a request including the Upgrade and Connection headers.
http://nginx.org/en/docs/http/websocket.html

And, since /loki/api/v1/tail and /api/prom/tail are handled in Querier module instead of QueryFrontend module, the gateway needs to send a request to Querier.

@codecov-io
Copy link

codecov-io commented Feb 13, 2020

Codecov Report

Merging #1689 into master will decrease coverage by 0.1%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1689      +/-   ##
==========================================
- Coverage   62.09%   61.98%   -0.11%     
==========================================
  Files         111      111              
  Lines        8391     8391              
==========================================
- Hits         5210     5201       -9     
- Misses       2788     2793       +5     
- Partials      393      397       +4
Impacted Files Coverage Δ
pkg/promtail/targets/tailer.go 73.56% <0%> (-2.3%) ⬇️
pkg/promtail/targets/filetarget.go 68.71% <0%> (-1.85%) ⬇️
pkg/ingester/transfer.go 65% <0%> (-1.43%) ⬇️
pkg/logql/evaluator.go 91.83% <0%> (-1.03%) ⬇️

@cyriltovena
Copy link
Contributor

@shokada Thanks for the contribution, we don't use this gateway ourselves, we have our own. Have you tested this in your cluster ?

@shokada
Copy link
Contributor Author

shokada commented Feb 13, 2020

@cyriltovena Yes, I tested this in my cluster. It seems to work.

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

After our discussion, LGTM pending removal of the OrgID headers.

Copy link
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

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

I think this looks good! I will take a final look in the next day or so but we should be able to get this merged, thanks @shokada

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 42fc522 into grafana:master Feb 17, 2020
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.

None yet

5 participants