Extract timeseries from TSDB Prometheus 2.0 files using Python

[EDIT]: I found a package that does exactly what I want to do but it is written in Go : https://github.com/ryotarai/prometheus-tsdb-dump

I have a s3 bucket where my system metrics data are stored following the Prometheus 2.0 format like presented here https://thanos.io/tip/thanos/design.md/#metric-sources.

My goal is to "parse" back this compressed data into an understandable format (say json for example with keys timestamp, value, metric...) using python in order to perform timeseries analysis.

I understand that the data are compressed in such a way that querying them would be quick and optimal using PromQL via Thanos, but I could not find anything similar to my use case (even though there is a documentation on the data format I am trying to read here https://github.com/prometheus/prometheus/tree/main/tsdb/docs/format, I do not fully understand how to parse the index and chunks files..)

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum