Commit Graph

42 Commits

Author SHA1 Message Date
Kien Nguyen 4c24ae8b13 Add buildinfo method
Co-authored-by: Lili Cosic <cosiclili@gmail.com>
Signed-off-by: Kien Nguyen <kiennt2609@gmail.com>
2021-03-12 08:36:23 +07:00
yeya24 75d7516f2a support matchers in labels API
Signed-off-by: yeya24 <yb532204897@gmail.com>
2020-12-29 13:49:42 -05:00
beorn7 64b4a9cf9d API client: Enable fallback on status code 501, too
When discussing #801, I remembered #794. While dealing with the
latter, I read the HTTP RFC, stumbling upon the following:

    When a request method is received
    that is unrecognized or not implemented by an origin server, the
    origin server SHOULD respond with the 501 (Not Implemented) status
    code.  When a request method is received that is known by an origin
    server but not allowed for the target resource, the origin server
    SHOULD respond with the 405 (Method Not Allowed) status code.

Concluding from that, it is possible that a server desiring a fallback
to GET will send a status code of 501. It is even preferred if that
server does not offer any resource to be used with the POST method.

Therefore, I think we should fallback to GET on a 501, too.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-09-10 13:14:07 +02:00
johncming 32a545bf61 Replace with the standard library constant.
Signed-off-by: johncming <johncming@yahoo.com>
2020-08-22 19:36:13 +08:00
Maximilian Gaß b0cdec211b
Use time.Time for timestamps in Runtimeinfo (#777)
Signed-off-by: Maximilian Gaß <m.gass@babiel.com>
2020-06-24 16:55:36 +01:00
Hima Varsha 6cd29bd38a
Add support for tsdb endpoint (#773)
Signed-off-by: Hima Varsha <hdureddy@apple.com>
2020-06-24 12:35:25 +01:00
Augustin Husson 3defbd9c7c add start/end parameter for LabelValues
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2020-06-11 16:05:23 +02:00
Augustin Husson 6ce5f2ca8a add start/end parameter for LabelNames
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2020-06-11 13:02:32 +02:00
Lili Cosic 6c43f2ebc2 api/prometheus/v1/api_test.go: Add test case for runtimeinfo endpoint
Signed-off-by: Lili Cosic <cosiclili@gmail.com>
2020-05-18 20:12:53 +02:00
huanggze 8f87c69651
Improve API error handling
Signed-off-by: huanggze <loganhuang@yunify.com>
2020-04-02 16:02:06 +08:00
gotjosh 2463b8e78d Address review feedback
Signed-off-by: gotjosh <josue@grafana.com>
2020-02-28 09:49:39 +00:00
gotjosh 7810669cc3 Update api/prometheus/v1/api_test.go
Co-Authored-By: Tobias Guggenmos <tguggenm@redhat.com>
Signed-off-by: gotjosh <josue@grafana.com>
2020-02-27 17:52:05 +00:00
gotjosh bd79fe1bf1 Update api/prometheus/v1/api_test.go
Co-Authored-By: Tobias Guggenmos <tguggenm@redhat.com>
Signed-off-by: gotjosh <josue@grafana.com>
2020-02-27 17:52:05 +00:00
gotjosh 7f509dc4f4 API Client: Support new metadata endpoint in v1
Introduces support for the new metadata endpoint from Prometheus. The new endpoint provides information independent of targets and collapses the unique combinations of HELP, TYPE and UNIT.

Fixes #705

Signed-off-by: gotjosh <josue@grafana.com>
2020-02-26 17:48:57 +00:00
Joe Elliott 88792b1169 Moved warnings into apiclient
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-11 10:04:00 -05:00
Joe Elliott bd858421cd Fixed TestDoGetFallback test
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-11 09:36:49 -05:00
Joe Elliott 393adc9261 Refactor ~worked. All tests passing except one
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-10 16:53:38 -05:00
Thomas Jackson 3d8379da8f Add Warnings to LabelValues and LabelNames (#609)
Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-06-17 21:27:57 +03:00
Thomas Jackson 063470a3c9 Add warnings to series (#603)
Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-06-15 00:28:28 +03:00
Thomas Jackson f213ad9bfc Add /labels API to client (#604)
API ref https://prometheus.io/docs/prometheus/latest/querying/api/#getting-label-names

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-06-14 16:49:58 +02:00
Thomas Jackson 1335ef46bd Pass warnings through on non-error responses (#599)
Return warnings as a separate string slice to simplify handling.

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-06-14 01:40:59 +02:00
Krasi Georgiev f6e51267db remove the tsdb dependancy
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-05-28 15:42:25 +03:00
Yao Zengzeng 329278ec53 encapsulate target metadata api (#590)
Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
2019-05-28 14:27:09 +02:00
Alex Salt 301aa8906b /api/v1/rules: alert value as string (#585)
Signed-off-by: Alexander Saltykov <alexander-s@yandex-team.ru>
2019-05-28 13:57:09 +02:00
Thomas Jackson 7e60220fd3 Switch from encoding/json -> jsoniter (#570)
* Switch from encoding/json -> jsoniter

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-05-28 13:45:06 +02:00
Thomas Jackson d5f3c8d55d Add storage.Warnings to client
Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>

Fixes #560
2019-05-21 07:36:05 -07:00
Thomas Jackson a4daf0098c Implement POST with get fallback for Query/QueryRange (#557)
* Implement POST with get fallback for Query/QueryRange

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-04-30 10:13:48 +03:00
Bjoern Rabenstein 1173d73405 Increase minimum required Go version to 1.9
This allows us to simplify a bunch of code while still supporting the
last four Go minor versions.

We have also run into minor annoyances a couple of times by now to
keep supporting 1.7 and 1.8.

It's time to pull the plug!

Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-04-28 23:28:57 +02:00
Oleksandr Kushchenko d5f63107bf Use a map to describe discovered labels, as they are not validated by the server (#529)
Signed-off-by: Oleksandr Kushchenko <okushchenko@palantir.com>
2019-01-23 18:39:45 +03:00
Bob Shannon 18d13eacc9 Add support for fetching rules with API client (#508)
This PR adds support for fetching [rules](https://prometheus.io/docs/prometheus/latest/querying/api/#rules) via the `/api/v1/rules` endpoint using the API client. Currently, the API client exposes no way to do this and it would be nice to have for external systems that wish to retrieve this information.
2019-01-16 00:34:51 +03:00
Marcin Owsiany f30f428035 Add a way to return the body of a 5xx response. (#484)
expose body when handling HTTP errors

Signed-off-by: Marcin Owsiany <marcin@owsiany.pl>
2018-10-25 18:44:21 +01:00
Bryan Boreham 04c0326535 Add non-nil Data because Go 1.7 needs it
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2018-06-04 10:35:16 +00:00
Bryan Boreham 8fbbc9bc6b Decode JSON body when Prometheus returns 400 to an api call
400 and 422 are documented error codes from Prometheus, so we should
attempt to parse the error returned for both of them.

Needed to change a test that was requiring the old behaviour - made it
use 500 instead of 400.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2018-06-04 10:35:16 +00:00
Bob Shannon e3e66d0bb9 PR comments
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-11 07:38:50 -07:00
Bob Shannon fc258df5b5 Fix deep equal comparison for time.Time
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-10 19:33:01 -07:00
Bob Shannon e035b26e30 Bump go version used in build
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-10 18:44:17 -07:00
Bob Shannon 5393573c73 Implement AlertManager, Status, and Target methods
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-10 07:21:46 -07:00
Bob Shannon 10dfec77bf Implement admin methods for Prometheus API
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-09 21:03:46 -07:00
siddontang 3c0e2b3c2e v1: support series API 2017-11-24 20:12:53 +08:00
André Carvalho 6fdb468212
api: add build tag for go 1.7 2017-04-24 18:05:17 -03:00
André Carvalho 11fae2ef0c
api: uses stdlib context 2017-04-20 09:57:46 -03:00
André Carvalho 349922b38c
api: creates versioned package for prometheus v1 api
This commit creates a new package to hold the prometheus
v1 API interface. This interface will contain all the funcionality
exposed by Prometheus v1 HTTP API.

The underlying http client is kept on the api package since it
may be reused across diferent API versions and also by the Alertmanager
api package (to come.)
2017-04-19 18:24:14 -03:00