In addition to general information about your app, it can be helpful to emit metrics that are app-specific. For example, we might want to collect timing data or keep track of the number of times an event occurs.
This recipe will use the github.com/rcrowley/go-metrics package to collect metrics and expose them via an endpoint. There are various exporter tools that you can use to export metrics to places such as Prometheus and InfluxDB, which are also written in Go.
Getting ready
Configure your environment according to these steps:
- Refer to the Technical requirements section in this chapter for steps to configure your environment.
- Run the go get github.com/rcrowley/go-metrics command.
How to do it...
These steps cover writing and running your application:
- From your Terminal or console application,createa new directory called~/projects/go-programming-cookbook/chapter11...