From 0db14e044c4fb47ba610ca7a43373084c47321e9 Mon Sep 17 00:00:00 2001 From: dhurley Date: Thu, 8 Sep 2022 16:57:51 +0100 Subject: [PATCH] Updated metrics logging for when a field isn't found in the access logs --- src/core/metrics/sources/nginx_access_log.go | 12 ++++++------ .../v2/src/core/metrics/sources/nginx_access_log.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/metrics/sources/nginx_access_log.go b/src/core/metrics/sources/nginx_access_log.go index f2d7b26e2..6bdc3efbf 100644 --- a/src/core/metrics/sources/nginx_access_log.go +++ b/src/core/metrics/sources/nginx_access_log.go @@ -173,32 +173,32 @@ func (c *NginxAccessLog) logStats(ctx context.Context, logFile, logFormat string n := "request.body_bytes_sent" counters[n] = float64(v) + counters[n] } else { - log.Warnf("Error getting body_bytes_sent value from access logs, %v", err) + log.Debugf("Error getting body_bytes_sent value from access logs, %v", err) } if v, err := strconv.Atoi(access.BytesSent); err == nil { n := "request.bytes_sent" counters[n] = float64(v) + counters[n] } else { - log.Warnf("Error getting bytes_sent value from access logs, %v", err) + log.Debugf("Error getting bytes_sent value from access logs, %v", err) } if v, err := strconv.Atoi(access.GzipRatio); err == nil { gzipRatios = append(gzipRatios, float64(v)) } else { - log.Warnf("Error getting gzip_ratio value from access logs, %v", err) + log.Debugf("Error getting gzip_ratio value from access logs, %v", err) } if v, err := strconv.Atoi(access.RequestLength); err == nil { requestLengths = append(requestLengths, float64(v)) } else { - log.Warnf("Error getting request_length value from access logs, %v", err) + log.Debugf("Error getting request_length value from access logs, %v", err) } if v, err := strconv.ParseFloat(access.RequestTime, 64); err == nil { requestTimes = append(requestTimes, v) } else { - log.Warnf("Error getting request_time value from access logs, %v", err) + log.Debugf("Error getting request_time value from access logs, %v", err) } if access.Request != "" { @@ -242,7 +242,7 @@ func (c *NginxAccessLog) logStats(ctx context.Context, logFile, logFormat string counters[n] = counters[n] + 1 } } else { - log.Warnf("Error getting status value from access logs, %v", err) + log.Debugf("Error getting status value from access logs, %v", err) } } mu.Unlock() diff --git a/test/performance/vendor/github.com/nginx/agent/v2/src/core/metrics/sources/nginx_access_log.go b/test/performance/vendor/github.com/nginx/agent/v2/src/core/metrics/sources/nginx_access_log.go index f2d7b26e2..6bdc3efbf 100644 --- a/test/performance/vendor/github.com/nginx/agent/v2/src/core/metrics/sources/nginx_access_log.go +++ b/test/performance/vendor/github.com/nginx/agent/v2/src/core/metrics/sources/nginx_access_log.go @@ -173,32 +173,32 @@ func (c *NginxAccessLog) logStats(ctx context.Context, logFile, logFormat string n := "request.body_bytes_sent" counters[n] = float64(v) + counters[n] } else { - log.Warnf("Error getting body_bytes_sent value from access logs, %v", err) + log.Debugf("Error getting body_bytes_sent value from access logs, %v", err) } if v, err := strconv.Atoi(access.BytesSent); err == nil { n := "request.bytes_sent" counters[n] = float64(v) + counters[n] } else { - log.Warnf("Error getting bytes_sent value from access logs, %v", err) + log.Debugf("Error getting bytes_sent value from access logs, %v", err) } if v, err := strconv.Atoi(access.GzipRatio); err == nil { gzipRatios = append(gzipRatios, float64(v)) } else { - log.Warnf("Error getting gzip_ratio value from access logs, %v", err) + log.Debugf("Error getting gzip_ratio value from access logs, %v", err) } if v, err := strconv.Atoi(access.RequestLength); err == nil { requestLengths = append(requestLengths, float64(v)) } else { - log.Warnf("Error getting request_length value from access logs, %v", err) + log.Debugf("Error getting request_length value from access logs, %v", err) } if v, err := strconv.ParseFloat(access.RequestTime, 64); err == nil { requestTimes = append(requestTimes, v) } else { - log.Warnf("Error getting request_time value from access logs, %v", err) + log.Debugf("Error getting request_time value from access logs, %v", err) } if access.Request != "" { @@ -242,7 +242,7 @@ func (c *NginxAccessLog) logStats(ctx context.Context, logFile, logFormat string counters[n] = counters[n] + 1 } } else { - log.Warnf("Error getting status value from access logs, %v", err) + log.Debugf("Error getting status value from access logs, %v", err) } } mu.Unlock()