When compared with counters and gauges, histograms are much more complex. That does not mean that they are harder to implement but that the data they provide is less simple when compared with the other metric types we explored. We'll comment on them by studying a sample code and the output it provides.
We'll switch from the vfarcic/docker-flow-swarm-listener (https://github.com/vfarcic/docker-flow-swarm-listener) repository to vfarcic/go-demo (https://github.com/vfarcic/go-demo) since it provides a simple example of a histogram.
Just as with the other types of metrics, histogram also needs to be declared as a variable of the particular type:
var (
histogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Subsystem: "http_server",
Name: "resp_time",
Help: "Request...