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

Implement the dual mode for Thanos Receiver #4231

Merged
merged 8 commits into from
May 31, 2021

Conversation

yashrsharma44
Copy link
Contributor

@yashrsharma44 yashrsharma44 commented May 13, 2021

Implementation PR for the Thanos Split Receiver proposal - https://thanos.io/tip/proposals/202012_receive_split.md/

PR is incomplete, pushed for tracking changes and quick review
TODO:

  • Define behaviour when one mode is enabled, and other mode's behaviour is accessed
  • Tests and Docs

Signed-off-by: Yash Sharma [email protected]

cmd/thanos/receive.go Outdated Show resolved Hide resolved
cmd/thanos/receive.go Outdated Show resolved Hide resolved
cmd/thanos/receive.go Outdated Show resolved Hide resolved
cmd/thanos/receive.go Outdated Show resolved Hide resolved
@yashrsharma44 yashrsharma44 force-pushed the receiver-spliter branch 8 times, most recently from 7f5c0a2 to f21f32a Compare May 18, 2021 06:45
@yashrsharma44
Copy link
Contributor Author

Hi @squat !

I have added an e2e test scenario about creating 3 ingestor(hashrings contain only the local endpoint) and 1 distributor. Can you check if the logic for the same is implemented correctly?

I ran the tests, and cross-checked if the behaviour is correct, but would be nice to have your opinion as well 💯

@yashrsharma44 yashrsharma44 marked this pull request as ready for review May 18, 2021 06:54
port := parts[len(parts)-1]
*localEndpoint = net.JoinHostPort(hostname, port)
}
// if *localEndpoint == "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to uncomment this part? However, we might not be able to support the distributor mode, as the localEndpoint would always have a non-nil value.

Copy link
Member

Choose a reason for hiding this comment

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

We should remove this if it's not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, this is a breaking change, so lets make a note for this

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

This is looking however it gives me an unsettling feeling. It's really hard to follow up on changes and modes.

Could we try to encapsulate logic into functions to increase readability?

I know this was an existing issue but this is a chance to improve the control flow.

@yashrsharma44
Copy link
Contributor Author

I know this was an existing issue but this is a chance to improve the control flow.

Can you link the issue?

@yashrsharma44
Copy link
Contributor Author

I know this was an existing issue but this is a chance to improve the control flow.

Can you link the issue?

Tracking issue - #2248

@yashrsharma44 yashrsharma44 force-pushed the receiver-spliter branch 4 times, most recently from f75150b to 15cc6f8 Compare May 20, 2021 13:45
Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

This is on a good path. Thanks a lot @yashrsharma44.

I have added comments inline.

grpcProbe *prober.GRPCProbe,

) error {
g.Add(func() error {
Copy link
Member

Choose a reason for hiding this comment

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

This looks it does the job. I'd prefer keeping the run.Group in the top-level function and extract whatever we pass to g.Add on a different function.

test/e2e/receive_test.go Outdated Show resolved Hide resolved
cmd/thanos/receive.go Show resolved Hide resolved
Signed-off-by: Yash Sharma <[email protected]>

remove flag for ingestion mode, and decide internally

Signed-off-by: Yash Sharma <[email protected]>

moved grpc setup for both ingestion and distribution

Signed-off-by: Yash Sharma <[email protected]>

added an e2e test

Signed-off-by: Yash Sharma <[email protected]>

move dbs and writer outside scope

Signed-off-by: Yash Sharma <[email protected]>

test remove stray at /handler 467

Signed-off-by: Yash Sharma <[email protected]>

fixed a duplicate code in receiver.go

Signed-off-by: Yash Sharma <[email protected]>

removed stray line in handler

Signed-off-by: Yash Sharma <[email protected]>

added a e2e test for ingestion and distributor scenario

Signed-off-by: Yash Sharma <[email protected]>

uncommented other tests

Signed-off-by: Yash Sharma <[email protected]>

restored receiver to main branch implementation

Signed-off-by: Yash Sharma <[email protected]>

break down multiple logical parts of receiver into functions

Signed-off-by: Yash Sharma <[email protected]>
@yashrsharma44 yashrsharma44 force-pushed the receiver-spliter branch 2 times, most recently from b363cc0 to 939748e Compare May 20, 2021 18:33
Signed-off-by: Yash Sharma <[email protected]>
Signed-off-by: Yash Sharma <[email protected]>
cmd/thanos/receive.go Outdated Show resolved Hide resolved
vovanloc0798
vovanloc0798 previously approved these changes May 21, 2021
@yashrsharma44
Copy link
Contributor Author

I might set up this branch and play with the benchmarks using this PR - thanos-io/thanosbench#34

So will report the statistics and benchmarks, once I run them up 😎

cmd/thanos/receive.go Outdated Show resolved Hide resolved
cmd/thanos/receive.go Outdated Show resolved Hide resolved
squat
squat previously approved these changes May 28, 2021
Copy link
Member

@squat squat left a comment

Choose a reason for hiding this comment

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

Overall looks great to me! I think the PR is a lot simpler now without the extra concepts of the different "modes" :))

@yashrsharma44 yashrsharma44 dismissed stale reviews from squat and vovanloc0798 via 5473f5b May 28, 2021 12:08
Co-authored-by: Lucas Servén Marín <[email protected]>

Update cmd/thanos/receive.go

Co-authored-by: Lucas Servén Marín <[email protected]>
Signed-off-by: Yash Sharma <[email protected]>
@yashrsharma44 yashrsharma44 force-pushed the receiver-spliter branch 3 times, most recently from 61b7497 to ab9efaa Compare May 28, 2021 16:50
Signed-off-by: Yash Sharma <[email protected]>
Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

🥇 🚀

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.

5 participants