This is a small proxy to be used as Grafana datasource to dynamically modify queries to a Prometheus API.
It currently supports modifying the following URL-encoded parameters which are encoded in the URL:
startendtime
For more information about the parameters have a look at the Prometheus docs.
I was building a Grafana Dashboard having day-specific values.
The sum of a day was always shown with the timestamp of the next day which may
be a bit confusing for end-users.
By adjusting the start, end or time parameters by defining different
datasources I was able to shift the queries to:
- Show not too much values in my table.
- Shift the timestamp by 1 second to show the last second of the day (
23:59:59) instead of the next day.
I was not able to achieve the same by Grafana configuration and that's why I have written this small proxy.
To adjust the parameters configure PromShift Proxy as normal Prometheus datasource and configure your datasource at Custom Query Parameters.
The following configuration would:
- add
23hto the timestampstart(if the parameter exists in the request) - subtract
1hfrom the timestampend(if the parameter exists in the request) - subtract
1hfrom the timestamptime(if the parameter exists in the request)
start=23h&end=-1h&time=-1h