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

Querying raw datapoints #605

Closed
stapelberg opened this Issue Mar 20, 2015 · 11 comments

Comments

Projects
None yet
5 participants
@stapelberg
Copy link

stapelberg commented Mar 20, 2015

I have a boolean value that I’m scraping (i.e. it can be either 0 or 1, nothing else), and I’m having trouble figuring out how to query prometheus so that it will give me the raw data points. In promdash, I always get interpolated points, and even hitting the API end point directly, I get interpolated data points:

curl -s 'http://localhost:9090/api/query_range?end=1426873307&expr=raft_isleader&step=30&range=60'         
{"type":"matrix","value":[
{"metric":{"__name__":"raft_isleader","instance":"alp","job":"robustirc"},"values":[[1426873230,"0"],[1426873260,"0"],[1426873290,"0.17326666666666668"]]},
{"metric":{"__name__":"raft_isleader","instance":"dock0","job":"robustirc"},"values":[[1426873230,"0"],[1426873260,"0"],[1426873290,"0"]]},
{"metric":{"__name__":"raft_isleader","instance":"ridcully","job":"robustirc"},"values":[[1426873230,"0"],[1426873260,"0"],[1426873290,"0"]]}],"version":1}

Note how values contains 0.1732…

How can I get just the raw, scraped data points for debugging/understanding my time series better?

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Mar 20, 2015

@stapelberg We want to have better support for getting raw data out, but there's already a way:

There's a query (vs. query_range) endpoint for instant queries - that is also what the tabular view uses. If you query it for an instant vector, you will get the raw latest value (but with a time of "now" vs. of the actual sample timestamp). But if you query it for a range vector (foo[1h]), you will get the completely raw versions of all data points within that time window, stretching back into the past from now.

For example:

http:/localhost:9090/api/query?expr=up[10m]

That also works (giving completely raw samples) when doing the same in the tabular view of the expression browser.

@stapelberg

This comment has been minimized.

Copy link
Author

stapelberg commented Mar 20, 2015

Thanks for explaining, this is what I’ve been looking for :).

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Aug 20, 2015

Looks like this was answered.

@jf

This comment has been minimized.

Copy link

jf commented Dec 29, 2016

It looks like this isn't possible now? (getting a 404 now, just with http://localhost:9090/api/query?expr=node_disk_bytes_written; Prometheus 1.4.1 here)

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Dec 31, 2016

@rohitChaware

This comment has been minimized.

Copy link

rohitChaware commented Jan 26, 2017

Is this endpoint "GET /api/query?expr=<prometheus_query_expression>" documented? Also, are there any POST endpoints? I didn't find them on https://prometheus.io/docs/querying/api/ .

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jan 26, 2017

@rohitChaware No, that's the old legacy endpoint which doesn't exist anymore in recent Prometheus versions. If with a POST endpoint you mean an endpoint for pushing data, that doesn't exist.

All current API methods are documented at https://prometheus.io/docs/querying/api/

@rohitChaware

This comment has been minimized.

Copy link

rohitChaware commented Jan 26, 2017

Thanks @juliusv for the quick response! Is there any other similar way to pass directly a Prometheus query expression to Prometheus without passing separate query parameters in URL? This "GET /api/query?expr=<prometheus_query_expression>" is really helpful.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jan 26, 2017

@rohitChaware No, they expression query is always sent via a query parameter. What would you have imagined?

@rohitChaware

This comment has been minimized.

Copy link

rohitChaware commented Jan 26, 2017

@juliusv The APIs documented send individual Prometheus expression query parameters(like start, end, step) separately in URL parameters. But in this "GET /api/query?expr=<prometheus_query_expression>", we are sending the complete Prometheus expression as a URL parameter. And I am looking for the latter type of API where we don't have to separate individual parameters and also don't have to access different end points(like /api/v1/query or /api/v1/query_range) based on the type of query. Please correct me if my understanding is not right.

simonpasquier pushed a commit to simonpasquier/prometheus that referenced this issue Oct 12, 2017

Merge pull request prometheus#605 from quolix/patch-1
Adding Quobyte to instrumented software
@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.