mosn / holmes

self-aware Golang profile dumper
Apache License 2.0
1.08k stars 135 forks source link

bug: should log the previous data in human readable order #125

Closed doujiang24 closed 1 year ago

doujiang24 commented 2 years ago

Now, the previous data is weird, not in human-readable order. 79 and 70 should be the last value.

2022-09-26 17:00:02,934 [ERROR] [holmes.cpu] [Holmes] pprof dump cpu, config_min : 30, config_diff : 25, config_abs : 100, config_max : 0, previous : [13 13 13 13 79 13 13 14 14 13], current: 79
2022-09-26 17:11:02,938 [ERROR] [holmes.cpu] [Holmes] pprof dump cpu, config_min : 30, config_diff : 25, config_abs : 100, config_max : 0, previous : [16 12 13 12 13 13 70 13 13 13], current: 70

This is due to, we print the data from a ringbuffer directly, we should print them in nature order: https://github.com/mosn/holmes/blob/master/ring.go#L21

Maybe we can introduce a data method for ring, which returns the data in the natural order, so that we can use data() instead of ring.data.