timescale / promscale

[DEPRECATED] Promscale is a unified metric and trace observability backend for Prometheus, Jaeger and OpenTelemetry built on PostgreSQL and TimescaleDB.
https://www.timescale.com/promscale
Apache License 2.0
1.33k stars 169 forks source link

Replace the BETWEEN operator in Grafana Postgres DS #1189

Open mjf opened 3 years ago

mjf commented 3 years ago

The Postgres data source (DS) in Grafana uses the SQL BETWEEN operator for the "time" column which can be incorrect for edge-cases (see "Don't Do This"). Provide new switch in the Postgres DS settings to replace the BETWEEN operator in the DS macros (preferably defaulting to be switched on for TimescaleDB-enabled DS and switched off for the Postgres-only DS).

nikkhils commented 3 years ago

Hi @mjf

The team that deals with Grafana has been intimated about this. They will take a look soon.

mjf commented 3 years ago

@nikkhils That's great! Thank you.

mjf commented 3 years ago

Hi @nikkhils do you have any news about this, please?

NunoFilipeSantos commented 3 years ago

@cevian can you help out here?

cevian commented 3 years ago

I'll have to look at the semantics Grafana expects (inclusive or exclusive). Not sure which is right here. @svenklemm originally wrote the DS so he may be able to help here as well.

svenklemm commented 3 years ago

I think you want lower inclusive and upper exclusive. Upper inclusive and lower exclusive would work too but might be a little weird since time_bucket returns lower. Currently it does both inclusive which leads to double counting if values are exactly on the boundary. If you were to switch to both exclusive that would lead to missing counts for values that are exactly on boundary.

mjf commented 2 years ago

@nikkhils, @svenklemm, @cevian Hi guys, any update on this, please?