title: how to show the number of calls per minute on grafana using micrometer
body: <p>I have a simple Spring Boot application. I want to monitor application metrics using grafana and prometheus. To do this, I added the actuator and micrometer-registry-prometheus to the application</p>
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;io.micrometer&lt;/groupId&gt;
              &lt;artifactId&gt;micrometer-registry-prometheus&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
  </code></pre>
  <p>I have written two methods for counter and timer</p>
  <pre><code>@Service
  public class MicrometerServiceImpl implements MicrometerService {
      @Autowired
      private MeterRegistry meterRegistry;
      @Override
      public void addCounterMetric(String statName, String description, double count, String... tags){
          Counter.builder(statName)
                  .description(description)
                  .tags(tags)
                  .register(meterRegistry)
                  .increment(count);
      }
      @Override
      public void addTimerMetric(String statName, String description, long duration, String... tags){
          Timer.builder(statName)
                  .description(description)
                  .tags(tags)
                  .register(meterRegistry)
                  .record(duration, TimeUnit.MILLISECONDS);
      }
  }
  </code></pre>
  <p>And added a method call to the controller</p>
  <pre><code>    @RequestMapping(path = &quot;/addMetric&quot;)
      public String callMetric(HttpServletRequest request) {
          long start = System.currentTimeMillis();
          //some work
          
          micrometerService.addCounterMetric(&quot;CONTROLLER_COUNTER&quot;, &quot;controller with COUNTER&quot;, 1);
          micrometerService.addTimerMetric(&quot;CONTROLLER_TIMER&quot;, &quot;controller with Timer&quot;,
                 System.currentTimeMillis() - start);
  
          return &quot;addMetric&quot;;
      }
  </code></pre>
  <p>I would like the counter value to be reset to zero every minute, that is, the number of calls per minute is counted. Is it possible to do this using micrometer or grafana? Now I see that the counter is only increasing.</p>
  <p>I know there are metrics that count the number of http requests. But I need this for custom metrics, when the metric is considered under certain conditions (for example, the number of errors during processing)</p>