Skip to content

Commit a5dca66

Browse files
authored
Improve override name (#4247)
1 parent 8c89229 commit a5dca66

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pkg/distributor/distributor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ type Limits interface {
126126
IngestionRateBytes(tenantID string) float64
127127
IngestionBurstSizeBytes(tenantID string) int
128128
IngestionLimit(tenantID string) *ingest_limits.Config
129-
SamplingProbability(tenantID string) *sampling.Config
129+
DistributorSampling(tenantID string) *sampling.Config
130130
IngestionTenantShardSize(tenantID string) int
131131
MaxLabelNameLength(tenantID string) int
132132
MaxLabelValueLength(tenantID string) int
@@ -901,7 +901,7 @@ func (d *Distributor) checkUsageGroupsIngestLimit(req *distributormodel.PushRequ
901901
}
902902

903903
func (d *Distributor) shouldSample(tenantID string, groupsInRequest []validation.UsageGroupMatchName) bool {
904-
l := d.limits.SamplingProbability(tenantID)
904+
l := d.limits.DistributorSampling(tenantID)
905905
if l == nil {
906906
return true
907907
}

pkg/distributor/distributor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,7 @@ func TestDistributor_shouldSample(t *testing.T) {
26462646
t.Run(tt.name, func(t *testing.T) {
26472647
overrides := validation.MockOverrides(func(defaults *validation.Limits, tenantLimits map[string]*validation.Limits) {
26482648
l := validation.MockDefaultLimits()
2649-
l.Sampling = tt.samplingConfig
2649+
l.DistributorSampling = tt.samplingConfig
26502650
tenantLimits[tt.tenantID] = l
26512651
})
26522652
d := &Distributor{
@@ -2692,7 +2692,7 @@ func TestDistributor_shouldSample_Probability(t *testing.T) {
26922692

26932693
overrides := validation.MockOverrides(func(defaults *validation.Limits, tenantLimits map[string]*validation.Limits) {
26942694
l := validation.MockDefaultLimits()
2695-
l.Sampling = samplingConfig
2695+
l.DistributorSampling = samplingConfig
26962696
tenantLimits[tenantID] = l
26972697
})
26982698
d := &Distributor{

pkg/validation/limits.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Limits struct {
3636
IngestionRateMB float64 `yaml:"ingestion_rate_mb" json:"ingestion_rate_mb"`
3737
IngestionBurstSizeMB float64 `yaml:"ingestion_burst_size_mb" json:"ingestion_burst_size_mb"`
3838
IngestionLimit *ingest_limits.Config `yaml:"ingestion_limit" json:"ingestion_limit" category:"advanced" doc:"hidden"`
39-
Sampling *sampling.Config `yaml:"sampling" json:"sampling" category:"advanced" doc:"hidden"`
39+
DistributorSampling *sampling.Config `yaml:"distributor_sampling" json:"distributor_sampling" category:"advanced" doc:"hidden"`
4040
MaxLabelNameLength int `yaml:"max_label_name_length" json:"max_label_name_length"`
4141
MaxLabelValueLength int `yaml:"max_label_value_length" json:"max_label_value_length"`
4242
MaxLabelNamesPerSeries int `yaml:"max_label_names_per_series" json:"max_label_names_per_series"`
@@ -292,8 +292,8 @@ func (o *Overrides) IngestionLimit(tenantID string) *ingest_limits.Config {
292292
return o.getOverridesForTenant(tenantID).IngestionLimit
293293
}
294294

295-
func (o *Overrides) SamplingProbability(tenantID string) *sampling.Config {
296-
return o.getOverridesForTenant(tenantID).Sampling
295+
func (o *Overrides) DistributorSampling(tenantID string) *sampling.Config {
296+
return o.getOverridesForTenant(tenantID).DistributorSampling
297297
}
298298

299299
// IngestionTenantShardSize returns the ingesters shard size for a given user.

0 commit comments

Comments
 (0)