Skip to content

Commit

Permalink
Add owner tag on partitions in burrow input (#4281)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkady-emelyanov authored and danielnelson committed Jun 13, 2018
1 parent 7557ad4 commit 2d9f9e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions plugins/inputs/burrow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Supported Burrow version: `1.x`
- group (string)
- topic (string)
- partition (int)
- owner (string)

* `burrow_topic`
- cluster (string)
Expand Down
2 changes: 2 additions & 0 deletions plugins/inputs/burrow/burrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ type (
Start apiStatusResponseLagItem `json:"start"`
End apiStatusResponseLagItem `json:"end"`
CurrentLag int64 `json:"current_lag"`
Owner string `json:"owner"`
}

// response: lag field item
Expand Down Expand Up @@ -447,6 +448,7 @@ func (b *burrow) genGroupLagMetrics(r *apiResponse, cluster, group string, acc t
"group": group,
"topic": partition.Topic,
"partition": strconv.FormatInt(int64(partition.Partition), 10),
"owner": partition.Owner,
},
)
}
Expand Down
6 changes: 3 additions & 3 deletions plugins/inputs/burrow/burrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ func TestBurrowPartition(t *testing.T) {
},
}
tags := []map[string]string{
{"cluster": "clustername1", "group": "group1", "topic": "topicA", "partition": "0"},
{"cluster": "clustername1", "group": "group1", "topic": "topicA", "partition": "1"},
{"cluster": "clustername1", "group": "group1", "topic": "topicA", "partition": "2"},
{"cluster": "clustername1", "group": "group1", "topic": "topicA", "partition": "0", "owner": "kafka1"},
{"cluster": "clustername1", "group": "group1", "topic": "topicA", "partition": "1", "owner": "kafka2"},
{"cluster": "clustername1", "group": "group1", "topic": "topicA", "partition": "2", "owner": "kafka3"},
}

require.Empty(t, acc.Errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"topic": "topicA",
"partition": 0,
"owner": "kafka",
"owner": "kafka1",
"status": "OK",
"start": {
"offset": 431323195,
Expand All @@ -28,7 +28,7 @@
{
"topic": "topicA",
"partition": 1,
"owner": "kafka",
"owner": "kafka2",
"status": "OK",
"start": {
"offset": 431322962,
Expand All @@ -46,7 +46,7 @@
{
"topic": "topicA",
"partition": 2,
"owner": "kafka",
"owner": "kafka3",
"status": "OK",
"start": {
"offset": 428636563,
Expand Down

0 comments on commit 2d9f9e3

Please sign in to comment.