-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logs to OpenAPI spec and client #332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general it looks so far in a good shape. I added a couple of comments to correct wrong links and typos here and there. Besides these my only concern is if re-using the responses (e.g. QueryResponse
or InstantQueryResponse
) is the correct approach here. Maybe we should consider keeping the response objects for logs separately from metrics (cc @saswatamcode WDYT?)
I agree! Let's keep the objects separate for now! 🙂 |
@nyza99 Can you push your commits addressing the review comments above which you see "fixed"? |
Pushed all the changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, besides one small issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yippie!!!
Needs a rebase plus client code regeneration and imho we are set to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff!
|
@saswatamcode Any opinion on how to use the tags correctly to make a visual distinction for paths for logs and metrics. Looking at this feels like we have two labelsv1 paths etc. One needs to look on the right panel to see if they use the metrics or the logs endpoints Should we add a prefix to the tags likes cc @nyza99 |
Ah yes. I was wondering if this would happen. I think adding |
yes, that would be nice to distinct different endpoints. I'll update it! |
What?
This PR adds support for logs API routes to OpenAPI spec for the Observatorium API and generated client.
Why?
The current OpenAPI is missing support for the observatorium/api logs API. This make writing client code (e.g. in obsctl) error-prone and cumbersome. In addition the logs api remains as such undocumented as per OpenAPI spec can be used to generate user-friendly documentation (See observatorium/observatorium#483)
How?
Added support for the following logs API routes in the OpenAPI spec:
Testing?
For testing run
make test-interactive
This command spins up a full setup for Observatorium API with all dependent services. It is intended for short-lived manual testing on your local environment.
Run Curl commands to make API calls against Observatorium API to test manually.
example:
curl --insecure -X POST -v -H “Content-Type: application/json” -H “Accept: application/json” -H 'Authorization: Bearer <API TOKEN> "https://127.0.0.1:<observatorium API port>/api/logs/v1/<tenant>/loki/api/v1/push” -d '{"streams": [{ "stream": { "foo": "bar1" }, "values": [[ "1570818238000000000", "fizzbuzz"]]}]}'
curl --insecure -G -v -H "Content-Type: application/json" -H 'Authorization: Bearer <API TOKEN> ' "https://127.0.0.1:<observatorium API port>/api/logs/v1/<tenant>/loki/api/v1/query" --data-urlencode 'query=count_over_time({_id="test"}[1000m])'
Anything Else?
redocly preview-docs spec.yaml