isaozler / grafana-shift-selector

The shift selector allows you to adjust the time range of your grafana dashboard to one specific shift or a range of shifts.
Apache License 2.0
8 stars 6 forks source link

Add an option to allow change "to" param to 'now' instead of the end time of a shift #22

Open hungnt61h opened 1 year ago

hungnt61h commented 1 year ago

There is a problem that when I enabled the Real-time shift auto-select option, the "to" parameter on url was sought to the end time of a shift. That was not really helpful while I was querying PromQL that calculated a sum of data point in a time range like from the start time of the shift till now. To solve this problem, I have modified your code to add a new option like below.

image

So my query is able to calculate the sum of data points from the start time of a shift till present. image image

I hope you would approve this feature and guide me how to contribute my work to your plugin. By the way, I would suggest another feature that is adding a shift countdown. It would appear below the shift selector on the same panel.

hungnt61h commented 3 months ago

@isaozler Could you review my PR https://github.com/isaozler/grafana-shift-selector/pull/39 ? Could we discuss more about this?

hungnt61h commented 3 months ago

The main reason behinding this feature is that I need the shift changes automatically, but the calculation of the time range which the plugin overrides does not work with Prometheus. PromQL cannot limit data between 2 points, one from the past and one from the future. It can only calculate a metric limited by a point in the past and now or 2 points in the past.