observatorium / obsctl

A cli to interact with Observatorium instances.
Apache License 2.0
10 stars 14 forks source link

Add support for logs api #40

Closed nyza99 closed 2 years ago

nyza99 commented 2 years ago

What? This PR adds support for logging operations

Why? Currently obsctl supports only interacting with the /api/metrics/v1 API of the observatorium-api. However later has full support for interacting with logs, too (See logs handler). This makes interacting with observatorium for logs still hard, e.g. pull auth token and using curl or logcli.

How? The obstctl should be extended to support the following subcomands for logs. To accomplish this we propose to expose these client APIs by extending the OpenAPI Spec in obervatorium/api to support associated calls for logs (See issue https://github.com/observatorium/api/issues/294).

Proposed subcommands:

Group Command API Description
obsctl logs get labels /api/logs/v1//loki/v1/api/labels The "labels" command will provide all labels found.
  labelvalues /api/v1/logs//loki/v1/api/labels//values The "labelvalues" command will provide all values for a label.
  series /api/logs/v1//loki/v1/api/series The "series" command will take the provided label matcher and return all the log streams found in the time window.
obsctl logs query /api/logs/v1//loki/v1/api/query_range The "query" command is useful for querying for logs.
obsctl logs instant-query /api/logs/v1//loki/v1/api/query The "instant-query" command is useful for evaluating a metric query for a single point in time.

Testing?

Run make test-e2e

Anything Else?

Log tests suite fails when run after metrics test suite as pretest couldn't get hydra running as previous test's hydra process is still running.