Recommended way to measure http requests

Viewed 343

From the OTel Metrics specification Counter is the recommended instrument to measure the number of requests completed. This can later be used to calculate the throughput rate.

Example uses for Counter:

  • count the number of bytes received
  • count the number of requests completed

However, OTel's semantic conventions do not include a metric for such a use case, with http.server.active_requests being the closest thing.

Name Instrument Unit Unit (UCUM) Description
http.server.active_requests Asynchronous UpDownCounter requests {requests} measures the number of concurrent HTTP requests that are currently in-flight

Granted, the Metrics Semantic Conventions are still "Experimental", but this seems like such a basic use case which is even mentioned in the API spec.

My questions are:

  • Is the counting of requests via a counter not recommended?
  • What is the best way to monitor throughput?

Thanks in advance.

1 Answers

Not a spec creator but the number of requests is indeed a typical example for counters and is therefore recommended ubiquitously, e.g. check Prometheus docs.

Why is it not stated in the semantic conventions spec - hard to say. But yes it is very experimental, there are 400+ issues in the whole thing and you may create another one :)

Related