Skip to content

Commit e615a36

Browse files
committed
Update README
1 parent 541e7da commit e615a36

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This demo app shows how a Spring Boot application can expose a Prometheus metrics endpoint for scraping.
44

5+
- For Java 11+
6+
57
🚼 The app was initially created with [Spring Initializr][init] and then by following the [RESTful service tutorial on spring.io][rest-tutorial].
68

79
## To run
@@ -26,6 +28,15 @@ This will expose Prometheus metrics at `/actuator/prometheus`. This is a simple
2628
tomcat_sessions_alive_max_seconds 0.0
2729
...
2830

31+
Next, try accessing the API in the app at `http://localhost:8080/greeting` either in a web browser or using `curl`. Check the `/actuator/prometheus` endpoint again. You should see the `http_server_requests_seconds_sum` metric increase. You will also see a new metric `greeting_time_seconds` which is a custom metric added to the app:
32+
33+
$ curl http://localhost:8080/actuator/prometheus | grep greeting_time_seconds
34+
# HELP greeting_time_seconds Time taken to return greeting
35+
# TYPE greeting_time_seconds summary
36+
greeting_time_seconds{class="com.tutorialworks.demos.springbootwithmetrics.GreetingController",exception="none",method="greeting",quantile="0.5",} 0.0
37+
greeting_time_seconds{class="com.tutorialworks.demos.springbootwithmetrics.GreetingController",exception="none",method="greeting",quantile="0.9",} 0.0
38+
...
39+
2940
## Timing a custom method
3041

3142
The method in the application which responds to the REST request has been annotated with `@Timed`, so Micrometer will capture the execution time of this method:

0 commit comments

Comments
 (0)