Add a flag to make per-host metrics optional

When serving many hosts from one nginx, the metrics may become too
numerous for Prometheus.  Add a flag to disable the host label, so
that metrics are totalled across all hosts.
This commit is contained in:
Bryan Boreham 2018-12-21 17:10:28 +00:00 committed by Bryan Boreham
parent 63b01370e4
commit f33a2090dd
6 changed files with 23 additions and 9 deletions

View file

@ -288,7 +288,7 @@ func TestCollector(t *testing.T) {
t.Run(c.name, func(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
sc, err := NewSocketCollector("pod", "default", "ingress")
sc, err := NewSocketCollector("pod", "default", "ingress", true)
if err != nil {
t.Errorf("%v: unexpected error creating new SocketCollector: %v", c.name, err)
}