Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[coordinator] Set default namespace tag to avoid colliding with commonly used "namespace" label #2878

Merged
merged 3 commits into from
Nov 12, 2020
Merged
Changes from 2 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: 11 additions & 2 deletions src/cmd/services/m3coordinator/downsample/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const (
)

var (
numShards = runtime.NumCPU()
numShards = runtime.NumCPU()
defaultNamespaceTag = metric.M3MetricsPrefixString + "_namespace__"

errNoStorage = errors.New("downsampling enabled with storage not set")
errNoClusterClient = errors.New("downsampling enabled with cluster client not set")
Expand Down Expand Up @@ -267,6 +268,9 @@ type Configuration struct {
type MatcherConfiguration struct {
// Cache if non-zero will set the capacity of the rules matching cache.
Cache MatcherCacheConfiguration `yaml:"cache"`
// NamespaceTag defines the namespace tag to use to select rules
// namespace to evaluate against. Default is "__m3_namespace__".
NamespaceTag string `yaml:"namespaceTag"`
}

// MatcherCacheConfiguration is the configuration for the rule matcher cache.
Expand Down Expand Up @@ -647,13 +651,17 @@ func (cfg Configuration) newAggregator(o DownsamplerOptions) (agg, error) {
logger = instrumentOpts.Logger()
openTimeout = defaultOpenTimeout
m3PrefixFilter = false
namespaceTag = defaultNamespaceTag
)
if o.StorageFlushConcurrency > 0 {
storageFlushConcurrency = o.StorageFlushConcurrency
}
if o.OpenTimeout > 0 {
openTimeout = o.OpenTimeout
}
if cfg.Matcher.NamespaceTag != "" {
namespaceTag = cfg.Matcher.NamespaceTag
}

pools := o.newAggregatorPools()
ruleSetOpts := o.newAggregatorRulesOptions(pools)
Expand All @@ -662,7 +670,8 @@ func (cfg Configuration) newAggregator(o DownsamplerOptions) (agg, error) {
SetClockOptions(clockOpts).
SetInstrumentOptions(instrumentOpts).
SetRuleSetOptions(ruleSetOpts).
SetKVStore(o.RulesKVStore)
SetKVStore(o.RulesKVStore).
SetNamespaceTag([]byte(namespaceTag))

// NB(r): If rules are being explicitly set in config then we are
// going to use an in memory KV store for rules and explicitly set them up.
Expand Down