eclipse / microprofile-conference

Microprofile.io Demo Code - Web Services Conference Application
http://microprofile.io/
Apache License 2.0
117 stars 116 forks source link

Add mpMetrics to Vote microservice #181

Closed realModusOperandi closed 6 years ago

realModusOperandi commented 6 years ago

This adds the mpMetrics-1.0 feature to the Liberty server and adds metrics to several example locations.

It uses a Timer through the @Timed annotation to measure the time each HashMapDAO method takes. It stores these values in a histogram so trends can be seen. It also uses a Counter through the @Counted annotation to count the number of times each REST endpoint has been requested since the server has started. In addition, a suite of base metrics about the server are collected by default.

The data collected by all of these metrics can be accessed from the /metrics endpoint, which is linked from the Votes page of the web application. By default, it is output in a format known to Prometheus; however, if the endpoint is requested with Accept: application/json in the header, JSON will be sent.

Emily-Jiang commented 6 years ago

Thanks @realModusOperandi !