enhance promtool tsdb analyze command#12869
Conversation
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
|
I haven't looked at the code yet, just the example output above. Generally looks very good. Some ideas about the detailed representation: I think it would avoid a lot of guessing by the reader if you specified the exact range for each bucket, maybe in the mathematical notation for open and closed intervals, so instead of Then there should be an absolute number of counts for the bucket, not just the ASCII art, something like Average would also be cool, maybe collapsing the lines like to something like And finally, it would be good to also get "buckets per chunk" for histogram chunks. But these are just display layer details. The general direction is right, I would say. Happy to do a detailed code review once you let me know that the code is ready. |
Thanks! I will modify as you suggest. |
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
|
The pr is ready to be reviewed. @beorn7 @dgl |
dgl
left a comment
There was a problem hiding this comment.
Mostly reviewing from the promtool side, a sanity check for histograms would be good.
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
beorn7
left a comment
There was a problem hiding this comment.
Very very nice.
I only have some comments about the presentation. Note that we have to make a call about min/max/avg vs min/avg/max.
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
|
@beorn7 all comments are resolved, please help review it again |
beorn7
left a comment
There was a problem hiding this comment.
My apologies for the review delay.
Almost perfect, but I think there is a tiny bug in the formatting.
cmd/promtool/tsdb.go
Outdated
| } | ||
| avg := sum / len(datas) | ||
| fmt.Printf("%s (min/avg/max): %d/%d/%d\n", dataType, datas[0], avg, datas[len(datas)-1]) | ||
| maxLen := strconv.Itoa(len(fmt.Sprintf("%d", end))) |
There was a problem hiding this comment.
Does this have to be end + step rather than just end? Not sure, but I see the following if only the last upper bound has a greater length:
bytes per histogram chunk (min/avg/max): 491/818/862
[401, 500]: 2
[501, 600]: 1
[601, 700]: 0
[701, 800]: 222
[801, 900]: 2162 #
[901, 1000]: 0
There was a problem hiding this comment.
yes you are right, besides I also split the maxLen to maxLeftLen and maxRightLen, because if only use the maxLen, the output will be like following in your case, which has an extra whitespace on the left.
bytes per histogram chunk (min/avg/max): 491/818/862
[ 401, 500]: 2
[ 501, 600]: 1
[ 601, 700]: 0
[ 701, 800]: 222
[ 801, 900]: 2162 #
[ 901, 1000]: 0
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Improve promtool tsdb analyze - Make it more suitable for variable size float chunks. - Add support for histogram chunks. --------- Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com> Signed-off-by: Sheikh-Abubaker <sheikhabubaker761@gmail.com>
Improve promtool tsdb analyze - Make it more suitable for variable size float chunks. - Add support for histogram chunks. --------- Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Improve promtool tsdb analyze - Make it more suitable for variable size float chunks. - Add support for histogram chunks. --------- Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com> Signed-off-by: Levi Harrison <git@leviharrison.dev>
Improve promtool tsdb analyze - Make it more suitable for variable size float chunks. - Add support for histogram chunks. --------- Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com> Signed-off-by: Levi Harrison <git@leviharrison.dev>
Improve promtool tsdb analyze - Make it more suitable for variable size float chunks. - Add support for histogram chunks. --------- Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com> Signed-off-by: Levi Harrison <git@leviharrison.dev>
Improve promtool tsdb analyze - Make it more suitable for variable size float chunks. - Add support for histogram chunks. --------- Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com> Signed-off-by: Levi Harrison <git@leviharrison.dev>
related #12146
This is first commit to try to enhance the tsdb analyze for native histgram. Toke the advise from @beorn7
Originally posted by @beorn7 in #12146 (comment)
I first try to
here is the format now