Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stats.Bytes() #999

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kafka/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ func (e Stats) String() string {
return e.statsJSON
}

func (e Stats) Bytes() []byte {
return []byte(e.statsJSON)
}

// AssignedPartitions consumer group rebalance event: assigned partition set
type AssignedPartitions struct {
Partitions []TopicPartition
Expand Down
2 changes: 1 addition & 1 deletion kafka/stats_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func handleStatsEvent(t *testing.T, eventCh chan Event, statsReceived chan bool)

// test if the stats string can be decoded into JSON
var raw map[string]interface{}
err := json.Unmarshal([]byte(e.String()), &raw) // convert json to map
err := json.Unmarshal(e.Bytes(), &raw) // convert json to map
if err != nil {
t.Fatalf("json unmarshall error: %s", err)
}
Expand Down