chore(tsdb): add a sandboxDir to DBReadOnly, the directory can be used for transient file writes.
use it in loadDataAsQueryable to make sure the RO Head doesn't truncate or cut new chunks in data/chunks_head/.
add a -sandbox-dir-root flag to "promtool tsdb dump/dump-openmetrics" to control the root of that sandbox dirrectory.
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
tsdbDumpCmd:=tsdbCmd.Command("dump","Dump samples from a TSDB.")
dumpPath:=tsdbDumpCmd.Arg("db path","Database path (default is "+defaultDBPath+").").Default(defaultDBPath).String()
dumpSandboxDirRoot:=tsdbDumpCmd.Flag("sandbox-dir-root","Root directory where a sandbox directory would be created in case WAL replay generates chunks. The sandbox directory is cleaned up at the end.").Default(defaultDBPath).String()
dumpMinTime:=tsdbDumpCmd.Flag("min-time","Minimum timestamp to dump.").Default(strconv.FormatInt(math.MinInt64,10)).Int64()
dumpMaxTime:=tsdbDumpCmd.Flag("max-time","Maximum timestamp to dump.").Default(strconv.FormatInt(math.MaxInt64,10)).Int64()
dumpMatch:=tsdbDumpCmd.Flag("match","Series selector. Can be specified multiple times.").Default("{__name__=~'(?s:.*)'}").Strings()
tsdbDumpOpenMetricsCmd:=tsdbCmd.Command("dump-openmetrics","[Experimental] Dump samples from a TSDB into OpenMetrics format. Native histograms are not dumped.")
dumpOpenMetricsPath:=tsdbDumpOpenMetricsCmd.Arg("db path","Database path (default is "+defaultDBPath+").").Default(defaultDBPath).String()
dumpOpenMetricsSandboxDirRoot:=tsdbDumpOpenMetricsCmd.Flag("sandbox-dir-root","Root directory where a sandbox directory would be created in case WAL replay generates chunks. The sandbox directory is cleaned up at the end.").Default(defaultDBPath).String()
dumpOpenMetricsMinTime:=tsdbDumpOpenMetricsCmd.Flag("min-time","Minimum timestamp to dump.").Default(strconv.FormatInt(math.MinInt64,10)).Int64()
dumpOpenMetricsMaxTime:=tsdbDumpOpenMetricsCmd.Flag("max-time","Maximum timestamp to dump.").Default(strconv.FormatInt(math.MaxInt64,10)).Int64()
dumpOpenMetricsMatch:=tsdbDumpOpenMetricsCmd.Flag("match","Series selector. Can be specified multiple times.").Default("{__name__=~'(?s:.*)'}").Strings()
| <codeclass="text-nowrap">--sandbox-dir-root</code> | Root directory where a sandbox directory would be created in case WAL replay generates chunks. The sandbox directory is cleaned up at the end. | `data/` |
| <codeclass="text-nowrap">--min-time</code> | Minimum timestamp to dump. | `-9223372036854775808` |
| <codeclass="text-nowrap">--max-time</code> | Maximum timestamp to dump. | `9223372036854775807` |
| <codeclass="text-nowrap">--match</code> | Series selector. Can be specified multiple times. | `{__name__=~'(?s:.*)'}` |
@ -592,6 +593,7 @@ Dump samples from a TSDB.
| Flag | Description | Default |
| --- | --- | --- |
| <codeclass="text-nowrap">--sandbox-dir-root</code> | Root directory where a sandbox directory would be created in case WAL replay generates chunks. The sandbox directory is cleaned up at the end. | `data/` |
| <codeclass="text-nowrap">--min-time</code> | Minimum timestamp to dump. | `-9223372036854775808` |
| <codeclass="text-nowrap">--max-time</code> | Maximum timestamp to dump. | `9223372036854775807` |
| <codeclass="text-nowrap">--match</code> | Series selector. Can be specified multiple times. | `{__name__=~'(?s:.*)'}` |