changes.mady.by.user Sansae
Saved on May 04, 2021
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-stater-actuator</artifactId> </dependency> <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-core</artifactId> </dependency> <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> </dependency>
... import io.micrometer.core.instrument.Metrics; ... private Counter runCounter = Mitrics.counter("runCounter"); ... @GetMapping("/api/demo") @Timed public String apiUse() throws InterruptedException { runCounter.increment(); log.info("Hello world app accessed on /api/demo"); return "Hello world"; }