Support to hide metrics which hasn't update for a long time
Hi @gjasny , could you please take a look at this PR? thanks
Hi @acelyc111 - I was just reading your code in this PR and it looks like exactly what I need. Is this code working well for you. I'm considering just pulling your PR into my fork. Thanks.
Hi @acelyc111 - I was just reading your code in this PR and it looks like exactly what I need. Is this code working well for you. I'm considering just pulling your PR into my fork. Thanks.
@fluffy Yes it works well, feel free to try it.
Hello,
I see some problems with this pull request:
-
Setting
last_update_ts_is not synchronized between the updating thread and the collecting thread. A 32 bit system setting a 64 bit time_t might read funny values. -
std::time is not monotonic and might step backwards.
-
The metric types have been designed for low-overhead when setting/updating. Looking at the clock every time adds a huge overhead. The included benchmark shows some numbers (on my M1 Mac Mini)
Before:
BM_Counter_Increment 10.3 ns 10.3 ns 55964630
After:
BM_Counter_Increment 45.3 ns 45.3 ns 15390579
Maybe a smarter algorithm could shave-off most of the overhead while also providing thread safety.
@jupp0r Do you have any comments?
Thanks, Gregor