Stackdriver / stackdriver-prometheus

Prometheus support for Stackdriver
https://cloud.google.com/monitoring/kubernetes-engine/prometheus
Apache License 2.0
19 stars 12 forks source link

Method not allow #7

Closed axot closed 6 years ago

axot commented 6 years ago

What did you do?

$ curl -i http://10.22.0.26:9090/api/v1/query
HTTP/1.1 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Fri, 29 Jun 2018 02:21:28 GMT
Content-Length: 19

Method Not Allowed

What did you expect to see?

$ curl -i http://10.22.0.26:9090/api/v1/query
HTTP/1.1 400 Bad Request
Access-Control-Allow-Headers: Accept, Authorization, Content-Type, Origin
Access-Control-Allow-Methods: GET, OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Date
Content-Type: application/json
Date: Thu, 28 Jun 2018 14:29:49 GMT
Content-Length: 103

{"status":"error","errorType":"bad_data","error":"parse error at char 1: no expression found in input"}

What did you see instead? Under which circumstances? Method Not Allowed

Environment GKE

{"version":"0.4.2","revision":"9f5c836bfc3abea91b7473f4a57c107806099bf9","branch":"release-0.4.2","buildUser":"bmoyles@bmoyles-macbookpro.roam.corp.google.com","buildDate":"20180426-20:01:01","goVersion":"go1.9"}



RESTful API does not work?
axot commented 6 years ago

@bmoyles0117 Hi, any advice for this?

mtanda commented 6 years ago

I think, this forked Prometheus doesn't support query function. Because, it doesn't have storage.

https://github.com/Stackdriver/stackdriver-prometheus/blob/release-0.4.1/web/api/v1/api.go#L118-L141

axot commented 6 years ago

@mtanda Yes, it seems whole query APIs were deleted, but why?

mtanda commented 6 years ago

Because this is just a forwarder from Prometheus exporters to Stackdriver.

https://github.com/Stackdriver/stackdriver-prometheus/blob/release-0.4.1/web/web.go#L571

"'query' is unsupported"

Original Prometheus has storage (tsdb), and it can handle query. But, this Prometheus doesn't have storage, just forward scraped metrics to Stackdriver.

May be you want to use PromQL for querying collected metrics. But it is impossible, you should use Stackdriver query API.

Or, you add Original Prometheus to support Stackdriver remote write.

jkohen commented 6 years ago

Thanks for the feedback. @mtanda is right, the Prometheus to Stackdriver integration doesn't support PromQL, and it doesn't have a local TSDB, so all the related endpoints were removed.

We are working on a new integration that works as a sidecar of an unmodified Prometheus Server, so that you will be able to both send data to Stackdriver and access the local Prometheus Server features. The design explains the work and why we couldn't offer that as our first option.

I'm going to close this as working as intended.