2 years ago

#74824

test-img

MelleD

Micrometer collection metric with pagination

I would like to create a metric that represents a list of groups. The group contains a name and the count of elements.

   public class GroupMetric{
      String name;
      int count;
   }

This metric is intended to be provided via a Rest API. The GroupMetric objects are already created and the data are set.

Questions:

  1. Is it possible to display such a collection list of groups with one metric or is a metric required for each group?

  2. How can I query the metric from the MeterRegistry?

  3. Is it possible to use pagination, because the GroupMetric objects can be greater than 100.000

The output should look like this:

{
    "items": [
        {
            "name": "group1",
            "count": "10000"
        },
        {
            "name": "group2",
            "count": "54"
        },
        {
            "name": "group3",
            "count": "122"
        }
    ],
    "totalItems": 3,
    "currentPage": 0,
    "totalPages": 1,
    "itemCount": 3
}

Currently using spring boot and micrometer.

Does anyone have experience or a good idea how to implement this?

micrometer

spring-micrometer

0 Answers

Your Answer

Accepted video resources