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:
parent
63b01370e4
commit
f33a2090dd
6 changed files with 23 additions and 9 deletions
|
|
@ -59,7 +59,7 @@ type collector struct {
|
|||
}
|
||||
|
||||
// NewCollector creates a new metric collector the for ingress controller
|
||||
func NewCollector(statusPort int, registry *prometheus.Registry) (Collector, error) {
|
||||
func NewCollector(statusPort int, metricsPerHost bool, registry *prometheus.Registry) (Collector, error) {
|
||||
podNamespace := os.Getenv("POD_NAMESPACE")
|
||||
if podNamespace == "" {
|
||||
podNamespace = "default"
|
||||
|
|
@ -77,7 +77,7 @@ func NewCollector(statusPort int, registry *prometheus.Registry) (Collector, err
|
|||
return nil, err
|
||||
}
|
||||
|
||||
s, err := collectors.NewSocketCollector(podName, podNamespace, class.IngressClass)
|
||||
s, err := collectors.NewSocketCollector(podName, podNamespace, class.IngressClass, metricsPerHost)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue