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

sum_over_time on range queries. #2394

Closed
kiranalii opened this Issue Feb 4, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@kiranalii
Copy link

kiranalii commented Feb 4, 2017

Hi,

I want to use sum_over_time on range queries. But it's not working.

I tried these queries

http://localhost:9093/api/v1/query_range?query=sum_over_time(go_gc_duration_seconds&start=2017-02-01T19:03:40.0Z&end=2017-02-02T09:03:04.0Z&step=15s)

Error Message:

{ "status": "error", "errorType": "bad_data", "error": "cannot parse \"15s)\" to a valid duration" }

http://localhost:9093/api/v1/query_range?query=sum_over_time(go_gc_duration_seconds)&start=2017-02-01T19:03:40.0Z&end=2017-02-02T09:03:04.0Z&step=15s

{ "status": "error", "errorType": "bad_data", "error": "parse error at char 39: expected type range vector in call to function \"sum_over_time\", got instant vector" }

Help would be appreciated
Thanks

@kiranalii kiranalii changed the title Hi, I want to use sum_over_time on range queries. But i don't what should be exact format for the query I want to use sum_over_time on range queries. Feb 4, 2017

@kiranalii kiranalii changed the title I want to use sum_over_time on range queries. sum_over_time on range queries. Feb 4, 2017

@kiranalii

This comment has been minimized.

Copy link
Author

kiranalii commented Feb 5, 2017

This query is working

http://localhost:9093/api/v1/query_range?query=sum_over_time(go_gc_duration_seconds[1s])&start=2017-02-01T19:03:40.0Z&end=2017-02-02T09:03:04.0Z&step=15s

But i don't know what is difference between [1s] and step size.
Help would be appreciated. Thanks

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Feb 6, 2017

Disclaimer: I don't think your query makes any sense semantically.

Purely syntactically: sum_over_time(...[1s]) sums up all sample values between "now" and "now - 1s", where "now" is the evaluation time of the query. (Note that a typical scrape interval is ~1m, so most likely, there will be no sample in the 1s interval you are summing over.)

The step parameter in the API query tells Prometheus for which times the PromQL query should be evaluated, or in other words, what value "now" should have.

@kiranalii

This comment has been minimized.

Copy link
Author

kiranalii commented Feb 7, 2017

Thanks @beorn7, thakns for explaining [1s] and step size difference. Got it thanks

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 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 24, 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.