0

The actuator endpoint /actuator/metrics/http.server.requests can exhibit this informations:

{
  "name": "http.server.requests",
  "baseUnit": "seconds",
  "measurements": [
    {
      "statistic": "COUNT",
      "value": 17.0
    },
    {
      "statistic": "TOTAL_TIME",
      "value": 0.751589096
    },
    {
      "statistic": "MAX",
      "value": 0.379677657
    }
  ],
  "availableTags": [
    {
      "tag": "exception",
      "values": [
        "none"
      ]
    },
    {
      "tag": "method",
      "values": [
        "GET"
      ]
    },
    {
      "tag": "error",
      "values": [
        "none"
      ]
    },
    {
      "tag": "uri",
      "values": [
        "/swagger-ui*/**",
        "/v3/api-docs/swagger-config",
        "/v3/api-docs",
        "/simulacao",
        "/swagger-ui*/*swagger-initializer.js"
      ]
    },
    {
      "tag": "outcome",
      "values": [
        "SUCCESS"
      ]
    },
    {
      "tag": "status",
      "values": [
        "200"
      ]
    }
  ]
}

I want to add a measurement statistic called "MIN" that shows the min time requests took, like this:

{
  "name": "http.server.requests",
  "baseUnit": "seconds",
  "measurements": [
    {
      "statistic": "COUNT",
      "value": 17.0
    },
    {
      "statistic": "TOTAL_TIME",
      "value": 0.751589096
    },
    {
      "statistic": "MAX",
      "value": 0.379677657
    },
    {
      "statistic": "MIN",
      "value": 0.001235678
    }
  ],
  "availableTags": [
    {
      "tag": "exception",
      "values": [
        "none"
      ]
    },
    {
      "tag": "method",
      "values": [
        "GET"
      ]
    },
    {
      "tag": "error",
      "values": [
        "none"
      ]
    },
    {
      "tag": "uri",
      "values": [
        "/swagger-ui*/**",
        "/v3/api-docs/swagger-config",
        "/v3/api-docs",
        "/simulacao",
        "/swagger-ui*/*swagger-initializer.js"
      ]
    },
    {
      "tag": "outcome",
      "values": [
        "SUCCESS"
      ]
    },
    {
      "tag": "status",
      "values": [
        "200"
      ]
    }
  ]
}

I'm using Springboot and I was not able to find information about creating statistics on Micrometer documentation. Can someone help me understand how to approach this problem?

1 Answer 1

0

Min is a bit problematic, let me explain it from the perspective of max. Max is not a "global maximum" which means it is not the max of all the recorded latencies ever but it is a "time-window max" which means it shows you a "recent" maximum value, see the docs:

The maximum statistical value for basic Timer implementations [...] is a time window maximum (TimeWindowMax). It means that its value is the maximum value during a time window. If no new values are recorded for the time window length, the max is reset to 0 as a new time window starts.

source: https://docs.micrometer.io/micrometer/reference/concepts/timers.html

One of the reasons behind this is when the app starts, processing things (e.g.: http requests) is usually slower (lazy init, cache population, no JIT compilation, etc). So a "global maximum" would not be very useful. You can find the other reason using a time-window max in the docs at the same section I quoted above.

So let's say you also want to implement min and you might want to make it time-windowed. In this case, where should min decay to? And what should be the value if no recordings happened in a time-window?

But if your metrics backend supports histograms, you might be able to calculate the 0th percentile which should approximate min. (It is also possible doing this in a MeterRegistry, the Dynatrace V2 implementation in Micrometer does exactly this, see DynatraceExporterV2).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.