Skip to content

Commit

Permalink
Fix prometheus metric duplication panic (#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
yancl authored and black-adder committed Aug 13, 2018
1 parent b088909 commit c77bb1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/ingester/app/consumer/offset/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func NewManager(minOffset int64, markOffset MarkOffset, partition int32, factory
return &Manager{
markOffsetFunction: markOffset,
close: make(chan struct{}),
offsetCommitCount: factory.Counter("offset-commit", map[string]string{"partition": strconv.Itoa(int(partition))}),
lastCommittedOffset: factory.Gauge("offset-commit", map[string]string{"partition": strconv.Itoa(int(partition))}),
offsetCommitCount: factory.Counter("offset-commits-total", map[string]string{"partition": strconv.Itoa(int(partition))}),
lastCommittedOffset: factory.Gauge("last-committed-offset", map[string]string{"partition": strconv.Itoa(int(partition))}),
list: newConcurrentList(minOffset),
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/ingester/app/consumer/offset/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ func TestHandleReset(t *testing.T) {

assert.Equal(t, offset, captureOffset)
cnt, g := m.Snapshot()
assert.Equal(t, int64(1), cnt["offset-commit|partition=1"])
assert.Equal(t, int64(offset), g["offset-commit|partition=1"])
assert.Equal(t, int64(1), cnt["offset-commits-total|partition=1"])
assert.Equal(t, int64(offset), g["last-committed-offset|partition=1"])
}

0 comments on commit c77bb1d

Please sign in to comment.