Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

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.

...

Consider a use case where we have CSV input files that contain information about registered members. We would like to produce metrics that state number of members from each country present in each file processed, and forward the metrics to Prometheus to get dashboards.

The picture shows a snippet of the input records with a corresponding Ultra Format Definition, and the dashboard that we want to produce given the metrics from the Prometheus Agent.

...

The optimal way to configure this use case, is to use PrometheusUDRs (instead of MIMs) since:

  • The labels of the metrics (countries in this case), is not known in advance.

  • The regularity of publishing the metrics needs to be decided by the user.

The Workflow will contain an Aggregation Agent that consolidates the metrics for each country present in the input batch as we do not want to publish metrics for each record processed. The consolidated metrics are forwarded to an Analysis Agent that maps the aggregated data to a PrometheusUDR before sending it on to a Prometheus Agent.

...

The configuration of the Analysis Agent:

Code Block
consume {
  debug(input);

  PrometheusUDR promUDR = udrCreate(PrometheusUDR);
//Map containing labels and
their values: map<string,string> labels = mapCreate(string,string);

  mapSet(labels, "country", "sessioninput.country"countryOfOrigin);

  metricpromUDR.Description = "Items being processSum of members' country of origin.";
metric  promUDR.Labels = labels;
  metricpromUDR.MetricType = "GAUGE";
metric  promUDR.Name = "myMetric_valueNoOfMembersPerCountry";
  metricpromUDR.Value = randomInt(111input.count;

  debug(promUDR);
  udrRoute(metricpromUDR);
}

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).

...

Below debug examples from the Analysis Agent for one of the countries (France) is shown. The first entry is the incoming aggregated UDR, and the second is the PrometheusUDR that is forwarded to the Prometheus Agent.

Field Values for: Prometheus.UFL_input.countryAggregate
countryOfOrigin: France
count: 1265

Field Values for: PrometheusUDR
Description: Sum of members' country of origin.
MetricType: GAUGE
Value: 1265.0
Labels: {country=France }
Name: NoOfMembersPerCountry