qryn
qryn copied to clipboard
Implement /api/v1/series Endpoint for Prometheus Metrics
Objective Using the Loki Endpoint /loki/api/v1/series https://grafana.com/docs/loki/latest/api/#examples-5
We want to also allow for https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers
We should allow for the use of the new Grafana Query Builder to receive a list of label choices one can pick from.
Current Behavior
Returns 404 and Grafana gets stuck in a loop.
The following curl fails:
curl -v -g 'http://localhost:3100/loki/api/v1/series?' --data-urlencode 'match[]={job="dummy-server", method="DELETE"}'
* Trying 127.0.0.1:3100...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3100 (#0)
> POST /loki/api/v1/series? HTTP/1.1
> Host: localhost:3100
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 65
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 65 out of 65 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< vary: Origin
< access-control-allow-origin: *
< content-type: text/plain; charset=utf-8
< content-length: 17
< Date: Wed, 24 Aug 2022 18:11:45 GMT
< Connection: keep-alive
< Keep-Alive: timeout=72
<
* Connection #0 to host localhost left intact
404 Not Supported
Changing Content-Type to JSON makes it work
HTTP/1.1 200 OK
Content-Type: application/json
Access-Control-Allow-Origin: *
Date: Wed, 24 Aug 2022 18:18:14 GMT
Connection: keep-alive
Keep-Alive: timeout=72
Transfer-Encoding: chunked
#200
The PR is merged. The endpoint exists in the latest release. I close this issue.