I recently was looking into ways to backfill historical data into Prometheus from a historical source.
I was hoping to use Prometheus's backfilling feature but it requires data to be in OpenMetrics format, which I was struggling to find good tooling for.
I wrote this snippet in go to convert data in CSV format to OpenMetrics format.
It combines the CSV parsing from VictoriaMetrics CSV importing, and the OpenMetrics capabilities from Prometheus' expfmt package. VictoriaMetrics code is used to parse the CSV into an in-memory representation, func ConvertVMToProm()
converts the in-memory representation to something expfmt
understands, and expfmt
writes the file.
Note -help flag is broken due to extra flags.