title: measure requests per second with micrometer, spring boot and prometheus
body: <p>I'm updating a microservice to spring boot 2 and migrating metrics from dropwizard to micrometer. We are using prometheus to store metrics and grafana to display them. I want to measure requests per second to all URLs. Micrometer documentation states that:</p>
  
  <pre><code>Timers are intended for measuring short-duration latencies, and the frequency of such events.
  </code></pre>
  
  <p>So timers seem to be the way to do the job:</p>
  
  <pre class="lang-java prettyprint-override"><code>                Timer.Sample sample = log ? Timer.start(registry)
                  //...code which executes request...
                  List&lt;Tag&gt; tags = Arrays.asList(
                          Tag.of("status", status),
                          Tag.of("uri", uri),
                          Tag.of("method", request.getMethod()));
                  Timer timer = Timer.builder(TIMER_REST)
                          .tags(tags)
                          .publishPercentiles(0.95, 0.99)
                         .distributionStatisticExpiry(Duration.ofSeconds(30))
                          .register(registry);
                  sample.stop(timer);
  </code></pre>
  
  <p>but it doesn't produce any rate per second, instead we have metrics similar to:</p>
  
  <pre><code># TYPE timer_rest_seconds summary
  timer_rest_seconds{method="GET",status="200",uri="/test",quantile="0.95",} 0.620756992
  timer_rest_seconds{method="GET",status="200",uri="/test",quantile="0.99",} 0.620756992
  timer_rest_seconds_count{method="GET",status="200",uri="/test",} 7.0
  timer_rest_seconds_sum{method="GET",status="200",uri="/test",} 3.656080641
  # HELP timer_rest_seconds_max  
  # TYPE timer_rest_seconds_max gauge
  timer_rest_seconds_max{method="GET",status="200",uri="/test",} 0.605290436
  </code></pre>
  
  <p>what would be the proper way to solve this? Should the rate per second be calculated via prometheus queries or returned via spring actuator endpoint?</p>