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

Implement an integral() function #1335

Closed
gtopper opened this Issue Jan 22, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@gtopper
Copy link

gtopper commented Jan 22, 2016

Similar to Graphite's integral(), and InfluxDB's planned INTEGRAL().

This would be useful as a workaround for #1334, and would have the added benefit of always starting at 0, as opposed to the arbitrary value the counter happens to have reached at the beginning of the displayed time frame.

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Jan 22, 2016

This function already exists: sum_over_time or (depending on your exact use case) average_over_time http://prometheus.io/docs/querying/functions/#aggregation-_over_time

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Jan 22, 2016

Doesn't account for counter resets, though.

@gtopper

This comment has been minimized.

Copy link
Author

gtopper commented Jan 22, 2016

As partly mentioned in #1334, integral() differs from sum_over_time() in that integral() results in a graph where all time series start at zero, whereas the starting value of sum_over_time() is arbitrary (whatever counters happened to be set to at that time). Is there a workaround for that?

I guess there's a significant difference in approach between Prometheus and Graphite: Prometheus doesn't seem to have any functionality that recognizes the concept of an "observed timeframe" - everything is time windowed, probably to suit the alerting functionality, where only time windows have meaning. However, when graphing, the timeframe observed can be very meaningly, e.g. if you're trying to see the increase of things over that timeframe.

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Jan 22, 2016

I think the fundamental problem is the same as in #1334 . Let's dup this one and have the discussion only in that other issue.

@beorn7 beorn7 closed this Jan 22, 2016

@beorn7 beorn7 added the duplicate label Jan 22, 2016

@cberner

This comment has been minimized.

Copy link

cberner commented Jul 27, 2018

@beorn7, sum_over_time is quite different because it treats all data points as equally spaced. There's no way to recover the area under curve, like a proper integral function would return

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Jul 30, 2018

Yes, I think you are right. A different question is if such an integral function should be in PromQL.

For such discussions, the prometheus-developers mailing list is much better suited than a GitHub issue. Ideally, you would present a few good use cases there and create a consensus that the feature is useful. Then, we can file a feature request issue here.

@lock

This comment has been minimized.

Copy link

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.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.