DiamondMofeng / grafana-greptime-datasource

Grafana datasource plugin for GreptimeDB
Apache License 2.0
11 stars 1 forks source link

Automatically generate a where condition that matches the time period selected in Grafana #10

Closed DiamondMofeng closed 1 year ago

DiamondMofeng commented 1 year ago

General

Currently, the default sql query does not contain any where conditions. This means that all data will be returned from the server, although Grafana only renders data that are in the selected time period.

图片

It's very easy to implement this time filter. We just need to introduce Grafana's variables feature, which provides the timestamp of currently selected time period. Then inject them into user's query string.

Question

The thing is, should we allow users to disable this?

As far as I know, Grafana's Influxdb datasource do not allow users to disable the automatically generate time filter conditions, while Mysql datasource explicitly providing this as an option select when adding a new condition.

图片 图片

As the frontend of Grafana's only role is to visualizing data, fetching data that are not in the selected time range is totally a waste of performance and bandwidth. However, is there any scenarios where users must fetch those data that can not be rendered?

DiamondMofeng commented 1 year ago

Finally I do not allow users to disable this feature.