-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Store: Make queryStats log with human-readable format. #4885
Conversation
057cb50
to
7bc0ac9
Compare
A bit more idea,Could i add a flag to only log duration logger than specific value? like thanos-query does. |
The second commit change the xxsizeSum field type to units.Base2bytes, which log human-readable format. level=debug msg="stats query processed" request="max_time:99 matchers:<name:"foo" value:"bar" > matchers:<name:"b" value:"1" > matchers:<type:NEQ name:"i" > " stats="&{blocksQueried:1 postingsTouched:102 PostingsTouchedSizeSum:1KiB98B postingsToFetch:0 postingsFetched:1 PostingsFetchedSizeSum:404B postingsFetchCount:1 PostingsFetchDurationSum:81.635µs cachedPostingsCompressions:1 cachedPostingsCompressionErrors:0 CachedPostingsOriginalSizeSum:404B CachedPostingsCompressedSizeSum:18B CachedPostingsCompressionTimeSum:15.529µs cachedPostingsDecompressions:101 cachedPostingsDecompressionErrors:0 CachedPostingsDecompressionTimeSum:20.957µs seriesTouched:100 SeriesTouchedSizeSum:1KiB205B seriesFetched:54 SeriesFetchedSizeSum:65KiB560B seriesFetchCount:1 SeriesFetchDurationSum:115.953µs chunksTouched:100 ChunksTouchedSizeSum:1KiB212B chunksFetched:100 ChunksFetchedSizeSum:17KiB409B chunksFetchCount:1 ChunksFetchDurationSum:64.246µs GetAllDuration:823.856µs mergedSeriesCount:100 mergedChunksCount:100 MergeDuration:51.937µs}" err=null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit - could you please see if it makes sense? This is a nice improvement. Please also rebase 💪
Thank you. Let me rebase it. |
…le format. Signed-off-by: Jimmie Han <hanjinming@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 🤘
d863d2f
to
2b1a818
Compare
…n-readable format. Signed-off-by: Jimmie Han <hanjinming@outlook.com>
2b1a818
to
4973be8
Compare
Rebase Done~ @GiedriusS |
The queryStats log is very useful to debug query in thanos-store.
But currently the duration field is unexported so that
fmt.Printf("%+v", stats)
print a number for time.Duration.Before:
level=debug msg="stats query processed" stats="&{blocksQueried:1 postingsTouched:102 postingsTouchedSizeSum:1122 postingsToFetch:0 postingsFetched:1 postingsFetchedSizeSum:404 postingsFetchCount:1 postingsFetchDurationSum:162905 cachedPostingsCompressions:1 cachedPostingsCompressionErrors:0 cachedPostingsOriginalSizeSum:404 cachedPostingsCompressedSizeSum:18 cachedPostingsCompressionTimeSum:29569 cachedPostingsDecompressions:101 cachedPostingsDecompressionErrors:0 cachedPostingsDecompressionTimeSum:65901 seriesTouched:100 seriesTouchedSizeSum:1229 seriesFetched:54 seriesFetchedSizeSum:67120 seriesFetchCount:1 seriesFetchDurationSum:247635 chunksTouched:100 chunksTouchedSizeSum:1236 chunksFetched:100 chunksFetchedSizeSum:17817 chunksFetchCount:1 chunksFetchDurationSum:135030 getAllDuration:1744138 mergedSeriesCount:100 mergedChunksCount:100 mergeDuration:106200}" err=null
After:
level=debug msg="stats query processed" request="max_time:99 matchers: matchers: matchers: " stats="&{blocksQueried:2 postingsTouched:203 postingsTouchedSizeSum:2812 postingsToFetch:0 postingsFetched:203 postingsFetchedSizeSum:4478 postingsFetchCount:2 PostingsFetchDurationSum:576.127µs cachedPostingsCompressions:203 cachedPostingsCompressionErrors:0 cachedPostingsOriginalSizeSum:2812 cachedPostingsCompressedSizeSum:1454 CachedPostingsCompressionTimeSum:358.132µs cachedPostingsDecompressions:0 cachedPostingsDecompressionErrors:0 CachedPostingsDecompressionTimeSum:0s seriesTouched:100 seriesTouchedSizeSum:1229 seriesFetched:100 seriesFetchedSizeSum:68592 seriesFetchCount:1 SeriesFetchDurationSum:353.677µs chunksTouched:100 chunksTouchedSizeSum:1236 chunksFetched:100 chunksFetchedSizeSum:17817 chunksFetchCount:1 ChunksFetchDurationSum:221.653µs GetAllDuration:4.764037ms mergedSeriesCount:100 mergedChunksCount:100 MergeDuration:127.72µs}" err=null
Signed-off-by: Jimmie Han hanjinming@outlook.com
Changes
Verification
Unit test