Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
Siyu Yang committed Apr 14, 2020
1 parent 7fb024c commit 158cd13
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/aggregator/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func (agg *aggregator) AddPassthrough(

if agg.electionManager.ElectionState() == FollowerState {
agg.metrics.addPassthrough.ReportFollowerNoop()
agg.metrics.addPassthrough.ReportSuccess(agg.nowFn().Sub(callStart))
return nil
}

Expand Down
1 change: 1 addition & 0 deletions src/aggregator/aggregator/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ func NewOptions() Options {
shardFn: sharding.Murmur32Hash.MustShardFn(),
bufferDurationBeforeShardCutover: defaultBufferDurationBeforeShardCutover,
bufferDurationAfterShardCutoff: defaultBufferDurationAfterShardCutoff,
passthroughWriter: writer.NewBlackholeWriter(),
entryTTL: defaultEntryTTL,
entryCheckInterval: defaultEntryCheckInterval,
entryCheckBatchPercent: defaultEntryCheckBatchPercent,
Expand Down
17 changes: 16 additions & 1 deletion src/aggregator/integration/one_client_passthru_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package integration

import (
"reflect"
"sort"
"sync"
"testing"
Expand Down Expand Up @@ -140,7 +141,7 @@ func TestOneClientPassthroughMetrics(t *testing.T) {
// Validate results.
expected := computeExpectedPassthroughResults(t, dataset)
actual := testServer.sortedResults()
require.Equal(t, expected, actual)
require.Equal(t, dedupResults(expected), dedupResults(actual))
}

func computeExpectedPassthroughResults(
Expand All @@ -166,3 +167,17 @@ func computeExpectedPassthroughResults(
sort.Sort(byTimeIDPolicyAscending(expected))
return expected
}

func dedupResults(
results []aggregated.MetricWithStoragePolicy,
) []aggregated.MetricWithStoragePolicy {
var deduped []aggregated.MetricWithStoragePolicy
lenDeduped := 0
for _, m := range results {
if lenDeduped == 0 || !reflect.DeepEqual(deduped[lenDeduped-1], m) {
deduped = append(deduped, m)
lenDeduped++
}
}
return deduped
}

0 comments on commit 158cd13

Please sign in to comment.