Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated metrics logging for when a field isn't found in the access logs #39

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.