Closed saswatamcode closed 2 years ago
Nice work :muscle: Looking at the OpenAPI spec, it looks like we're defining the interfaces for all of the Prometheus responses, I'm just wondering if these are defined anywhere else and we can 'just' import them? (I'm not at all familiar with OpenAPI so could be asking a very silly question :sweat_smile: ). No problem if not - just wanted to ask the question!
This is a really good question! We can import schemas using $ref syntax. But currently, there doesn't seem to be any spec for Thanos or Prometheus yet. There are a couple of PRs that I found (https://github.com/thanos-io/thanos/pull/4393, https://github.com/prometheus/prometheus/pull/9197) but nothing in-tree yet, afaik.
But once these are merged, maybe we can utilize them! 🙂
Righto! Makes sense - thanks for checking :raised_hands:
It might well be the case, but I am wondering if this repo is the correct place for the OpenAPI spec to live? 🤔
Yeah, I was wondering about this too! I think it's being used here so makes sense for now, but this should ideally be in observatorium/api
and we should just import that here. Maybe once this gets fully reviewed, it can be changed! 🙂
@saswatamcode - yes that was what I was thinking initially. It seems like the natural fit.
Discussed this with @onprem too, so will be moving the spec to the API repo and importing here! 🙂
This PR adds an OpenAPI spec for the Observatorium API (only metrics routes for now) as well as a client which is generated using deepmap/oapi-codegen and go-chi.
The client is used to send requests (both GET and PUT) to the Observatorium API. Also adds support for URL parameters in requests, by adding flags for
obsctl metrics get
operations. Fixes #8. Adds functionality toquery
command as well, which allows for executing both instant and range queries.