timescale / prometheus-postgresql-adapter

Use PostgreSQL as a remote storage database for Prometheus
Apache License 2.0
335 stars 66 forks source link

[Thanos Integration] Implementing other API's #103

Open iridian-ks opened 4 years ago

iridian-ks commented 4 years ago

Problem

There are other systems/services that might want to query data in a way that's similar to Prometheus, but the API is different. (and therefore doesn't work)

Specifically

Thanos has a Query API, which has implemented proxies for Prometheus, and OpenTSDB. Unfortunately, it doesn't have one for Postgres/Timescale.

What I've Tried

I have a Prometheus/Timescale cluster who has 2 roles:

  1. Monitor Thanos :)
  2. Timescale provides an API for us to do bulk imports, which is something Prometheus doesn't support (This is a huge feature that we are trying to leverage)

We are using Thanos to act as a single endpoint that will consolidate all Prometheus data across all sources. It is working for the most part, but it looks like it isn't triggering the remote_read to get data from Timescale: https://github.com/thanos-io/thanos/issues/1915

Potential Solutions

In Thanos

If Thanos triggered the remote_read in Prometheus then this could work, but looks like they don't want to use Prometheus as a proxy. They recommended that their Thanos API be implemented for Postgres.

Somewhere in the Timescale stack

The Thanos Query API or OpenTSDB API for Timescale would resolve this issue, which would essentially be exactly what this project accomplishes with Prometheus' remote_read implementation, just with a different API. I'm not sure if the OpenTSDB API has been considered by Timescale as that seems the most useful?

(I'm somewhat naive here but any direction would be great)

Many thanks in advance!