The goal of this project is to make it possible to run PromQL queries on OpenTSDB.
We have achieved this by providing an implementation of the Thanos StoreAPI.
Since Thanos's StoreAPI is designed for unified data access and is not too Prometheus specific, Geras is able to provide an implementation which proxies onto the OpenTSDB HTTP API, giving the ability to query OpenTSDB using PromQL, and even enabling unified queries over Prometheus and OpenTSDB.
go get github.com/G-Research/geras/cmd/geras
After the build you will have a self-contained binary (geras
). It writes logs to stdout
.
-grpc-listen string
Service will expose the Store API on this address (default "localhost:19000")
-http-listen string
Where to serve HTTP debugging endpoints (like /metrics) (default "localhost:19001")
-trace-enabled
Enable tracing of requests, which is shown at /debug/requests (default true)
-trace-dumpbody
Include TSDB request and response bodies in traces (can be expensive) (default false)
-label value
Label to expose on the Store API, of the form '<key>=<value>'. May be repeated.
-log.format string
Log format. One of [logfmt, json] (default "logfmt")
-log.level string
Log filtering level. One of [debug, info, warn, error] (default "error")
-healthcheck-metric
A metric to query as a readiness health check (default "tsd.rpc.recieved")
-metrics-refresh-interval duration
Time between metric name refreshes. Use negative duration to disable refreshes. (default 15m0s)
-metrics-suggestions
Enable metric suggestions (can be expensive) (default true)
-opentsdb-address string
<host>:<port>
-metrics-allowed-regexp regexp
A regular expression specifying the allowed metrics. Default is `.*`,
i.e. everything. A good value if your metric names all match OpenTSDB
style of `service.metric.name` could be `^\w+\..*$`. Disallowed metrics
are simply not queried and non error is returned -- the purpose is to
not send traffic to OpenTSDB when the metric source is Prometheus.
-metrics-blocked-regexp regexp
A regular expression of metrics to block. Default is empty and means to
not block anything. The expected use of this is to block problematic
queries as a fast mitigation therefore an error is returned when a
metric is blocked.
When specifying multiple labels, you will need to repeat the argument name, e.g:
./geras -label label1=value1 -label label2=value2
- PromQL supports queries without
__name__
. This is not allowed in geras and it will raise an error. - Geras periodically loads metric names from OpenTSDB and keeps them in memory to support queries like
{__name__=~""}
. - Thanos' primary timeseries backend is Prometheus, which doesn't support
.
in metric names. However OpenTSDB metrics generally use.
as a seperator within names. In order to query names containing a.
you will need to either:-
Replace all
.
with:
in your queryOR
-
Use the magic
__name__
label to specify the metric name, e.g.{__name__="cpu.percent"}
-