First things first. So, let’s install the finagle-metrics locally. To do that, just run:
After that you should see something like this output:
Okay, the finagle-metris is now installed locally, so from now on we can add it as a dependency to our finagle application.
We need to create some folders and files, so let’s do that:
Then I’m going to add the following content to build.sbt:
And finally, let’s create our finagle application. I’m gonna add the following content to /src/main/scala/App.scala:
Note that I used the ConsoleReporter to report the Codahale’s metrics to the console every five seconds.
Also, note that I didn’t need to do anything related to the finagle-metrics, I just needed to define a location (Reporter) to where the Codahale metrics will be sent, but the metrics themselves were sent automatically (Thanks Finagle for that). :)
To run our example, just execute the following command and wait a few seconds to see the metrics being displayed on the console:
Click here to see more about the finagle-metrics library.