Hi,
we have several prometheus instanaces running for years, and we have several TB data served as local storage, now we plan to upgrade our monitoring stack to use a remote read/write storage(m3db).
so we wish to backup/export old data to m3db. so I started to implement a tool to read the persistence block files and send them all to remote read endpoint. but as an user I don't have enough insight on the core of
prometheus that how the data is stored and how is sent.
Now I can read the data from the directory, my step is :
tsdb.OpenDBReadOnly------> blockReaders--- > blockMeta ----->MinTime
| |--------->MaxTime
|--->storageQuerier--------> storageQuerier.Select(labelSelectParams, labelMatcher) -----> storage.SeriesSet ------->storage.series -------> labels(labels.Label) ---transform to ---->prompb.Label
|-------> iterator (cotains the sample of timestamp and value)---transform to ---->prompb.Sample
then I don't figure out how to send these metrics to the remote storage, in repo https://github.com/prometheus/prometheus/storage/remote, since prometheus itself has implemented the remote write function, so I don't want to implement it again, but I didn't get the logic here.
and anther thing is that I don't find a way how to extract the metric metadata from local storage, I can't see any libs/functions that exists inside the repo .