Describe the bug
The output of ttf(vm_free_disk_space_bytes{job="victoria-metrics"}) is usually NaN.
I tried it as a range query and instant query.
The function is not documented in detail, so I don't know how many data points are considered, etc. to judge the output.
Screenshots


Version
v1.40.0
Here is an attempt with [2d] vector. The series abruptly stops.
I can speculate that perhaps ttf() doesn't handle increasing free space, which may happen due to compression etc.

if ttf() doesn't produce a usable value at the end of the range, it cannot be used with instant query for alerting, etc.
evidence that NaN output may be related to NaN or increase of input
query here is ttf(vm_free_disk_space_bytes{job="victoria-metrics"}[1h])

conclusion: it's caused by increases in source series

aside: for the original use case of estimating VM storage full, I found it's much better to derive it from ingestion rate rather than free storage rate
# seconds_until_full_estimate = free_bytes / (datapoint_rate[1d] * bytes_per_datapoint)
vm_free_disk_space_bytes / (sum(rate(vm_rows_inserted_total[1d])) *
(sum(vm_data_size_bytes{type !="indexdb"}) / sum(vm_rows{type != "indexdb"})))
for the original use case of estimating VM storage full, I found it's much better to derive it from ingestion rate rather than free storage rate
This looks much better than generic ttf(vm_free_disk_space_bytes)! Thanks for doing this!
As for missing results for ttf(), could you build VictoriaMetrics from commit 2114179e1935e1e1ab3376638419b69a62ac37e7 and verify whether it fixes the issue with missing ttf() results? See build instructions. It is also recommended passing big time range inside square brackets to ttf in order to get smooth graphs. For example, ttf(m[1h]).
FYI, the commit mentioned above has been included in v1.41.0.
ttf() function appears to be fixed