diff --git a/matcher/config.go b/matcher/config.go index ca0324c..b2f304e 100644 --- a/matcher/config.go +++ b/matcher/config.go @@ -38,16 +38,16 @@ import ( // Configuration is config used to create a Matcher. type Configuration struct { - InitWatchTimeout time.Duration `yaml:"initWatchTimeout"` - RulesKVConfig kv.Configuration `yaml:"rulesKVConfig"` - NamespacesKey string `yaml:"namespacesKey" validate:"nonzero"` - RuleSetKeyFmt string `yaml:"ruleSetKeyFmt" validate:"nonzero"` - NamespaceTag string `yaml:"namespaceTag" validate:"nonzero"` - DefaultNamespace string `yaml:"defaultNamespace" validate:"nonzero"` - NameTagKey string `yaml:"nameTagKey" validate:"nonzero"` - MatchRangePast *time.Duration `yaml:"matchRangePast"` - SortedTagIteratorPool pool.ObjectPoolConfiguration `yaml:"sortedTagIteratorPool"` - Policy policy.Configuration `yaml:"policy"` + InitWatchTimeout time.Duration `yaml:"initWatchTimeout"` + RulesKVConfig kv.Configuration `yaml:"rulesKVConfig"` + NamespacesKey string `yaml:"namespacesKey" validate:"nonzero"` + RuleSetKeyFmt string `yaml:"ruleSetKeyFmt" validate:"nonzero"` + NamespaceTag string `yaml:"namespaceTag" validate:"nonzero"` + DefaultNamespace string `yaml:"defaultNamespace" validate:"nonzero"` + NameTagKey string `yaml:"nameTagKey" validate:"nonzero"` + MatchRangePast *time.Duration `yaml:"matchRangePast"` + SortedTagIteratorPool pool.ObjectPoolConfiguration `yaml:"sortedTagIteratorPool"` + AggregationTypes policy.AggregationTypesConfiguration `yaml:"aggregationTypes"` } // NewNamespaces creates a matcher.Namespaces. @@ -118,7 +118,7 @@ func (cfg *Configuration) NewOptions( SetTagsFilterOptions(tagsFilterOptions). SetNewRollupIDFn(m3.NewRollupID). SetIsRollupIDFn(isRollupIDFn). - SetPolicyOptions(cfg.Policy.NewOptions()) + SetAggregationTypesOptions(cfg.AggregationTypes.NewOptions()) // Configure ruleset key function. ruleSetKeyFn := func(namespace []byte) string { diff --git a/matcher/namespaces.go b/matcher/namespaces.go index 5cbec1b..3916371 100644 --- a/matcher/namespaces.go +++ b/matcher/namespaces.go @@ -57,7 +57,7 @@ type Namespaces interface { ForwardMatch(namespace, id []byte, fromNanos, toNanos int64) rules.MatchResult // ReverseMatch reverse matches the matching policies for a given id in a given namespace - // between [fromNanos, toNanos), with aware of the metric type and aggregation type for the given id. + // between [fromNanos, toNanos), taking into account the metric type and aggregation type for the given id. ReverseMatch(namespace, id []byte, fromNanos, toNanos int64, mt metric.Type, at policy.AggregationType) rules.MatchResult // Close closes the namespaces. diff --git a/policy/aggregation_type.go b/policy/aggregation_type.go index 1596fbd..ec97dfe 100644 --- a/policy/aggregation_type.go +++ b/policy/aggregation_type.go @@ -463,8 +463,9 @@ func (id AggregationID) Contains(aggType AggregationType) bool { if !aggType.IsValid() { return false } - - return (id[int(aggType)/64] & (1 << (uint(aggType) % 64))) > 0 + idx := int(aggType) >> 6 + offset := uint(aggType) & 0x3F + return (id[idx] & (1 << offset)) > 0 } // AggregationTypes returns the aggregation types defined by the id. diff --git a/policy/config.go b/policy/aggregation_type_config.go similarity index 60% rename from policy/config.go rename to policy/aggregation_type_config.go index f3b0abe..e8b2987 100644 --- a/policy/config.go +++ b/policy/aggregation_type_config.go @@ -20,29 +20,29 @@ package policy -// Configuration contains configuration. -type Configuration struct { +// AggregationTypesConfiguration contains configuration for aggregation types. +type AggregationTypesConfiguration struct { // Default aggregation types for counter metrics. - CounterAggregationTypes *AggregationTypes `yaml:"counterAggregationTypes" validate:"nonzero"` + DefaultCounterAggregationTypes *AggregationTypes `yaml:"defaultCounterAggregationTypes"` // Default aggregation types for timer metrics. - TimerAggregationTypes *AggregationTypes `yaml:"timerAggregationTypes" validate:"nonzero"` + DefaultTimerAggregationTypes *AggregationTypes `yaml:"defaultTimerAggregationTypes"` // Default aggregation types for gauge metrics. - GaugeAggregationTypes *AggregationTypes `yaml:"gaugeAggregationTypes" validate:"nonzero"` + DefaultGaugeAggregationTypes *AggregationTypes `yaml:"defaultGaugeAggregationTypes"` } // NewOptions creates a new Option. -func (c Configuration) NewOptions() Options { - opts := NewOptions() - if c.CounterAggregationTypes != nil { - opts = opts.SetDefaultCounterAggregationTypes(*c.CounterAggregationTypes) +func (c AggregationTypesConfiguration) NewOptions() AggregationTypesOptions { + opts := NewAggregationTypesOptions() + if c.DefaultCounterAggregationTypes != nil { + opts = opts.SetDefaultCounterAggregationTypes(*c.DefaultCounterAggregationTypes) } - if c.GaugeAggregationTypes != nil { - opts = opts.SetDefaultGaugeAggregationTypes(*c.GaugeAggregationTypes) + if c.DefaultGaugeAggregationTypes != nil { + opts = opts.SetDefaultGaugeAggregationTypes(*c.DefaultGaugeAggregationTypes) } - if c.TimerAggregationTypes != nil { - opts = opts.SetDefaultTimerAggregationTypes(*c.TimerAggregationTypes) + if c.DefaultTimerAggregationTypes != nil { + opts = opts.SetDefaultTimerAggregationTypes(*c.DefaultTimerAggregationTypes) } return opts } diff --git a/policy/config_test.go b/policy/aggregation_type_config_test.go similarity index 90% rename from policy/config_test.go rename to policy/aggregation_type_config_test.go index 0253096..4113d56 100644 --- a/policy/config_test.go +++ b/policy/aggregation_type_config_test.go @@ -27,13 +27,13 @@ import ( yaml "gopkg.in/yaml.v2" ) -func TestConfig(t *testing.T) { +func TestAggregationTypesConfiguration(t *testing.T) { str := ` -gaugeAggregationTypes: Max -timerAggregationTypes: P50,P99,P9999 +defaultGaugeAggregationTypes: Max +defaultTimerAggregationTypes: P50,P99,P9999 ` - var cfg Configuration + var cfg AggregationTypesConfiguration require.NoError(t, yaml.Unmarshal([]byte(str), &cfg)) opts := cfg.NewOptions() require.Equal(t, defaultDefaultCounterAggregationTypes, opts.DefaultCounterAggregationTypes()) diff --git a/policy/options.go b/policy/options.go index b690172..b3cd821 100644 --- a/policy/options.go +++ b/policy/options.go @@ -20,25 +20,33 @@ package policy -// Options provides a set of options for -type Options interface { - // SetDefaultCounterAggregationTypes sets the counter aggregation types. - SetDefaultCounterAggregationTypes(value AggregationTypes) Options +import ( + "github.com/m3db/m3metrics/metric" +) + +// AggregationTypesOptions provides a set of options for aggregation types. +type AggregationTypesOptions interface { + // SetDefaultCounterAggregationTypes sets the default aggregation types for counters. + SetDefaultCounterAggregationTypes(value AggregationTypes) AggregationTypesOptions - // DefaultCounterAggregationTypes returns the aggregation types for counters. + // DefaultCounterAggregationTypes returns the default aggregation types for counters. DefaultCounterAggregationTypes() AggregationTypes - // SetDefaultTimerAggregationTypes sets the timer aggregation types. - SetDefaultTimerAggregationTypes(value AggregationTypes) Options + // SetDefaultTimerAggregationTypes sets the default aggregation types for timers. + SetDefaultTimerAggregationTypes(value AggregationTypes) AggregationTypesOptions - // DefaultTimerAggregationTypes returns the aggregation types for timers. + // DefaultTimerAggregationTypes returns the default aggregation types for timers. DefaultTimerAggregationTypes() AggregationTypes - // SetDefaultGaugeAggregationTypes sets the gauge aggregation types. - SetDefaultGaugeAggregationTypes(value AggregationTypes) Options + // SetDefaultGaugeAggregationTypes sets the default aggregation types for gauges. + SetDefaultGaugeAggregationTypes(value AggregationTypes) AggregationTypesOptions - // DefaultGaugeAggregationTypes returns the aggregation types for gauges. + // DefaultGaugeAggregationTypes returns the default aggregation types for gauges. DefaultGaugeAggregationTypes() AggregationTypes + + // IsContainedInDefaultAggregationTypes checks if the given aggregation type is + // contained in the default aggregation types for the metric type. + IsContainedInDefaultAggregationTypes(at AggregationType, mt metric.Type) bool } var ( @@ -69,8 +77,8 @@ type options struct { defaultGaugeAggregationTypes AggregationTypes } -// NewOptions returns a default Options. -func NewOptions() Options { +// NewAggregationTypesOptions returns a default Options. +func NewAggregationTypesOptions() AggregationTypesOptions { return &options{ defaultCounterAggregationTypes: defaultDefaultCounterAggregationTypes, defaultGaugeAggregationTypes: defaultDefaultGaugeAggregationTypes, @@ -78,7 +86,7 @@ func NewOptions() Options { } } -func (o *options) SetDefaultCounterAggregationTypes(aggTypes AggregationTypes) Options { +func (o *options) SetDefaultCounterAggregationTypes(aggTypes AggregationTypes) AggregationTypesOptions { opts := *o opts.defaultCounterAggregationTypes = aggTypes return &opts @@ -88,7 +96,7 @@ func (o *options) DefaultCounterAggregationTypes() AggregationTypes { return o.defaultCounterAggregationTypes } -func (o *options) SetDefaultTimerAggregationTypes(aggTypes AggregationTypes) Options { +func (o *options) SetDefaultTimerAggregationTypes(aggTypes AggregationTypes) AggregationTypesOptions { opts := *o opts.defaultTimerAggregationTypes = aggTypes return &opts @@ -98,7 +106,7 @@ func (o *options) DefaultTimerAggregationTypes() AggregationTypes { return o.defaultTimerAggregationTypes } -func (o *options) SetDefaultGaugeAggregationTypes(aggTypes AggregationTypes) Options { +func (o *options) SetDefaultGaugeAggregationTypes(aggTypes AggregationTypes) AggregationTypesOptions { opts := *o opts.defaultGaugeAggregationTypes = aggTypes return &opts @@ -107,3 +115,17 @@ func (o *options) SetDefaultGaugeAggregationTypes(aggTypes AggregationTypes) Opt func (o *options) DefaultGaugeAggregationTypes() AggregationTypes { return o.defaultGaugeAggregationTypes } + +func (o *options) IsContainedInDefaultAggregationTypes(at AggregationType, mt metric.Type) bool { + var aggTypes AggregationTypes + switch mt { + case metric.CounterType: + aggTypes = o.DefaultCounterAggregationTypes() + case metric.GaugeType: + aggTypes = o.DefaultGaugeAggregationTypes() + case metric.TimerType: + aggTypes = o.DefaultTimerAggregationTypes() + } + + return aggTypes.Contains(at) +} diff --git a/policy/policy.go b/policy/policy.go index 98c55c1..79e508d 100644 --- a/policy/policy.go +++ b/policy/policy.go @@ -180,7 +180,7 @@ func NewPoliciesFromSchema(policies []*schema.Policy) ([]Policy, error) { return res, nil } -// IsDefaultPolicies checks if the policies is default. +// IsDefaultPolicies checks if the policies are the default policies. func IsDefaultPolicies(ps []Policy) bool { return len(ps) == 0 } diff --git a/rules/options.go b/rules/options.go index de6e917..c9deaff 100644 --- a/rules/options.go +++ b/rules/options.go @@ -46,24 +46,24 @@ type Options interface { // IsRollupIDFn returns the function that determines whether an id is a rollup id. IsRollupIDFn() id.MatchIDFn - // SetPolicyOptions sets the policy options. - SetPolicyOptions(v policy.Options) Options + // SetAggregationTypesOptions sets the aggregation types options. + SetAggregationTypesOptions(v policy.AggregationTypesOptions) Options - // PolicyOptions returns the policy options. - PolicyOptions() policy.Options + // PolicyOptions returns the aggregation types options. + AggregationTypesOptions() policy.AggregationTypesOptions } type options struct { tagsFilterOpts filters.TagsFilterOptions newRollupIDFn id.NewIDFn isRollupIDFn id.MatchIDFn - pOpts policy.Options + aggOpts policy.AggregationTypesOptions } // NewOptions creates a new set of options. func NewOptions() Options { return &options{ - pOpts: policy.NewOptions(), + aggOpts: policy.NewAggregationTypesOptions(), } } @@ -97,12 +97,12 @@ func (o *options) IsRollupIDFn() id.MatchIDFn { return o.isRollupIDFn } -func (o *options) SetPolicyOptions(value policy.Options) Options { +func (o *options) SetAggregationTypesOptions(value policy.AggregationTypesOptions) Options { opts := *o - opts.pOpts = value + opts.aggOpts = value return &opts } -func (o *options) PolicyOptions() policy.Options { - return o.pOpts +func (o *options) AggregationTypesOptions() policy.AggregationTypesOptions { + return o.aggOpts } diff --git a/rules/ruleset.go b/rules/ruleset.go index 97cc8d8..6ed6da4 100644 --- a/rules/ruleset.go +++ b/rules/ruleset.go @@ -70,7 +70,7 @@ type activeRuleSet struct { tagFilterOpts filters.TagsFilterOptions newRollupIDFn metricID.NewIDFn isRollupIDFn metricID.MatchIDFn - pOpts policy.Options + aggOpts policy.AggregationTypesOptions } func newActiveRuleSet( @@ -80,7 +80,7 @@ func newActiveRuleSet( tagFilterOpts filters.TagsFilterOptions, newRollupIDFn metricID.NewIDFn, isRollupIDFn metricID.MatchIDFn, - pOpts policy.Options, + aggOpts policy.AggregationTypesOptions, ) *activeRuleSet { uniqueCutoverTimes := make(map[int64]struct{}) for _, mappingRule := range mappingRules { @@ -108,7 +108,7 @@ func newActiveRuleSet( tagFilterOpts: tagFilterOpts, newRollupIDFn: newRollupIDFn, isRollupIDFn: isRollupIDFn, - pOpts: pOpts, + aggOpts: aggOpts, } } @@ -121,11 +121,11 @@ func (as *activeRuleSet) ForwardMatch( var ( nextIdx = as.nextCutoverIdx(fromNanos) nextCutoverNanos = as.cutoverNanosAt(nextIdx) - currMappingResults = policy.PoliciesList{as.mappingsForNonRollupIDForward(id, fromNanos)} + currMappingResults = policy.PoliciesList{as.forwardMappingsForNonRollupID(id, fromNanos)} currRollupResults = as.rollupResultsFor(id, fromNanos) ) for nextIdx < len(as.cutoverTimesAsc) && nextCutoverNanos < toNanos { - nextMappingPolicies := as.mappingsForNonRollupIDForward(id, nextCutoverNanos) + nextMappingPolicies := as.forwardMappingsForNonRollupID(id, nextCutoverNanos) currMappingResults = mergeMappingResults(currMappingResults, nextMappingPolicies) nextRollupResults := as.rollupResultsFor(id, nextCutoverNanos) currRollupResults = mergeRollupResults(currRollupResults, nextRollupResults, nextCutoverNanos) @@ -180,9 +180,9 @@ func (as *activeRuleSet) reverseMappingsFor( at policy.AggregationType, ) (policy.StagedPolicies, bool) { if !isRollupID { - return as.mappingsForNonRollupIDReverse(id, timeNanos, mt, at) + return as.reverseMappingsForNonRollupID(id, timeNanos, mt, at) } - return as.mappingsForRollupIDReverse(name, tags, timeNanos, mt, at) + return as.reverseMappingsForRollupID(name, tags, timeNanos, mt, at) } // NB(xichen): in order to determine the applicable policies for a rollup metric, we need to @@ -193,7 +193,11 @@ func (as *activeRuleSet) reverseMappingsFor( // used to produce the given rollup metric id due to its tag filters, thereby causing the wrong // staged policies to be returned. This also implies at any given time, at most one rollup target // may match the given rollup id. -func (as *activeRuleSet) mappingsForRollupIDReverse( +// Since we may have policies with different aggregation types defined for a roll up rule, +// and each aggregation type would generate a new id. So when doing reverse mapping, not only do +// we need to match the roll up tags, we also need to check the aggregation type against +// each policy to see if the aggregation type was actually contained in the policy. +func (as *activeRuleSet) reverseMappingsForRollupID( name, tags []byte, timeNanos int64, mt metric.Type, at policy.AggregationType, @@ -234,11 +238,12 @@ func (as *activeRuleSet) mappingsForRollupIDReverse( policies := make([]policy.Policy, len(target.Policies)) copy(policies, target.Policies) resolved := resolvePolicies(policies) - resolved, _ = filterPoliciesWithAggregationTypes(resolved, mt, at, as.pOpts) - if len(resolved) == 0 { + // Filter the each policy by the aggregation type. + filtered, _ := filterPoliciesWithAggregationTypes(resolved, mt, at, as.aggOpts) + if len(filtered) == 0 { return policy.DefaultStagedPolicies, false } - return policy.NewStagedPolicies(snapshot.cutoverNanos, false, resolved), true + return policy.NewStagedPolicies(snapshot.cutoverNanos, false, filtered), true } } } @@ -246,22 +251,26 @@ func (as *activeRuleSet) mappingsForRollupIDReverse( return policy.DefaultStagedPolicies, false } -func (as *activeRuleSet) mappingsForNonRollupIDReverse(id []byte, timeNanos int64, - mt metric.Type, at policy.AggregationType) (policy.StagedPolicies, bool) { +func (as *activeRuleSet) reverseMappingsForNonRollupID( + id []byte, + timeNanos int64, + mt metric.Type, + at policy.AggregationType, +) (policy.StagedPolicies, bool) { policies, cutoverNanos := as.mappingsForNonRollupID(id, timeNanos) // NB(cw) aggregation types filter must be applied after the policy list is resolved. // Because policies like [1m:40h|P90,P99; 1m:20h|P50] will be resolved to [1m:40h|P50,P90,P99]. - filtered, isDefault := filterPoliciesWithAggregationTypes(policies, mt, at, as.pOpts) - if isDefault { + filtered, isDefault := filterPoliciesWithAggregationTypes(policies, mt, at, as.aggOpts) + if cutoverNanos == 0 && isDefault { return policy.DefaultStagedPolicies, true } - if len(filtered) == 0 { - return policy.DefaultStagedPolicies, false + if isDefault || len(filtered) != 0 { + return policy.NewStagedPolicies(cutoverNanos, false, filtered), true } - return policy.NewStagedPolicies(cutoverNanos, false, filtered), true + return policy.DefaultStagedPolicies, false } -func (as *activeRuleSet) mappingsForNonRollupIDForward(id []byte, timeNanos int64) policy.StagedPolicies { +func (as *activeRuleSet) forwardMappingsForNonRollupID(id []byte, timeNanos int64) policy.StagedPolicies { policies, cutoverNanos := as.mappingsForNonRollupID(id, timeNanos) if cutoverNanos == 0 && len(policies) == 0 { return policy.DefaultStagedPolicies @@ -528,7 +537,7 @@ type ruleSet struct { tagsFilterOpts filters.TagsFilterOptions newRollupIDFn metricID.NewIDFn isRollupIDFn metricID.MatchIDFn - pOpts policy.Options + aggOpts policy.AggregationTypesOptions } // NewRuleSetFromSchema creates a new RuleSet from a schema object. @@ -567,7 +576,7 @@ func NewRuleSetFromSchema(version int, rs *schema.RuleSet, opts Options) (RuleSe tagsFilterOpts: tagsFilterOpts, newRollupIDFn: opts.NewRollupIDFn(), isRollupIDFn: opts.IsRollupIDFn(), - pOpts: opts.PolicyOptions(), + aggOpts: opts.AggregationTypesOptions(), }, nil } @@ -580,7 +589,7 @@ func NewEmptyRuleSet(namespaceName string, meta UpdateMetadata) MutableRuleSet { tombstoned: false, mappingRules: make([]*mappingRule, 0), rollupRules: make([]*rollupRule, 0), - pOpts: policy.NewOptions(), + aggOpts: policy.NewAggregationTypesOptions(), } rs.updateMetadata(meta) return rs @@ -611,7 +620,7 @@ func (rs *ruleSet) ActiveSet(timeNanos int64) Matcher { rs.tagsFilterOpts, rs.newRollupIDFn, rs.isRollupIDFn, - rs.pOpts, + rs.aggOpts, ) } @@ -735,7 +744,7 @@ func (rs *ruleSet) Clone() MutableRuleSet { tagsFilterOpts: rs.tagsFilterOpts, newRollupIDFn: rs.newRollupIDFn, isRollupIDFn: rs.isRollupIDFn, - pOpts: rs.pOpts, + aggOpts: rs.aggOpts, }) } @@ -975,9 +984,9 @@ func (rs *ruleSet) latestRollupRules() (map[string]*RollupRuleView, error) { // resolvePolicies resolves the conflicts among policies if any, following the rules below: // * If two policies have the same resolution but different retention, the one with longer -// retention period is chosen. +// retention period is chosen. // * If two policies have the same resolution but different custom aggregation types, the -// aggregation types will be merged. +// aggregation types will be merged. func resolvePolicies(policies []policy.Policy) []policy.Policy { if len(policies) == 0 { return policies @@ -1006,48 +1015,36 @@ func resolvePolicies(policies []policy.Policy) []policy.Policy { // filterPoliciesWithAggregationTypes accepts a policy when: // * If the policy contains default aggregation types and the given aggregation type -// is contained in the default aggregation types for the metric type. +// is contained in the default aggregation types for the metric type. // * If the policy contains custom aggregation types and the given aggregation type -// is contained in the custom aggregation type. -func filterPoliciesWithAggregationTypes(ps []policy.Policy, mt metric.Type, at policy.AggregationType, opts policy.Options) ([]policy.Policy, bool) { +// is contained in the custom aggregation type. +func filterPoliciesWithAggregationTypes(ps []policy.Policy, mt metric.Type, at policy.AggregationType, opts policy.AggregationTypesOptions) ([]policy.Policy, bool) { if policy.IsDefaultPolicies(ps) { - return nil, isIncludedInDefaultAggTypes(mt, at, opts) + return nil, opts.IsContainedInDefaultAggregationTypes(at, mt) } + var cur int for i := 0; i < len(ps); i++ { - if containsAggType(ps[i].AggregationID, mt, at, opts) { + if !containsAggType(ps[i].AggregationID, mt, at, opts) { continue } // NB: The policy does not match the aggregation type and should be removed, // but we need to maintain the order of the policy list. - copy(ps[i:], ps[i+1:]) - ps = ps[:len(ps)-1] - i-- + if cur != i { + ps[cur] = ps[i] + } + cur++ } - return ps, false + return ps[:cur], false } -func containsAggType(aggID policy.AggregationID, mt metric.Type, at policy.AggregationType, opts policy.Options) bool { +func containsAggType(aggID policy.AggregationID, mt metric.Type, at policy.AggregationType, opts policy.AggregationTypesOptions) bool { if aggID.IsDefault() { - return isIncludedInDefaultAggTypes(mt, at, opts) + return opts.IsContainedInDefaultAggregationTypes(at, mt) } return aggID.Contains(at) } -func isIncludedInDefaultAggTypes(mt metric.Type, at policy.AggregationType, opts policy.Options) bool { - var aggTypes policy.AggregationTypes - switch mt { - case metric.CounterType: - aggTypes = opts.DefaultCounterAggregationTypes() - case metric.GaugeType: - aggTypes = opts.DefaultGaugeAggregationTypes() - case metric.TimerType: - aggTypes = opts.DefaultTimerAggregationTypes() - } - - return aggTypes.Contains(at) -} - // mergeMappingResults assumes the policies contained in currMappingResults // are sorted by cutover time in time ascending order. func mergeMappingResults( @@ -1055,8 +1052,7 @@ func mergeMappingResults( nextMappingPolicies policy.StagedPolicies, ) policy.PoliciesList { if len(currMappingResults) == 0 { - currMappingResults = append(currMappingResults, nextMappingPolicies) - return currMappingResults + return policy.PoliciesList{nextMappingPolicies} } currMappingPolicies := currMappingResults[len(currMappingResults)-1] if currMappingPolicies.SamePolicies(nextMappingPolicies) { diff --git a/rules/ruleset_test.go b/rules/ruleset_test.go index a47cd2c..43cd468 100644 --- a/rules/ruleset_test.go +++ b/rules/ruleset_test.go @@ -195,7 +195,7 @@ func TestActiveRuleSetForwardMappingPoliciesForNonRollupID(t *testing.T) { testTagsFilterOptions(), mockNewID, nil, - policy.NewOptions(), + policy.NewAggregationTypesOptions(), ) expectedCutovers := []int64{10000, 15000, 20000, 22000, 24000, 30000, 34000, 35000, 100000} require.Equal(t, expectedCutovers, as.cutoverTimesAsc) @@ -399,7 +399,7 @@ func TestActiveRuleSetReverseMappingPoliciesForNonRollupID(t *testing.T) { testTagsFilterOptions(), mockNewID, func([]byte, []byte) bool { return false }, - policy.NewOptions(), + policy.NewAggregationTypesOptions(), ) expectedCutovers := []int64{10000, 15000, 20000, 22000, 24000, 30000, 34000, 35000, 100000} require.Equal(t, expectedCutovers, as.cutoverTimesAsc) @@ -534,7 +534,7 @@ func TestActiveRuleSetReverseMappingPoliciesForRollupID(t *testing.T) { testTagsFilterOptions(), mockNewID, func([]byte, []byte) bool { return true }, - policy.NewOptions(), + policy.NewAggregationTypesOptions(), ) expectedCutovers := []int64{10000, 15000, 20000, 22000, 24000, 30000, 34000, 35000, 38000, 100000, 120000} require.Equal(t, expectedCutovers, as.cutoverTimesAsc) @@ -713,7 +713,7 @@ func TestActiveRuleSetRollupResults(t *testing.T) { testTagsFilterOptions(), mockNewID, nil, - policy.NewOptions(), + policy.NewAggregationTypesOptions(), ) expectedCutovers := []int64{10000, 15000, 20000, 22000, 24000, 30000, 34000, 35000, 38000, 100000, 120000} require.Equal(t, expectedCutovers, as.cutoverTimesAsc)