Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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.

promUS.png

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.

promWF.png

The configuration of the Analysis Agent:

consume {
  debug(input);

  PrometheusUDR promUDR = udrCreate(PrometheusUDR);
  map<string,string> labels = mapCreate(string,string);

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

  promUDR.Description = "Sum of members' country of origin.";
  promUDR.Labels = labels;
  promUDR.MetricType = "GAUGE";
  promUDR.Name = "NoOfMembersPerCountry";
  promUDR.Value = input.count;

  debug(promUDR);
  udrRoute(promUDR);
}

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

  • No labels