Skip to content

Commit

Permalink
bytes_read may be nil.
Browse files Browse the repository at this point in the history
  • Loading branch information
jum committed May 12, 2024
1 parent c55a6e2 commit 7824782
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ngcplogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ func (l *nGCPLogger) extractCaddyFromPayload(m map[string]any, entry *logging.En
RawPath: v["uri"].(string),
Path: v["uri"].(string),
}
hr.RequestSize = int64(m["bytes_read"].(float64))
if t, ok := m["bytes_read"]; ok {
hr.RequestSize = int64(t.(float64))
}
hr.Status = int(m["status"].(float64))
hr.ResponseSize = int64(m["size"].(float64))
hr.Latency = time.Duration(m["duration"].(float64) * float64(time.Second))
Expand Down

0 comments on commit 7824782

Please sign in to comment.