Skip to content

Commit

Permalink
Merge branch 'main' into dependabot-auto-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
oseoin authored Jun 20, 2024
2 parents fe40c37 + 9f7634f commit dc91f67
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmd/nginx-ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,14 @@ func createPlusAndLatencyCollectors(
streamServerZoneVariableLabels := []string{"resource_type", "resource_name", "resource_namespace"}
variableLabelNames := nginxCollector.NewVariableLabelNames(upstreamServerVariableLabels, serverZoneVariableLabels, upstreamServerPeerVariableLabelNames,
streamUpstreamServerVariableLabels, streamServerZoneVariableLabels, streamUpstreamServerPeerVariableLabelNames, nil, nil)
promlogConfig := &promlog.Config{}
infoLevel := new(promlog.AllowedLevel)
err := infoLevel.Set("info")
if err != nil {
glog.Error("Error setting prometheus exporter log level")
}
promlogConfig := &promlog.Config{
Level: infoLevel,
}
logger := promlog.New(promlogConfig)
plusCollector = nginxCollector.NewNginxPlusCollector(plusClient, "nginx_ingress_nginxplus", variableLabelNames, constLabels, logger)
go metrics.RunPrometheusListenerForNginxPlus(*prometheusMetricsListenPort, plusCollector, registry, prometheusSecret)
Expand Down
10 changes: 9 additions & 1 deletion internal/metrics/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ func NewNginxMetricsClient(httpClient *http.Client) *prometheusClient.NginxClien

// RunPrometheusListenerForNginx runs an http server to expose Prometheus metrics for NGINX
func RunPrometheusListenerForNginx(port int, client *prometheusClient.NginxClient, registry *prometheus.Registry, constLabels map[string]string, prometheusSecret *v1.Secret) {
promlogConfig := &promlog.Config{}
infoLevel := new(promlog.AllowedLevel)
err := infoLevel.Set("info")
if err != nil {
glog.Error("Error setting prometheus exporter log level")
}
promlogConfig := &promlog.Config{
Level: infoLevel,
}

logger := promlog.New(promlogConfig)
registry.MustRegister(nginxCollector.NewNginxCollector(client, "nginx_ingress_nginx", constLabels, logger))
runServer(strconv.Itoa(port), registry, prometheusSecret)
Expand Down

0 comments on commit dc91f67

Please sign in to comment.