Skip to content

Commit

Permalink
Fix burrow_group.offset calculation for Burrow plugin (#4584)
Browse files Browse the repository at this point in the history
(cherry picked from commit 16a6fed)
  • Loading branch information
rbrendler authored and danielnelson committed Aug 23, 2018
1 parent 3767761 commit 8f5cb78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 4 additions & 2 deletions plugins/inputs/burrow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Supported Burrow version: `1.x`
# insecure_skip_verify = false
```

### Partition Status mappings
### Group/Partition Status mappings

* `OK` = 1
* `NOT_FOUND` = 2
Expand All @@ -66,9 +66,11 @@ Supported Burrow version: `1.x`
* `burrow_group` (one event per each consumer group)
- status (string, see Partition Status mappings)
- status_code (int, `1..6`, see Partition status mappings)
- parition_count (int, `number of partitions`)
- partition_count (int, `number of partitions`)
- offset (int64, `total offset of all partitions`)
- total_lag (int64, `totallag`)
- lag (int64, `maxlag.current_lag || 0`)
- timestamp (int64, `end.timestamp`)

* `burrow_partition` (one event per each topic partition)
- status (string, see Partition Status mappings)
Expand Down
6 changes: 2 additions & 4 deletions plugins/inputs/burrow/burrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,11 @@ func (b *burrow) genGroupStatusMetrics(r *apiResponse, cluster, group string, ac
partitionCount = len(r.Status.Partitions)
}

// get max timestamp and offset from partitions list
// get max timestamp and total offset from partitions list
offset := int64(0)
timestamp := int64(0)
for _, partition := range r.Status.Partitions {
if partition.End.Offset > offset {
offset = partition.End.Offset
}
offset += partition.End.Offset
if partition.End.Timestamp > timestamp {
timestamp = partition.End.Timestamp
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/burrow/burrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestBurrowGroup(t *testing.T) {
"partition_count": 3,
"total_lag": int64(0),
"lag": int64(0),
"offset": int64(431323195),
"offset": int64(431323195 + 431322962 + 428636563),
"timestamp": int64(1515609490008),
},
}
Expand Down

0 comments on commit 8f5cb78

Please sign in to comment.