observatorium / up

a simple Prometheus and Loki API testing tool
Apache License 2.0
24 stars 23 forks source link

Support range query #19

Closed yeya24 closed 4 years ago

yeya24 commented 4 years ago

Signed-off-by: Ben Ye yb532204897@gmail.com

Changes I made in this pr:

  1. Use promauto to register metrics
  2. Add type label to up_custom_query_last_duration, up_custom_query_executed_total and up_custom_query_errors_total. The value can be either query and query_range.
  3. Add a step flag which defines the default range query step if no step value configured for that query.
  4. update go mod go version to 1.14
  5. Bump golangci-lint to latest 1.30.0 and not enable all linters by default.
  6. Update the queries config file format. Now the file looks like
queries:
- name: this_is_a_range_query
  query: topk(10, count({__name__=~".+"}) by (__name__))
  duration: 1w
  step: 15s
- name: this_is_an_instant_query
  query: up

There are two new fields duration and step. Duration is the duration of the range query, if duration is not set, then that query will be considered as an instant query. Step is the step value for the range query, if not set then it will use the default step value.

yeya24 commented 4 years ago

An example result of running two up instances using range query. One send requests to Thanos querier, one to query frontend.

Screenshot from 2020-08-17 17-39-58

yeya24 commented 4 years ago

Two small nits

Done.

bwplotka commented 4 years ago

:+1:

bwplotka commented 4 years ago

The only problem with this is that we run two queries in same time :thinking: