Skip to content

Commit

Permalink
Updated metrics logging for when a field isn't found in the access lo…
Browse files Browse the repository at this point in the history
…gs (#39)
  • Loading branch information
dhurley authored Sep 9, 2022
1 parent 470dc53 commit 84815d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/core/metrics/sources/nginx_access_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down Expand Up @@ -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()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 84815d6

Please sign in to comment.