Versions Compared

Key

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

...

  • 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 data since we do not want to publish metrics for each record processed. The consolidated metrics are then forwarded to an Analysis agent that maps the aggregated data to a PrometheusUDR before sending it to a Prometheus Agent.

...

Analysis Agent Configuration

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

The debug output from the Analysis agent for one of the countries (France) will look like this:

...