You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added TSDB import with OpenMetrics and CSV file support.
Based on #5887 Thanks for your
work so far @dipack95, it helped a lot!
Changes on top of @dipack95:
* Addressed all reviews components
* Use subcommands for different formats
* Simplifed block creation, no need to be such complex for first iteration.
* Simpliefied and separate concerns. No need to have access to DB. Block
* writting is separated as well for ease of benchmarking and test. This will be also
needed by @JessicaGreben
* Added import support for different formats.
* Removed all tests - those had to be pulled over and adjusted ):
Signed-off-by: Bartlomiej Plotka <[email protected]>
analyzePath=analyzeCmd.Arg("db path", "database path (default is "+defaultDBPath+")").Default(defaultDBPath).String()
67
-
analyzeBlockID=analyzeCmd.Arg("block id", "block to analyze (default is the last block)").String()
68
-
analyzeLimit=analyzeCmd.Flag("limit", "how many items to show in each list").Default("20").Int()
69
-
dumpCmd=cli.Command("dump", "dump samples from a TSDB")
70
-
dumpPath=dumpCmd.Arg("db path", "database path (default is "+defaultDBPath+")").Default(defaultDBPath).String()
71
-
dumpMinTime=dumpCmd.Flag("min-time", "minimum timestamp to dump").Default(strconv.FormatInt(math.MinInt64, 10)).Int64()
72
-
dumpMaxTime=dumpCmd.Flag("max-time", "maximum timestamp to dump").Default(strconv.FormatInt(math.MaxInt64, 10)).Int64()
73
-
importCmd=cli.Command("import", "import samples from file containing information formatted in the Open Metrics format. Please refer to the storage docs for more details.")
74
-
importFilePath=importCmd.Arg("file path", "file to import samples from (must be in Open Metrics format)").Required().String()
analyzePath=analyzeCmd.Arg("db path", "database path (default is "+defaultDBPath+")").Default(defaultDBPath).String()
74
+
analyzeBlockID=analyzeCmd.Arg("block id", "block to analyze (default is the last block)").String()
75
+
analyzeLimit=analyzeCmd.Flag("limit", "how many items to show in each list").Default("20").Int()
76
+
77
+
dumpCmd=cli.Command("dump", "dump samples from a TSDB")
78
+
dumpPath=dumpCmd.Arg("db path", "database path (default is "+defaultDBPath+")").Default(defaultDBPath).String()
79
+
dumpMinTime=dumpCmd.Flag("min-time", "minimum timestamp to dump").Default(strconv.FormatInt(math.MinInt64, 10)).Int64()
80
+
dumpMaxTime=dumpCmd.Flag("max-time", "maximum timestamp to dump").Default(strconv.FormatInt(math.MaxInt64, 10)).Int64()
81
+
82
+
importCmd=cli.Command("import", "[Experimental] import samples from input and produce TSDB block. Please refer to the storage docs for more details.")
83
+
importDbPath=importCmd.Flag("output", "output directory for generated block").Default(".").String()
84
+
importFilePath=importCmd.Flag("input-file", "disables reading from input and using file to import samples from. If empty input is required").String()
85
+
importBlockSize=importCmd.Flag("block-size", "The maximum block size. The actual block timestamps will be aligned with Prometheus time ranges.").Default("2h").Hidden().Duration()
86
+
87
+
omImportCmd=importCmd.Command("openmetrics", "import samples from OpenMetrics input and produce TSDB block. Please refer to the storage docs for more details.")
88
+
89
+
csvImportCmd=importCmd.Command("csv", "import samples from CSV input and produce TSDB block. Please refer to the storage docs for more details.")
90
+
csvImportDelimiter=csvImportCmd.Flag("delimiter", "CSV single character for fields delimiting").Default(",").String()
0 commit comments