Skip to content
Open
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
13 changes: 13 additions & 0 deletions pkg/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/weaveworks/common/httpgrpc"
"github.com/weaveworks/common/user"
"go.uber.org/atomic"
"golang.org/x/time/rate"
"google.golang.org/grpc"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -927,6 +928,18 @@ func TestDistributor_PushIngestionRateLimiter_Histograms(t *testing.T) {
{samples: 3, nhSamples: 3, metadata: 2, expectedError: nil},
},
},
"local strategy: unlimited native histogram rate (Inf) with zero burst should always accept NH samples": {
distributors: 1,
ingestionRateStrategy: validation.LocalIngestionRateStrategy,
ingestionRate: 100000,
ingestionBurstSize: 100000,
nativeHistogramIngestionRate: float64(rate.Inf),
nativeHistogramIngestionBurstSize: 0,
pushes: []testPush{
{nhSamples: 1000, expectedError: nil, expectedNHDiscardedSampleMetricValue: 0},
{nhSamples: 5000, expectedError: nil, expectedNHDiscardedSampleMetricValue: 0},
},
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for the globalStrategyNativeHistogram.Limit() case as well?

"global strategy: unlimited native histogram rate (Inf) with zero burst should always accept NH samples": {
distributors: 2,
ingestionRateStrategy: validation.GlobalIngestionRateStrategy,
ingestionRate: 100000,
ingestionBurstSize: 100000,
nativeHistogramIngestionRate: float64(rate.Inf),
nativeHistogramIngestionBurstSize: 0,
pushes: []testPush{
{nhSamples: 1000, expectedError: nil, expectedNHDiscardedSampleMetricValue: 0},
{nhSamples: 5000, expectedError: nil, expectedNHDiscardedSampleMetricValue: 0},
},
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment :D
I don't think it's necessary to add it here because it returns rate.Inf directly and never divides by the number of distributors when the nativeHistogramIngestionRateis rate.Inf.

}

for testName, testData := range tests {
Expand Down
Loading