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

Extract samplingSender and use it for gRPC #637

Merged
merged 3 commits into from
Aug 11, 2023
Merged

Conversation

camdencheek
Copy link
Member

@camdencheek camdencheek commented Aug 11, 2023

There was a mismatch in performance between HTTP and gRPC, and it came down to this sampling logic. This PR extracts that sampling logic into a Sender and reuses it for the gRPC endpoint.

There are existing tests that cover the behavior of the streaming endpoint for stats-only events. I added a unit test to ensure the sampler works as I expected (though it's a little fragile to logic changes). I manually tested that the gRPC endpoint yields the same number of events as the HTTP endpoint.

@@ -184,3 +149,61 @@ func registerGob() {
})
rpc.RegisterGob()
}

func NewSamplingSender(next zoekt.Sender) *samplingSender {
Copy link
Member

Choose a reason for hiding this comment

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

minor: the docstring on the exported function is more useful here than on samplingSender struct.

Copy link
Member Author

@camdencheek camdencheek Aug 11, 2023

Choose a reason for hiding this comment

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

done, thanks!

@camdencheek camdencheek merged commit 956d775 into main Aug 11, 2023
6 checks passed
@camdencheek camdencheek deleted the cc/sampling-sender branch August 11, 2023 18:13
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.

2 participants