December 2017
Intermediate to advanced
404 pages
9h 28m
English
Of course, you can also use the Prometheus client library to export your own metrics. These do not need to be technical metrics that reflect some aspect of the Go runtime (such as CPU usage and memory allocation), but it could also be business metrics. One possible example could be the amount of booked tickets with different labels per event.
For example, within the todo.com/myevents/bookingservice/rest package, you could add a new file—let's call it metrics.go—that declares and registers a new Prometheus metrics:
package rest import "github.com/prometheus/client_golang/prometheus" var bookingCount = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "bookings_count", Namespace: "myevents", Help: "Amount of booked ...Read now
Unlock full access