converting prometheus.Metric to data suitable for ingesting by prometheus write protocol.

21 views
Skip to first unread message

Alexey Lesovsky

unread,
Dec 2, 2020, 5:15:28 AM12/2/20
to Prometheus Developers
Hi,
I have metrics received from collector over channel like "chan<- prometheus.Metric".
The 'prometheus.Metric' is an interface with Desc and Write methods from 'github.com/prometheus/client_golang/prometheus' package.

I'd like to send these metrics into another Prometheus using its remote write protocol. My question is how to convert received 'prometheus.Metric' to 'prompb.Timeseries'
I tried to play with Write method but had no success.

I'd appreciate for any advices.

Regards, Alexey

Bjoern Rabenstein

unread,
Dec 3, 2020, 12:37:45 PM12/3/20
to Alexey Lesovsky, Prometheus Developers
On 02.12.20 02:15, Alexey Lesovsky wrote:
> I have metrics received from collector over channel like "chan<-
> prometheus.Metric".
> The 'prometheus.Metric' is an interface with Desc and Write methods from '
> github.com/prometheus/client_golang/prometheus' package.
>
> I'd like to send these metrics into another Prometheus using its remote write
> protocol. My question is how to convert received 'prometheus.Metric' to
> 'prompb.Timeseries'
> I tried to play with Write method but had no success.

Those are really very different things. The types in the
github.com/prometheus/client_golang/prometheus package are for
instrumenting code and expose metrics to be scraped by the Prometheus
servers or other scrapers understanding the Prometheus exposition
format.

The Prometheus remote write protocol is a completely different beast
and used by the Prometheus server to send metrics to remote storage.

The two even have a very different data model: Structured and typed
metrics in the former case, just flat timestamped floating point
numbers in the latter. Single-point-in-time representation in the
former case, a notion of time series in the latter.

--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email] bjo...@rabenste.in

Alexey Lesovsky

unread,
Dec 4, 2020, 2:51:23 AM12/4/20
to Bjoern Rabenstein, Prometheus Developers
Sad to hear that, but thanks for clarification.

Regards, Alexey
--
С уважением Алексей В. Лесовский


Reply all
Reply to author
Forward
0 new messages