Conversation
| for _, query := range queries { | ||
| realQueries = append(realQueries, *query) | ||
| } | ||
| defer wg.Done() |
There was a problem hiding this comment.
Should defer immediatly
| close(statsRespCh) | ||
| close(errRespCh) | ||
| }() | ||
| res := <-queryRespCh |
There was a problem hiding this comment.
wierd pattern. Should create a new MultiFetchResponse and call Append on it
| close(statsRespCh) | ||
| close(errRespCh) | ||
| }() | ||
| res := <-queryRespCh |
| close(statsRespCh) | ||
| close(errRespCh) | ||
| }() | ||
| r := <-queryRespCh |
| AllowGroupPerMetric := make(map[*protov3.FetchRequest][]string) | ||
| DenyGroupPerMetric := make(map[*protov3.FetchRequest][]string) |
There was a problem hiding this comment.
should be private
| queriesPerGroup[nameGroup] = append(queriesPerGroup[nameGroup], query) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
What happens if there is no match? Shouldn't we broadcast or use a user supplied strategy?
| return groupOfQueriesPerBackendServer | ||
| } | ||
|
|
||
| func contains(s []string, e string) bool { |
config.yml
Outdated
| keepAliveInterval: "30s" | ||
| maxIdleConnsPerHost: 100 | ||
| backendsv2: | ||
| selector: "rb" |
There was a problem hiding this comment.
cryptic, prefer per_query or something meaningfull
config.yml
Outdated
| maxIdleConnsPerHost: 100 | ||
| backendsv2: | ||
| selector: "rb" | ||
| groupRegexRules: |
config.yml
Outdated
| backendsv2: | ||
| selector: "rb" | ||
| groupRegexRules: | ||
| - regex: "teadsWigoDebug_user_cookie_found_count" |
config.yml
Outdated
| selector: "rb" | ||
| groupRegexRules: | ||
| - regex: "teadsWigoDebug_user_cookie_found_count" | ||
| effect: "allow" |
There was a problem hiding this comment.
action: select|reject
config.yml
Outdated
| groupRegexRules: | ||
| - regex: "teadsWigoDebug_user_cookie_found_count" | ||
| effect: "allow" | ||
| groupBackendNames: ["prometheus"] |
| for _, server := range backend.Servers { | ||
| config.Servers = []string{server} | ||
| config.GroupName = server | ||
| client, e := backendInit(q.logger, config, q.tldCacheDisabled) |
There was a problem hiding this comment.
I don't get why we need to create new client for each request. Can't we create clients at init and pick them on matches? TBD
zipper/types/regexrules.go
Outdated
| func (r *RegexRulesResults) Fill(s string, rule RegexRuleGroupBackends) { | ||
| if rule.CompiledRegex.MatchString(s) { | ||
| if rule.Effect == "allow" { | ||
| r.Allow[s] = AppendUnique(r.Allow[s], rule.GroupBackendNames) |
There was a problem hiding this comment.
probably better using map[string]map[string]bool
zipper/types/backend.go
Outdated
| GroupRegexRules []RegexRuleGroupBackends `mapstructure:"groupRegexRules"` | ||
| } | ||
|
|
||
| type RegexRuleGroupBackends struct { |
zipper/types/regexrules.go
Outdated
| @@ -0,0 +1,50 @@ | |||
| package types | |||
|
|
|||
| type RegexRulesResults struct { | |||
There was a problem hiding this comment.
SelectionRuleResults
zipper/types/regexrules.go
Outdated
| } | ||
| } | ||
|
|
||
| func (r *RegexRulesResults) Fill(s string, rule RegexRuleGroupBackends) { |
zipper/zipper.go
Outdated
| zap.Any("merry.Errors", err), | ||
| ) | ||
| var err merry.Error | ||
| if cfg.BackendsV2.Selector == "rb" || cfg.BackendsV2.Selector == "regexbased" { |
There was a problem hiding this comment.
prefer stacking storeClients
if cfg...enabled {
storeClients = querydispatch.New(...,storeClients)
}
Motivation
We would like to select which backend carbonapi should query based on regex applied on queries.