Versions Compared

Key

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

Consider a use case where In this example, we have CSV *.csv input files that contain containing information about registered members . We would like and we want to produce metrics that state for the number of members from each country present in each processed file processed, and forward the metrics to Prometheus to get dashboards.The picture shows display them in a graph on a dashboard.

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

...

The optimal way to configure In this use case , it is recommended to use PrometheusUDRs (instead of MIMs) sincefor the following reasons:

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

...

Designing the Workflow

The workflow handling the data in this example contains an Aggregation agent that consolidates the metrics for each country present in the input batch as data since we do not want to publish metrics for each record processed. The consolidated metrics are then forwarded to an Analysis Agent agent that maps the aggregated data to a PrometheusUDR before sending it on to a Prometheus Agent.

...

...

Analysis Agent Configuration

The configuration of the Analysis Agent is configured with the following code:

Code Block
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);
}

Debug Examples

Below The debug examples output from the Analysis Agent 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. will look like this:

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

The first entry is the incoming aggregated UDR, and the second is the PrometheusUDR that is forwarded to the Prometheus Agent.