Prometheus Forwarding Agent Example(3.3)

This section exemplifies how the Prometheus forwarding agent can be used. The scenario is the following:

The Prometheus agent is used to send metrics from a workflow to the cache that exposes them for a Prometheus instance to scrape.

A Pulse agent sends a simple PulseUDR to an Analysis agent.


The Analysis agents creates a PrometheusUDR. It uses the label country. The value is generated randomly to visualize fluctuation.

As the next step the PrometheusUDR is routed on route r_2 to the Prometheus forwarding agent.

You create PromethueusUDRs in the Analysis agent. It has to be filled in with metric data.

//New UDR representing a metric:
PrometheusUDR metric = udrCreate(PrometheusUDR);
//Map containing labels and their values:
map<string,string> labels = mapCreate(string,string);

mapSet(labels, "country", "session.country");

metric.Description = "Items being process";
metric.Labels = labels;
metric.MetricType = "GAUGE";
metric.Name = "myMetric_value";
metric.Value = randomInt(111);

udrRoute(metric);

The Analysis agent routes the UDR to the Prometheus agent, which stores it in the cache where it waits to be scraped by a Prometheus instance.

After running the workflow for a few moments the metrics can be visualized directly in Prometheus or in Grafana (if configured).