Skip to content

Instantly share code, notes, and snippets.

View pdewilde's full-sized avatar
🍕
Keeping it Simple

Parker DeWilde pdewilde

🍕
Keeping it Simple
View GitHub Profile
@pdewilde
pdewilde / CSV_to_OpenMetrics.md
Last active March 18, 2025 18:25
Convert CSV to OpenMetrics

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.

@pdewilde
pdewilde / pop_timezone_issue_demo.sh
Created May 17, 2023 22:50
Example user journey of new pop user discovering an issue with timezones
## Cleanup from previous run
rm -rf /tmp/popflow
### Flow of a new Pop User
# Install the pop CLI https://gobuffalo.io/pt/documentation/database/soda/
go install github.com/gobuffalo/pop/v6/soda@latest
## Make a directory
mkdir /tmp/popflow
cd /tmp/popflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.