Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
xichen2020 committed Mar 16, 2019
1 parent d5bd83c commit de48140
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
15 changes: 12 additions & 3 deletions storage/flush_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"sync"

"github.com/uber-go/tally"
indexfield "github.com/xichen2020/eventdb/index/field"
"github.com/xichen2020/eventdb/index/segment"
"github.com/xichen2020/eventdb/persist"
Expand All @@ -13,6 +12,7 @@ import (
xerrors "github.com/m3db/m3x/errors"
"github.com/m3db/m3x/instrument"
xlog "github.com/m3db/m3x/log"
"github.com/uber-go/tally"
)

type segmentPayload struct {
Expand Down Expand Up @@ -48,12 +48,19 @@ var (
)

type flushManagerMetrics struct {
flush instrument.MethodMetrics
flush instrument.MethodMetrics
enqueueSuccess tally.Counter
enqueueFullQueueErrors tally.Counter
}

func newFlushManagerMetrics(scope tally.Scope) flushManagerMetrics {
enqueueScope := scope.Tagged(map[string]string{"action": "enqueue"})
return flushManagerMetrics{
flush: instrument.NewMethodMetrics(scope, "flush", 1.0),
flush: instrument.NewMethodMetrics(scope, "flush", 1.0),
enqueueSuccess: enqueueScope.Counter("success"),
enqueueFullQueueErrors: enqueueScope.Tagged(map[string]string{
"reason": "full-queue",
}).Counter("errors"),
}
}

Expand Down Expand Up @@ -112,7 +119,9 @@ func (m *flushManager) Enqueue(p *segmentPayload) error {
}
select {
case m.unflushed <- p:
m.metrics.enqueueSuccess.Inc(1)
default:
m.metrics.enqueueFullQueueErrors.Inc(1)
return errFlushManagerFlushQueueFull
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions values/decoding/bit_stream_int_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type bitStreamIntIterator struct {

func newBitStreamIntIterator(
reader xio.Reader,
bitsPerEncodedValue int, // Number of bits per encoded value
numEncodedValues int, // Number of encoded values
bitsPerEncodedValue int,
numEncodedValues int,
) *bitStreamIntIterator {
return &bitStreamIntIterator{
bitReader: bitstream.NewReader(reader),
Expand Down
2 changes: 1 addition & 1 deletion values/decoding/fs_bool_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (v *fsBasedBoolValues) Filter(
return nil, errNilFilterValue
}
if filterValue.Type != field.BoolType {
return nil, fmt.Errorf("bool values filter expect bool filter value type but got %v filter value type", filterValue.Type)
return nil, fmt.Errorf("bool values filter expects bool filter value type but got %v filter value type", filterValue.Type)
}
if !op.BoolIsInRange(int(v.metaProto.NumTrues), int(v.metaProto.NumFalses), filterValue.BoolVal) {
return impl.NewEmptyPositionIterator(), nil
Expand Down
2 changes: 1 addition & 1 deletion values/decoding/fs_bytes_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (v *fsBasedBytesValues) Filter(
return nil, errNilFilterValue
}
if filterValue.Type != field.BytesType {
return nil, fmt.Errorf("bytes values filter expect bytes filter value type but got %v filter value type", filterValue.Type)
return nil, fmt.Errorf("bytes values filter expects bytes filter value type but got %v filter value type", filterValue.Type)
}
if !op.BytesMaybeInRange(v.metaProto.MinValue, v.metaProto.MaxValue, filterValue.BytesVal.Bytes()) {
return impl.NewEmptyPositionIterator(), nil
Expand Down
2 changes: 1 addition & 1 deletion values/decoding/fs_double_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (v *fsBasedDoubleValues) Filter(
case field.IntType:
filterVal = float64(filterValue.IntVal)
default:
return nil, fmt.Errorf("double values filter expect double or int filter value type but got %v filter value type", filterValue.Type)
return nil, fmt.Errorf("double values filter expects double or int filter value type but got %v filter value type", filterValue.Type)
}
if !op.DoubleMaybeInRange(v.metaProto.MinValue, v.metaProto.MaxValue, filterVal) {
return impl.NewEmptyPositionIterator(), nil
Expand Down
2 changes: 1 addition & 1 deletion values/decoding/fs_int_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (v *fsBasedIntValues) Filter(
intVal = filterValue.IntVal
maybeInRange = op.IntMaybeInRange(int(v.metaProto.MinValue), int(v.metaProto.MaxValue), filterValue.IntVal)
default:
return nil, fmt.Errorf("double values filter expect double or int filter value type but got %v filter value type", filterValue.Type)
return nil, fmt.Errorf("int values filter expects double or int filter value type but got %v filter value type", filterValue.Type)
}
if !maybeInRange {
return impl.NewEmptyPositionIterator(), nil
Expand Down
2 changes: 1 addition & 1 deletion values/decoding/fs_time_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (v *fsBasedTimeValues) Filter(
return nil, errNilFilterValue
}
if filterValue.Type != field.TimeType {
return nil, fmt.Errorf("time values filter expect time filter value type but got %v filter value type", filterValue.Type)
return nil, fmt.Errorf("time values filter expects time filter value type but got %v filter value type", filterValue.Type)
}
if !op.TimeMaybeInRange(v.metaProto.MinValue, v.metaProto.MaxValue, filterValue.TimeNanosVal) {
return impl.NewEmptyPositionIterator(), nil
Expand Down

0 comments on commit de48140

Please sign in to comment.