Go Prometheus exporter – exporting data from your Go application

One of the best ways to track long-term changes to your application is to use time-series data to monitor and alert us about important changes. Prometheus (https://prometheus.io/) is a great way to perform this task. Prometheus is an open source time-series monitoring tool that utilizes a pull model via HTTP in order to drive monitoring and alerting. It is written in Go and has first-class client libraries for Go programs. The following steps show a very simple implementation of the Go Prometheus HTTP library:

  1. First, we instantiate our package and import our necessary libraries:
package mainimport (    "net/http"    "github.com/prometheus/client_golang/prometheus/promhttp")
  1. Then, ...

Get Hands-On High Performance with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.