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

api: implement succinct output for SearchOptions.String #719

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

keegancsmith
Copy link
Member

I am often reading the output of String in traces and logs, and it is really hard to parse since there are many fields and most are unset. This is a quality of life improvement so it is much easier to scan the output.

For example the default zoekt-webserver struct's string output goes from a 456 byte string to

zoekt.SearchOptions{ ShardMaxMatchCount=100000 TotalMaxMatchCount=1000000 MaxWallTime=10s }

Test Plan: go test. The unit tests ensure I cover every field now and in
the future when fields are added.

I seperated the commit which added the test to the implementation so you can see the improvement of output.

This also allows the next commit to show how the encoding changes in the
test cases.
I am often reading the output of String in traces and logs, and it is
really hard to parse since there are many fields and most are unset.
This is a quality of life improvement so it is much easier to scan the
output.

For example the default zoekt-webserver struct's string output goes from
a 456 byte string to

  zoekt.SearchOptions{ ShardMaxMatchCount=100000 TotalMaxMatchCount=1000000 MaxWallTime=10s }

Test Plan: go test. The unit tests ensure I cover every field now and in
the future when fields are added.
Copy link
Member

@stefanhengl stefanhengl left a comment

Choose a reason for hiding this comment

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

Nice!

@keegancsmith keegancsmith merged commit 7dcc797 into main Jan 17, 2024
8 checks passed
@keegancsmith keegancsmith deleted the k/smaller-stringer-searchoptions branch January 17, 2024 10:18
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