Skip to content

Commit

Permalink
Fixed a bug in AddRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielLavie committed Jun 23, 2024
1 parent 71988b4 commit 03018f0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/network/protocols/kafka/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ func (r *RequestStats) AddRequest(errorCode int8, count int, staticTags uint64)
if !isValidKafkaErrorCode(errorCode) {
return
}
stats, exists := r.ErrorCodeToStat[errorCode]
if !exists {
stats = &RequestStat{}
r.ErrorCodeToStat[errorCode] = stats
if stats, exists := r.ErrorCodeToStat[errorCode]; exists {
stats.Count += count
stats.StaticTags |= staticTags
} else {
r.ErrorCodeToStat[errorCode] = &RequestStat{
Count: count,
StaticTags: staticTags,
}
}
stats.Count += count
stats.StaticTags |= staticTags
}

func isValidKafkaErrorCode(errorCode int8) bool {
Expand Down

0 comments on commit 03018f0

Please sign in to comment.