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

[HWKMETRICS-465] New POST endpoints gauges/stats/query and counters/stats/query #584

Merged
merged 1 commit into from Sep 29, 2016

Conversation

jotak
Copy link
Contributor

@jotak jotak commented Aug 24, 2016

It's a kind of duplication of the GET endpoints "gauges/stats" and "counters/stats".
The reason is the same as the one explained here: https://issues.jboss.org/browse/HWKMETRICS-410 and which ended up in duplicating GET "gauges/raw" endpoint to POST "gauges/raw/query" in a similar way.

Also added integration tests

@rhqci
Copy link

rhqci commented Aug 24, 2016

Can one of the admins verify this patch?

@jsanda
Copy link
Contributor

jsanda commented Aug 24, 2016

Do we really need this? Couldn't we just use the POST /hawkular/metrics/metrics/stats/query endpoint which allows you to query for stats from gauges, counters, and rates in one request?

@jotak
Copy link
Contributor Author

jotak commented Aug 24, 2016

metrics/stats/query works differently and does not perform series aggregation. You provide a list of metric ids and it returns, for each metric, the statistics.

Here this is really a kind of alias of gauges/stats : all time series are aggregated together. There's also this "stacked" parameter which is useful for such case, and doesn't exist in metrics/stats/query (not only it's doesn't exist, but it wouldn't make sense: why would we stack a gauge over a counter?). I think they are really for different purpose.

@jotak
Copy link
Contributor Author

jotak commented Aug 24, 2016

For instance try to query 2 metrics on /metrics/stats/query , then the same metrics on /gauges/stats: you get different results

@jotak
Copy link
Contributor Author

jotak commented Aug 24, 2016

Maybe they should be renamed for disambiguation? Like "/metrics/stats/query" vs "/gauges/aggregated-stats" ?

@jsanda
Copy link
Contributor

jsanda commented Aug 24, 2016

Right, /metrics/stats/query basically batches multiple results to save on HTTP requests. Is the main motivation for the endpoints to work around the Grafana issue? Just want to make sure I understand since as you said there is some duplication here.

@jotak
Copy link
Contributor Author

jotak commented Aug 24, 2016

Yes, this is for grafana. I've also heard that @mwringe had similar issues with other endpoints, so maybe that can be useful for other clients of the api

@jotak jotak force-pushed the stats-post-endpoints branch 3 times, most recently from 53d85ee to fb1e344 Compare September 7, 2016 09:33
@jotak
Copy link
Contributor Author

jotak commented Sep 7, 2016

Can we get a status on that? Is this endpoints acceptable or not, given there was a precedent with gauges/raw/query and counters/raw/query .

If not acceptable what do you suggest to make it work with Grafana? We could also provide a specific location for grafana related workaround, like /grafana/gauges/raw/query , /grafana/gauges/stats/query etc. But I must say I'm not very keen on that since those endpoints may be useful for others than grafana.

@jotak
Copy link
Contributor Author

jotak commented Sep 8, 2016

Can someone label this PR "DO NOT MERGE"?
I would like to start a more global discussion on the REST API before merging. I'll wait for @jsanda and @pilhuhn being back to work, but basically, I want to point out some inconsistencies on the REST API and discuss about how to fix it.

@pilhuhn
Copy link
Member

pilhuhn commented Sep 13, 2016

@jotak I think the best way to discuss it is an email to hawkular-dev ML.
Also please keep in mind that there are clients out there that expect some endpoints to exist. We can't just "move them around".
Rest allows though to alias via a 302 redirect or similar to keep an old endpoint url around.

@jotak
Copy link
Contributor Author

jotak commented Sep 23, 2016

So following the previous discussions on ML, I think it's now ok to review code & merge

@jotak
Copy link
Contributor Author

jotak commented Sep 23, 2016

Build failure => "Trigger time has already passed" :(

@stefannegrea
Copy link
Contributor

ok to test

…tats/query

This is part of several commits to harmonize the REST API when querying on multiple metrics.
With those new endpoints it is now possible to query on x/stats/query, in a similar way than it was already possible on x/raw/query and x/rate/query.

Also added integration tests, fix missing 'tags' in hashcode
@jotak jotak changed the title New POST endpoints gauges/stats/query and counters/stats/query [HWKMETRICS-465] New POST endpoints gauges/stats/query and counters/stats/query Sep 28, 2016
@stefannegrea
Copy link
Contributor

@jotak, there is one parameter missing from the request object: fromEarliest. Do you want to implement it in this PR? Or merge as-is and open another JIRA?

@jotak
Copy link
Contributor Author

jotak commented Sep 29, 2016

@stefannegrea , I'll update the PR. It also means adding fromEarliest to the "get" stats endpoints for multiple queries, it wasn't there, too.

@stefannegrea
Copy link
Contributor

@jotak, let's finalize this PR as-is and then do the additional work for fromEarliest in the context of HWKMETRICS-445.

@stefannegrea
Copy link
Contributor

Thank you @jotak!

@stefannegrea stefannegrea merged commit 15b1f62 into hawkular:master Sep 29, 2016
@jotak jotak deleted the stats-post-endpoints branch July 28, 2017 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants