Fix burrow_group.offset calculation for Burrow plugin (#4584)

This commit is contained in:
rbrendler 2018-08-23 15:30:59 -05:00 committed by Daniel Nelson
parent 36959abce9
commit 16a6feda4a
3 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ Supported Burrow version: `1.x`
# insecure_skip_verify = false # insecure_skip_verify = false
``` ```
### Partition Status mappings ### Group/Partition Status mappings
* `OK` = 1 * `OK` = 1
* `NOT_FOUND` = 2 * `NOT_FOUND` = 2
@ -66,9 +66,11 @@ Supported Burrow version: `1.x`
* `burrow_group` (one event per each consumer group) * `burrow_group` (one event per each consumer group)
- status (string, see Partition Status mappings) - status (string, see Partition Status mappings)
- status_code (int, `1..6`, 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`) - total_lag (int64, `totallag`)
- lag (int64, `maxlag.current_lag || 0`) - lag (int64, `maxlag.current_lag || 0`)
- timestamp (int64, `end.timestamp`)
* `burrow_partition` (one event per each topic partition) * `burrow_partition` (one event per each topic partition)
- status (string, see Partition Status mappings) - status (string, see Partition Status mappings)

View File

@ -397,13 +397,11 @@ func (b *burrow) genGroupStatusMetrics(r *apiResponse, cluster, group string, ac
partitionCount = len(r.Status.Partitions) 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) offset := int64(0)
timestamp := int64(0) timestamp := int64(0)
for _, partition := range r.Status.Partitions { for _, partition := range r.Status.Partitions {
if partition.End.Offset > offset { offset += partition.End.Offset
offset = partition.End.Offset
}
if partition.End.Timestamp > timestamp { if partition.End.Timestamp > timestamp {
timestamp = partition.End.Timestamp timestamp = partition.End.Timestamp
} }

View File

@ -160,7 +160,7 @@ func TestBurrowGroup(t *testing.T) {
"partition_count": 3, "partition_count": 3,
"total_lag": int64(0), "total_lag": int64(0),
"lag": int64(0), "lag": int64(0),
"offset": int64(431323195), "offset": int64(431323195 + 431322962 + 428636563),
"timestamp": int64(1515609490008), "timestamp": int64(1515609490008),
}, },
} }