Closed MichaelHierweck closed 7 years ago
As far as I know, according to HTTP spec, it has to be path[]
. Full disclaimer: I haven't checked it on Cyanite yet (working on a different branch that's not fully ready just yet).
path[] means
http://127.0.0.1:8080/metrics?path=[com.example.h01.load.load.longterm,com.example.h02.load.load.longterm]&from=1490721538&to=1490807938'
?
If I understand it correctly, it means that:
http://127.0.0.1:8080/metrics?path[]=com.example.h01.load.load.longterm&path[]=com.example.h02.load.load.longterm&from=1490721538&to=1490807938
At least at some point in time ?path=foo&path=bar
worked, because that's what graphite-cyanite does when making queries. path[]
is a PHP thing (at least). The HTTP spec doesn't say anything about the way repeated query string parameters are parsed, it is up to the server to interpret them the way it needs (first wins, last wins, or yield a list).
Oh, I was sure it was a part of 3986 RFC, although I haven't checked. I only know that major web frameworks (like rails) did it this way, maybe they took it from php.
But if graphite-cyanite works this way, and it used to work, it's just a regression.
I'm mostly done with a branch I was working on and hope to be able to work on that one soon (unless someone wanted to tackle it right away).
`http://127.0.0.1:8080/metrics?path[]=com.example.h01.load.load.longterm&path[]=com.example.h02.load.load.longterm&from=1490721538&to=14908079? => Internal Server Error
@brutasse: Yes... I tried to track down why graphite-web won't render multipe metrics into a single chart anymore and found out that Cyanite - in the current master version - only returns a single data series.
Either cyanite or graphite-cyanite should be fixed. I might fix graphite-cyanite if someone can tell me which parameter format Cyanite expects. (Please add examples to the API docs.)
I'm pretty sure it's on cyanite side. I just didn't know about this feature and it did't have any tests. I'll make sure to fix it and add a test if possible..
@ifesdjeen thank you, that would be great :)
If I recall, you need to use ring.middleware.params/wrap-params to get the ability to have either single value for a params or a vector of values decoded from the query-string into :params. It's a bit of a hairy thing tho: foo=bar
will return {:foo "bar"}
but foo=bar&foo=baz
will return {:foo ["bar" baz"]}
. Maybe cyanite used to use this middleware in the past?
Thank you. I can confirm it works, when building cyanite against this PR.
Thank you @MichaelHierweck!
While the API docs (https://github.com/pyr/cyanite/blob/master/doc/source/api.rst#metrics) claim that the metrics API supports multiple path arguments only a single result is returned:
Multiple path arguments are used by graphite-api/cyanite when rendering multiple metrics into one chart.