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

Allow separate aggregation functions over time and between series #5195

Closed
jazdw opened this issue Dec 21, 2015 · 4 comments
Closed

Allow separate aggregation functions over time and between series #5195

jazdw opened this issue Dec 21, 2015 · 4 comments
Labels
1.x area/functions area/influxql Issues related to InfluxQL query language wontfix

Comments

@jazdw
Copy link

jazdw commented Dec 21, 2015

Sometimes you will need to perform different aggregation operations over time and between series. e.g. take the difference between the last and first sample in the time period then find the average between the series.

Some scenarios were this is useful -

  • io_read_bytes and io_write_bytes from Telegraf, find the delta between first and last values in the time period bucket then get the average bytes per time period across your servers
  • power meters often have a kWh accumulator, find the delta between first and last values in the time period bucket then get the average energy used per time period across your meters

I don't believe this is currently possible, as @beckettsean indicated in #1825

@khenderick
Copy link

The possible option non_negative_derivative that I was using will give me the delta between two subsequent counter values (I'm using the counter values of a gas meter), and thus give me the amount of gas used between every datapoint. And while it allows to add an aggregation function to it, non_negative_derivative(sum(<field_key>), [<unit>]) will first sum up all counters (which result in very large values), and then calculate the non-negative derivative over these summed up values. This results however in a different yet incorrect value.

A sum(non_negative_derivative(<field_key>, [<unit>])) would however be correct, but seems to be impossible.

@khenderick
Copy link

It seems SELECT non_negative_derivative(max(<field_key>), <unit>) FROM .... GROUP BY time(<unit>) actually returns the expected value. However, unfortunately, it seems the result of the non_negative_derivative can't be divided by a constant (as my counters are in 0.01 m3)

@rbetts rbetts added the area/influxql Issues related to InfluxQL query language label Aug 13, 2018
@dgnorton dgnorton added the 1.x label Jan 7, 2019
@stale
Copy link

stale bot commented Jul 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 23, 2019
@stale
Copy link

stale bot commented Jul 30, 2019

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

@stale stale bot closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x area/functions area/influxql Issues related to InfluxQL query language wontfix
Projects
None yet
Development

No branches or pull requests

5 participants