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

Default to now if time paramater not specified in HTTP API #1207

Closed
qed- opened this Issue Nov 10, 2015 · 10 comments

Comments

Projects
None yet
5 participants
@qed-
Copy link

qed- commented Nov 10, 2015

As discussed here: https://groups.google.com/forum/#!topic/prometheus-developers/JrU8l0-IKt8 it would be convenient if the GET /api/v1/query endpoint defaulted to 'now' if the time paramater is not specified.

Use case is to allow a client to get the current state of metrics without worrying about clock sync, staleness handling.

@grobie

This comment has been minimized.

Copy link
Member

grobie commented Nov 10, 2015

If people are worried about this being used incorrectly by accident, we could also use something like last as special value.

👍 in general

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Nov 10, 2015

I think making it optional would make sense.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 11, 2015

Or now? last would not describe the semantics quite correctly, as we do not go back to the last visible samples for the query.

Making it optional is very implicit. If I say ?...&timestamp=now, at least there's little doubt what's happening internally.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Nov 11, 2015

I'd expect that most users are doing quick lookups the same as in the expression browser and would like things to just work. In that context I'm not seeing much benefit to having them specify an additional magic parameter.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 11, 2015

Inserting it without any indicator is more magic. It's almost zero effort to do.
A query is only complete with a timestamp or range.

@grobie

This comment has been minimized.

Copy link
Member

grobie commented Nov 11, 2015

I don't consider default parameters to be magic. It's a common approach in both HTTP parameters as well as programming functions. The used timestamp will be visible in the result and how to set a timestamp explicitly can be seen in the documentation.

@jimmidyson

This comment has been minimized.

Copy link
Member

jimmidyson commented Nov 11, 2015

👍 implicit default to now

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 11, 2015

So be it then :)

On Wed, Nov 11, 2015 at 7:29 PM Jimmi Dyson notifications@github.com
wrote:

[image: 👍] implicit default to now


Reply to this email directly or view it on GitHub
#1207 (comment)
.

@qed-

This comment has been minimized.

Copy link
Author

qed- commented Nov 12, 2015

Thanks all.

@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.