Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDerivative of a constant counter is _close_ to zero, instead of zero #4373
Comments
brian-brazil
added
priority/Pmaybe
component/promql
labels
Jul 12, 2018
This comment has been minimized.
This comment has been minimized.
|
This smells like floating point inaccuracy, which there are limited options for dealing with as it'd likely just pop up in another form. I'm not sure we should special case, do you have a proposed tweak to the order of operations? |
This comment has been minimized.
This comment has been minimized.
|
I understand we don't want to complicate the code for edge cases, one approach could be using the function 'funcChanges' in 'funcDeriv' before calling 'linearRegression'. |
This comment has been minimized.
This comment has been minimized.
|
I'd classify that as special casing. I'm not sure there's much we can sanely do here. |
This comment has been minimized.
This comment has been minimized.
|
your call ;) |
This comment has been minimized.
This comment has been minimized.
|
I don't see anything obvious we can do. Also, that's a counter. You should only use deriv on gauges. You want rate. |
brian-brazil
closed this
Jul 12, 2018
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
maurorappa commentedJul 12, 2018
•
edited
What did you do?

I have a simple constant counter:
I want its derivative, being a constant it should be zero, but it looks like some calculation is done and rounding is appening.

What did you expect to see?
By definition, its derivative should be zero
What did you see instead? Under which circumstances?
a value close to zero, which of course could be rounded to it :)
Being a special case (constant value) is could return zero immediately without calculations (performance saving)
Linux 3.10.0-693.11.6.el7.x86_64 x86_64insert output of
uname -srmhereprometheus, version 2.3.0 (branch: HEAD, revision: 290d717)
build user: root@d539e167976a
build date: 20180607-08:46:54
go version: go1.10.2