-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal – Time Interpolation #2428
Comments
Is there an update on this proposal? This is a much needed feature when joining data, since there's no "outer" join method either. |
Highly recommended function!! Particularly for set ups where you only record data 'on change' to preserve bandwith. It results in big gaps in the data by design, but then impacts on many mathematical operations if you can't recreate the 'missing' data on the fly. Seems people at Timescale understand this very well: Cheers |
+1, this would be a great feature and quite necessary |
+1, quite necessary |
+1 I'm surprised this is not an option. |
+1 |
1 similar comment
+1 |
+1, this would be a major feature and necessary |
I think this is a critical feature. I have written up a small but challenging test case. Note that in this case the interpolation interval (how frequently result points are spaced out) and the interpolation radius (how far a raw point can be away from the result point while still being considered) are the same at 5 minutes.
Interpolate data with 5 minute interpolation interval, 5 minute interpolation radius, from 2:00 to 2:35:
|
+1 much needed here as well! |
+1 |
I did a small workaround with an union/pivot (some sort of "outer join") of two querys: https://gist.github.com/tillsc/2d71f3e89409049833e75ed22689ad40 Maybe this helps someone in the meantime... Use "staircase" plotting mode (not the "Step" plotting mode of the influx ui itself!). |
We have added a first implementation of an interpolation function here https://github.com/influxdata/flux/blob/master/stdlib/interpolate/interpolate.flux It does simple linear interpolation on a regular time interval. We have plans to implement other types of interpolation as well. For now that is a link to the source code with a comment that has some docs. Public docs are in progress. |
I'm also very interested in this. Both TimescaleDB and Azure Data Explorer (which is not even an actual time-series DB) can do this. Besides linear interpolation, I'd like to propose having the option to do backward and forward fill interpolation. Looking forward for this to be available on InfluxDB Cloud. |
Unless I'm mistaken, previous comment doesn't interpolate? Repeating the same value across successive time windows is straightforward using fill, but then you get a step function not interpolation which is what this topic is about. |
I use this:
It's slow with large queries AND inaccurate with smaller queries. So the worst of both worlds. |
@Scrumplex since this issue was create, the |
Sadly that's not what I am looking for. I would rather have it interpolate nulls and deal with it with fill instead. |
Is the issue still open or the main problem can be fixed using interpolate.linear()? I don't know how could I fill nulls with that function because as far as I can see interpolate.linear() will generate more rows in the measurement instead of fill null values. Thanks. |
finally we need this +1 |
Too bad the original proposal wasn't considered. Finding the correct timestamps is the issue, not filling the new data with values. So I'd have loved to see interpolate.null() alongside interpolate.linear(). Espacially as the fill() documentation explicitly serves that issue on a silver platter already. If I'm not mistaken even if I'm only missing data points due to "drop data point with non-changing values" I still have to fix my unregularly timed data to a regular interval (that I have to decide on manually) via aggregation on Good probability I'm missing something here, but I expected this to be an everyday use case, that deserves an easy 1-2 liner in a temp database. |
A null interpolation would be very welcome for working with Grafana time series graphs. Currently, when using solid line style, it will always connect the data points. The only way to suppress this is to use null data points. |
Yet another backwards step in Flux vs InfluxQL |
I too would really like a |
+1 for "interpolate.null()" |
@DenisMir, how did you fill in the blank spaces between the values?? |
Any progress on that matter? |
Just wanted to post my workaround in case others find it useful. I use InfluxDB as a backend DB which is wrapped by an API. If you're looking to just use influx directly this method probably isn't a good idea since it requires that you have an application client calling influx, and then you return that data to a different process. In my case I'm using the NodeJS client lib In code solution step // Basic Client setup example
const client = new InfluxDB({ url:'myInfluxURL', token: "myToken", timeout: 60000 })
const query = ` some really cool query with aggregationIntervals `; // This would be your query
const queryAPI = client.getQueryApi("myOrg");
const data = queryApi.collectRows<any>(query);
// Actual work around logic
if (data.length === 0) {
const start = new Date(startTime); // The startTime of the query
const end = new Date(endTime); // The endTime of the query
const interval = end.getTime() - start.getTime(); // The time in ms between them
const intervalInMilliseconds = aggregationIntervalInMS[argumentAgg]; // Convert the aggregation interval chosen to ms, I used a static mapping since my aggregation intervals were well known and only a subset of all the other ones.
const numberOfIntervals = Math.ceil(interval / intervalInMilliseconds); // Get the number of intervals
const aggregatedResults = [];
for (let i = 0; i < numberOfIntervals; i++) {
// You may want to change this result to include any relevant metadata you want assigned to each interval.
aggregatedResults.push(
{
value: '0',
startTime: new Date(start.getTime() + i * intervalInMilliseconds).toISOString(),
endTime: new Date(start.getTime() + (i + 1) * intervalInMilliseconds).toISOString(),
}
);
}
return aggregatedResults
} The aggregationIntervalInMS mapping I have is simply the following: {
hour:3600000,
day:86400000,
month:2592000000,
} I think in specific use cases this can help fill in data if you're looking to wrap influx. |
If it is of interest to anyone, This is the closest i managed to get with a update on change type data stream. Example is with data from homeassistant.
It still can't fix the missing data before the time range, however it does a good job at representing the inactivity / staircase of data that does not change linearly. |
This issue has had no recent activity and will be closed soon. |
This is still an unsolved problem, closing it would be premature. |
Four years and counting. Commenting here so the bot doesn't close this (still relevant) issue. |
This issue has had no recent activity and will be closed soon. |
This is still an unsolved problem, closing it would be premature. |
This issue has had no recent activity and will be closed soon. |
Still a problem. |
Thank you for completing the Sisyphean task of rolling the boulder up the hill only to have the It should be clear that this feature is not a priority to influx, really at all. I believe that Flux is going to be discontinued in the near future anyway. (Just a guess I am not affiliated with them at all) https://community.influxdata.com/t/is-flux-being-deprecated-with-influxdb-3-0/30992/50 EDIT: |
This issue has had no recent activity and will be closed soon. |
Nope.
…On Sun, 17 Nov 2024 at 01:59, github-actions[bot] ***@***.***> wrote:
This issue has had no recent activity and will be closed soon.
—
Reply to this email directly, view it on GitHub
<#2428 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJAQNWC2FL7SWK2HKBPSDWT2A72BVAVCNFSM4KLJBAY2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TENBYGA4DQOBQGA3A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Flux is in maintenance mode. This will not be done. Let it close out.
https://docs.influxdata.com/flux/v0/future-of-flux/
…On Sat, Nov 16, 2024, 8:26 PM Tom M0LTE ***@***.***> wrote:
Nope.
On Sun, 17 Nov 2024 at 01:59, github-actions[bot] ***@***.***>
wrote:
> This issue has had no recent activity and will be closed soon.
>
> —
> Reply to this email directly, view it on GitHub
> <#2428 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AJAQNWC2FL7SWK2HKBPSDWT2A72BVAVCNFSM4KLJBAY2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TENBYGA4DQOBQGA3A>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#2428 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMOHDE74X25Q22QAPFK3BL2A75ELAVCNFSM4KLJBAY2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TENBYGA4DSNJTGEZQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I've talked with three users just this week who want/need to be able to generate points at given intervals if no data exists – time interpolation. I've been thinking through possible implementations and have the following proposals:
Proposal 1 - Create an
interpolate()
functionThis function would essentially "window" the data by the specified duration and check to see if a point exists in each window. If the window is empty, it inserts a row with a
_time
value calculated from the right bound of the window. All columns that are in the group key inherit the key values. All columns that are not in the group key are set to null.You could then use
fill()
to replace the null values. I don't think we could fill as part of theinterpolate()
function because we don't necessarily know what or how many columns will be null in the output. So it's best left to the user to fill the columns as they need to.Proposal 2 - Add interpolation param(s) to
fill()
This solution would add
interpolate
andinterpolateEvery
parameters to thefill()
function. As in proposal 1, it would "window" the data by the specifiedinterpolateEvery
duration and check to see if a point exists in each window. If the window is empty, it inserts a row with a_time
value calculated from the right bound of the window and fills the specified column with the specified fill value. All columns that are in the group key inherit the key values. All columns that are not the specified fill column and are not in the group key are dropped from the table.The downside of this approach is that the user may want to preserve columns that would get dropped in this process.
The text was updated successfully, but these errors were encountered: