I cannot think about a straightforward way to do that. The CounterVec
is much more than just for data representation. It has all the logic
you need for direct instrumentation. While CounterVec obviously tracks
counts internally, it has nothing to do with samples. If you really
want to stretch it, you could say, the Collect method _creates_ a
sample from it. But it still doesn't have a timestamp. Which is only
created during a scrape.
The model.Vector you get from expfmt.ExtractSamples is just a slice of
model.Sample, and thus something completely different, even if it also
uses the word "vector". The types in the model package are more meant
on the server side, i.e. handling the data in time series and queries
and such.
I don't know what you are trying to accomplish, but if you want to
somehow persist and reconstruct a CounterVec, I guess you need to call
Inc(...) on each counter with the value you would like to reconstruct.
(But I have to admit, I have no clue why you would want to do that.)
--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email]
bjo...@rabenste.in