ryotarai/prometheus-tsdb-dump

Add ability to set time range for data importing

valyala opened this issue · 3 comments

The issue

Sometimes users start replicating data to VictoriaMetrics from Prometheus, while continuing storing data to Prometheus. Then they need importing historical data from Prometheus into VictoriaMetrics, but don't won importing duplicate data, which already exists in VictoriaMetrics after it has been added as remote storage to Prometheus.

The solution

To add ability to set time range (start and end timestamps) for data to import from Prometheus storage to VictoriaMetrics. For instance, -startTimestamp and -endTimestamp command-line flags. Default value for -startTimestamp should be 0, while default value for -endTimestamp should be +Inf.

Already implemented:

minTimestamp := flag.Int64("min-timestamp", 0, "min of timestamp of datapoints to be dumped; unix time in msec")
maxTimestamp := flag.Int64("max-timestamp", math.MaxInt64, "min of timestamp of datapoints to be dumped; unix time in msec")

but not documented. I'm going to update README.

Updated README: 2c3e0a5

Thanks!