Is it possible to write data to Prometheus?

59 views
Skip to first unread message

Anoop

unread,
Sep 16, 2021, 3:30:09 AM9/16/21
to Prometheus Users
Hi, 

As per my understanding the Prometheus is a pull based mechanism. However, I would like to check if there is anyway to write data from the application to prometheus instead of scraping data from application? 

I know it is possible using push gateway. But I am trying to avoid using push gateway. Please let me know, if the prometheus can expose a writer endpoint for the applications to send the data to prometheus.

Thank You,
Anoop

Stuart Clark

unread,
Sep 16, 2021, 3:59:55 AM9/16/21
to Anoop, Prometheus Users
Prometheus is designed as a pull based system. Things like the
Pushgateway operate slightly differently, but they are designed for
specific use cases (e.g. cron jobs) rather than being designed to
convert Prometheus to push based. There are other tools to allow systems
being firewalls, etc. to operate as well.

What is the specific use case/issue with using Prometheus as a pull
based mechanism?

--
Stuart Clark

Brian Candler

unread,
Sep 16, 2021, 12:46:12 PM9/16/21
to Prometheus Users
Prometheus now has a "remote write" endpoint, but it's probably not what you want.

If you want a Prometheus-style "push" metrics system, then VictoriaMetrics may suit you better.

Its query protocol is compatible with prometheus, and its query language is a superset of PromQL - so you can point Grafana dashboards at it as if it were prometheus, and they won't know the difference.

Anoop Mohan

unread,
Sep 16, 2021, 2:09:12 PM9/16/21
to Brian Candler, Prometheus Users
Hi Brian, can you please provide more details about the remote write endpoint of Prometheus? Can the applications send metrics to this writer endpoint of the Prometheus?

Thank you, 
Anoop

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5b1bfff7-1b91-4092-9e49-a250141503bcn%40googlegroups.com.

Julius Volz

unread,
Sep 16, 2021, 2:46:39 PM9/16/21
to Brian Candler, Prometheus Users
On Thu, Sep 16, 2021 at 6:46 PM Brian Candler <b.ca...@pobox.com> wrote:
Prometheus now has a "remote write" endpoint, but it's probably not what you want.

If you want a Prometheus-style "push" metrics system, then VictoriaMetrics may suit you better.

Its query protocol is compatible with prometheus, and its query language is a superset of PromQL - so you can point Grafana dashboards at it as if it were prometheus, and they won't know the difference.

It's important to note when mentioning this that VictoriaMetrics is intentionally (and unintentionally) *not* PromQL compatible in multiple ways, see https://promlabs.com/blog/2020/08/06/comparing-promql-correctness-across-vendors and https://promlabs.com/blog/2020/11/26/an-update-on-promql-compatibility-across-vendors. So when using it, you cannot rely on open Prometheus ecosystem tooling anymore to work properly with it.
 

On Thursday, 16 September 2021 at 08:59:55 UTC+1 Stuart Clark wrote:
On 2021-09-16 08:30, Anoop wrote:
> Hi,
>
> As per my understanding the Prometheus is a pull based mechanism.
> However, I would like to check if there is anyway to write data from
> the application to prometheus instead of scraping data from
> application?
>
> I know it is possible using push gateway. But I am trying to avoid
> using push gateway. Please let me know, if the prometheus can expose a
> writer endpoint for the applications to send the data to prometheus.
>

Prometheus is designed as a pull based system. Things like the
Pushgateway operate slightly differently, but they are designed for
specific use cases (e.g. cron jobs) rather than being designed to
convert Prometheus to push based. There are other tools to allow systems
being firewalls, etc. to operate as well.

What is the specific use case/issue with using Prometheus as a pull
based mechanism?

--
Stuart Clark

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5b1bfff7-1b91-4092-9e49-a250141503bcn%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com

Brian Candler

unread,
Sep 16, 2021, 3:15:33 PM9/16/21
to Prometheus Users
> Hi Brian, can you please provide more details about the remote write endpoint of Prometheus? Can the applications send metrics to this writer endpoint of the Prometheus?

It's normally used for prometheus to send data that it has already collected to some remote archival database:

i.e. when prometheus is the remote write client.  That's fine.

The ability to use prometheus itself as a remote write endpoint is, to all intents and purposes, undocumented: it's mentioned in passing here.  I *strongly* discourage you from attempting to use it.  This is not how prometheus is intended to be used, and you're likely to end up in a world of pain.

Reply all
Reply to author
Forward
0 new messages