Skip to content
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

non_negative_difference #7393

Closed
phemmer opened this issue Oct 2, 2016 · 13 comments
Closed

non_negative_difference #7393

phemmer opened this issue Oct 2, 2016 · 13 comments
Labels
area/influxql Issues related to InfluxQL query language kind/feature-request

Comments

@phemmer
Copy link
Contributor

phemmer commented Oct 2, 2016

Feature Request

Proposal: [Description of the feature]

Add a non_negative_difference function, similar to non_negative_derivative.

Current behavior: [What currently happens]

No such function.

Desired behavior: [What you would like to happen]

Such a function.

Use case: [Why is this important (helps with prioritizing requests)]

For a counter which overflows and is frequently reset, using difference results in frequent negative values.

Note, this is NOT the same as the feature requested in #7076.

@desa
Copy link
Contributor

desa commented Oct 4, 2016

@phemmer should it report the absolute value, or 0 if the value is negative?

@desa desa added kind/feature-request area/influxql Issues related to InfluxQL query language labels Oct 4, 2016
@phemmer
Copy link
Contributor Author

phemmer commented Oct 4, 2016

Nither, it should drop the value entirely, just like non_negative_derivative does.

@desa
Copy link
Contributor

desa commented Oct 4, 2016

Ah, makes sense.

@zhexuany
Copy link
Contributor

zhexuany commented Oct 14, 2016

@jwilder If no one takes this, I would like to devote my time on this feature. What is your opinion? Is this gonna be ok to adding in influxDB?

@jwilder
Copy link
Contributor

jwilder commented Oct 14, 2016

@zhexuany Sounds good. Thanks!

@rafaelncarvalho
Copy link

It's not better to make an absolute function? This way we could write ABS(DIFFERENCE( )) on query and it could replace the non_negative_derivative too

@phemmer
Copy link
Contributor Author

phemmer commented Jan 26, 2017

@rafaelncarvalho that's not the same. However something like max(difference(foo),0) probably would be.

@zhexuany
Copy link
Contributor

zhexuany commented Jan 26, 2017

I am so sorry for the delay. I planed to used my Spring Festival break to complete this.

@phemmer Plz give me some examples to precisely describe this function. My understanding is that

Say we have 5, -4, 4, 4, -1, 3, non-negative-difference will return -6. This is correct, if so I start to work on this right away.

@michalrus
Copy link

michalrus commented Jan 28, 2017

Note, this is NOT the same as the feature requested in #7076.

But it covers the same use case! Please, do it. 🐱

@zhexuany, you might want to take a look at the mentioned #7076 and #7093 for some more context on the use case.

As resetting counters are so common in systems monitoring, I have no idea how InfluxDB could’ve gone so far without this functionality. Compare → https://prometheus.io/docs/querying/functions/#increase

@phemmer
Copy link
Contributor Author

phemmer commented Jan 28, 2017

But it covers the same use case! Please, do it. 🐱

Actually no it doesn't. Read the comments on #7076, this is a completely different feature.

@michalrus
Copy link

Ah, right, I wanted totals there. But you can get speed from totals (and I do this with my patch). Will I be able to get totals from your speed in #7393?

@zhexuany
Copy link
Contributor

PR is ready. Please check: #8235.

@e-dard
Copy link
Contributor

e-dard commented Apr 21, 2017

Fixed via #8235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/influxql Issues related to InfluxQL query language kind/feature-request
Projects
None yet
Development

No branches or pull requests

7 participants