log.WithSuffix, appends kvs to those passed to Log#992
log.WithSuffix, appends kvs to those passed to Log#992ChrisHines merged 1 commit intogo-kit:masterfrom
Conversation
ChrisHines
left a comment
There was a problem hiding this comment.
Thanks for the well done PR! Check my comments for some things I think we should change.
6746fef to
7aa42ac
Compare
|
@ChrisHines Thanks for your guidance. I agree to the feedback and have made changes accordingly. Please take another look. I've kept commits separate to make it easy for you to review, will squash later. |
|
There isn't a noticeable change to benchmarks after recent changes. |
ChrisHines
left a comment
There was a problem hiding this comment.
The updates look great. Just one minor change to make and then this will be ready to merge.
Sorry it took so long to get back to reviewing this. I promise to be quicker to respond this time.
1bf6f19 to
e3d5e91
Compare
There was a problem hiding this comment.
No worries about the timing. Thank you for the feedback. You'll easily spot the reordering of context fields (only change since last review), hence I've squashed all commits into one.
One minor thing I'd like your opinion on: comments mention With and WithPrefix (example), now that there's a WithSuffix, would you say it is OK keeping these comments as-is, or update them to mention this 3rd func, or something like With* functions instead?
Do let me know if there's anything else you'd like to change.
ChrisHines
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution!
Just saw this question. That's a good catch. We prefer our code comments to be of the highest quality in Go kit, so yes, please update that to add |
ChrisHines
left a comment
There was a problem hiding this comment.
Please add WithSuffix where appropriate to any comments that currently mention With and WithPrefix.
enhancement suggested in: go-kit#991 why? if a human is reading logfmt output on the shell or in the web browser, it helps to have certain fields prefixed, e.g. ts, but certain fields are better suffixed, e.g. caller, environment, so that more important information appears first. benchmarks suggest an additional cost only if WithSuffix is used. goos: darwin goarch: amd64 pkg: github.com/go-kit/kit/log BenchmarkDiscard-4 32230156 38 ns/op 32 B/op 1 allocs/op BenchmarkOneWith-4 9647907 122 ns/op 96 B/op 2 allocs/op BenchmarkTwoWith-4 8935790 134 ns/op 160 B/op 2 allocs/op BenchmarkTenWith-4 5016836 236 ns/op 672 B/op 2 allocs/op BenchmarkOneWithPrefix-4 9907198 123 ns/op 96 B/op 2 allocs/op BenchmarkTenWithPrefix-4 5076309 239 ns/op 672 B/op 2 allocs/op BenchmarkOneWithSuffix-4 6432942 189 ns/op 128 B/op 3 allocs/op BenchmarkTenWithSuffix-4 4899711 246 ns/op 416 B/op 3 allocs/op BenchmarkOneWithPrefixSuffix-4 6111750 197 ns/op 160 B/op 3 allocs/op BenchmarkTenWithPrefixSuffix-4 2172066 555 ns/op 1952 B/op 3 allocs/op PASS ok github.com/go-kit/kit/log 14.224s
e3d5e91 to
0268ca8
Compare
vinayvinay
left a comment
There was a problem hiding this comment.
@ChrisHines I've updated comments to reflect all 3 functions that build context.
ChrisHines
left a comment
There was a problem hiding this comment.
Fantastic work and thanks for your patience through the review process.
|
Thank you for your guidance Chris. It has been a pleasure! |
enhancement suggested in: #991
why?
if a human is reading logfmt output on the shell or in the web browser, it helps to have certain fields prefixed, e.g.
ts, but certain fields are better suffixed, e.g.caller,environment, so that more important information appears first.benchmarks suggest an additional cost only if
WithSuffixis used.