Skip to content

Commit

Permalink
switch from warning to debug when upstream labels are empty (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdabelf5 authored May 29, 2024
1 parent 15b84c1 commit d3f9f94
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions collector/nginx_plus.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
varLabelValues := c.getServerZoneLabelValues(name)

if c.variableLabelNames.ServerZoneVariableLabelNames != nil && len(varLabelValues) != len(c.variableLabelNames.ServerZoneVariableLabelNames) {
level.Warn(c.logger).Log("msg", "wrong number of labels for http zone, empty labels will be used instead", "zone", name, "expected", len(c.variableLabelNames.ServerZoneVariableLabelNames), "got", len(varLabelValues))
level.Debug(c.logger).Log("msg", "wrong number of labels for http zone, empty labels will be used instead", "zone", name, "expected", len(c.variableLabelNames.ServerZoneVariableLabelNames), "got", len(varLabelValues))
for range c.variableLabelNames.ServerZoneVariableLabelNames {
labelValues = append(labelValues, "")
}
Expand Down Expand Up @@ -798,7 +798,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
varLabelValues := c.getStreamServerZoneLabelValues(name)

if c.variableLabelNames.StreamServerZoneVariableLabelNames != nil && len(varLabelValues) != len(c.variableLabelNames.StreamServerZoneVariableLabelNames) {
level.Warn(c.logger).Log("msg", "wrong number of labels for stream server zone, empty labels will be used instead", "zone", name, "expected", len(c.variableLabelNames.StreamServerZoneVariableLabelNames), "got", len(varLabelValues))
level.Debug(c.logger).Log("msg", "wrong number of labels for stream server zone, empty labels will be used instead", "zone", name, "expected", len(c.variableLabelNames.StreamServerZoneVariableLabelNames), "got", len(varLabelValues))
for range c.variableLabelNames.StreamServerZoneVariableLabelNames {
labelValues = append(labelValues, "")
}
Expand Down Expand Up @@ -835,7 +835,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
varLabelValues := c.getUpstreamServerLabelValues(name)

if c.variableLabelNames.UpstreamServerVariableLabelNames != nil && len(varLabelValues) != len(c.variableLabelNames.UpstreamServerVariableLabelNames) {
level.Warn(c.logger).Log("msg", "wrong number of labels for upstream, empty labels will be used instead", "upstream", name, "expected", len(c.variableLabelNames.UpstreamServerVariableLabelNames), "got", len(varLabelValues))
level.Debug(c.logger).Log("msg", "wrong number of labels for upstream, empty labels will be used instead", "upstream", name, "expected", len(c.variableLabelNames.UpstreamServerVariableLabelNames), "got", len(varLabelValues))
for range c.variableLabelNames.UpstreamServerVariableLabelNames {
labelValues = append(labelValues, "")
}
Expand All @@ -846,7 +846,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
upstreamServer := fmt.Sprintf("%v/%v", name, peer.Server)
varPeerLabelValues := c.getUpstreamServerPeerLabelValues(upstreamServer)
if c.variableLabelNames.UpstreamServerPeerVariableLabelNames != nil && len(varPeerLabelValues) != len(c.variableLabelNames.UpstreamServerPeerVariableLabelNames) {
level.Warn(c.logger).Log("msg", "wrong number of labels for upstream peer, empty labels will be used instead", "upstream", name, "peer", peer.Server, "expected", len(c.variableLabelNames.UpstreamServerPeerVariableLabelNames), "got", len(varPeerLabelValues))
level.Debug(c.logger).Log("msg", "wrong number of labels for upstream peer, empty labels will be used instead", "upstream", name, "peer", peer.Server, "expected", len(c.variableLabelNames.UpstreamServerPeerVariableLabelNames), "got", len(varPeerLabelValues))
for range c.variableLabelNames.UpstreamServerPeerVariableLabelNames {
labelValues = append(labelValues, "")
}
Expand Down Expand Up @@ -992,7 +992,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
varLabelValues := c.getStreamUpstreamServerLabelValues(name)

if c.variableLabelNames.StreamUpstreamServerVariableLabelNames != nil && len(varLabelValues) != len(c.variableLabelNames.StreamUpstreamServerVariableLabelNames) {
level.Warn(c.logger).Log("msg", "wrong number of labels for stream server, empty labels will be used instead", "server", name, "labels", c.variableLabelNames.StreamUpstreamServerVariableLabelNames, "values", varLabelValues)
level.Debug(c.logger).Log("msg", "wrong number of labels for stream server, empty labels will be used instead", "server", name, "labels", c.variableLabelNames.StreamUpstreamServerVariableLabelNames, "values", varLabelValues)
for range c.variableLabelNames.StreamUpstreamServerVariableLabelNames {
labelValues = append(labelValues, "")
}
Expand All @@ -1003,7 +1003,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
upstreamServer := fmt.Sprintf("%v/%v", name, peer.Server)
varPeerLabelValues := c.getStreamUpstreamServerPeerLabelValues(upstreamServer)
if c.variableLabelNames.StreamUpstreamServerPeerVariableLabelNames != nil && len(varPeerLabelValues) != len(c.variableLabelNames.StreamUpstreamServerPeerVariableLabelNames) {
level.Warn(c.logger).Log("msg", "wrong number of labels for stream upstream peer, empty labels will be used instead", "server", upstreamServer, "labels", c.variableLabelNames.StreamUpstreamServerPeerVariableLabelNames, "values", varPeerLabelValues)
level.Debug(c.logger).Log("msg", "wrong number of labels for stream upstream peer, empty labels will be used instead", "server", upstreamServer, "labels", c.variableLabelNames.StreamUpstreamServerPeerVariableLabelNames, "values", varPeerLabelValues)
for range c.variableLabelNames.StreamUpstreamServerPeerVariableLabelNames {
labelValues = append(labelValues, "")
}
Expand Down Expand Up @@ -1255,7 +1255,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
varLabelValues := c.getWorkerLabelValues(strconv.FormatInt(int64(worker.ID), 10))

if c.variableLabelNames.WorkerPIDVariableLabelNames != nil && len(varLabelValues) != len(c.variableLabelNames.WorkerPIDVariableLabelNames) {
level.Warn(c.logger).Log("wrong number of labels for worker %v. For labels %v, got values: %v. Empty labels will be used instead",
level.Debug(c.logger).Log("wrong number of labels for worker %v. For labels %v, got values: %v. Empty labels will be used instead",
strconv.FormatInt(int64(worker.ID), 10), c.variableLabelNames.WorkerPIDVariableLabelNames, varLabelValues)
for range c.variableLabelNames.WorkerPIDVariableLabelNames {
labelValues = append(labelValues, "")
Expand Down

0 comments on commit d3f9f94

Please sign in to comment.