Is a "time shift" or "lag" function on the roadmap?

I see this as a possible solution: GitHub - maxsivanov/influxdb-timeshift-proxy: Add timeshift feature to influxdb for grafana users with mathematics between metrics feature

Follow up question: is there a workaround within Kapacitor?


What is the intended use of this ?
The time shift is available in grafana.

I’m interested in this as well. There were a couple GitHub issues for it that were supposedly aggregated to this issue:

There is an item listed for “lag variables” (although I’m not 100% sure that’s the time-shift function we’re after). There does appear to be user interest, but from what I’ve seen that proxy project is the only workaround currently for Influx. Graphite does have a timeShift() function.

@Luv this would be for trying to display time-shifted data on the same graph (e.g. overlay last week’s data for comparison) vs separate graphs/panels and trying of visually compare.

+1 for timeshift or lag to put comparaison in the same graph

Yes, timeshift is definitely on the roadmap. It will most likely make it into an early version of the new functional query language that we’re developing (details here). Then we’ll look at potentially adding it to the SQL version of the query language.

1 Like

Its also currently available if you are using Kapacitor see ShiftNode | InfluxData Documentation Archive


Does anyone have any approach they’ve taken to compare two separate time periods against each other with data captured with Influx?

My personal solution was to pull the data via GET request, parse via powershell, dump to json and then compare two separate test periods with custom Power BI charts.

I’d prefer some way of figuring out how to leverage InfluxDB directory with Grafana to do this but haven’t found any success stories.

This is for load test periods that need me to present the data more as a relative time from start instead of exact time period details.

+1 for shift. For now I’m able to multiply a first by a last using a WHERE time > now() - 90m, in order to kludge multiplying a value for one hour by than of another, but it’s very kludgy. It would be easier to multiply “last x last but one” in some form.

+1 for timeshift. I’m displaying the energy output of my photovoltaic system in Grafana. I’d like to compare the monthly data with the same period of last year in one graf.

Look at these nice grafs and the comments. THAT’S THE REASON why I’d love to have timeshift supperted by InfluxDB

+15,6 for a timeshift function, it would be…


@pauldix Does the new query language Flux has timeshift support yet? Can you please share details/documentation on how to use it with Grafana?


Flux supports it. Right now the function is called shift, but there’s an issue to rename it to timeShift: Rename the `shift` function to `timeShift` · Issue #810 · influxdata/flux · GitHub