diff --git a/src/cmd/services/m3coordinator/ingest/carbon/ingest.go b/src/cmd/services/m3coordinator/ingest/carbon/ingest.go index 07134ea26a..779caacd07 100644 --- a/src/cmd/services/m3coordinator/ingest/carbon/ingest.go +++ b/src/cmd/services/m3coordinator/ingest/carbon/ingest.go @@ -47,6 +47,7 @@ import ( "github.com/uber-go/tally" "go.uber.org/zap" + "go.uber.org/zap/zapcore" ) const ( @@ -67,7 +68,6 @@ var ( // Options configures the ingester. type Options struct { - Debug bool InstrumentOptions instrument.Options WorkerPool xsync.PooledWorkerPool } @@ -221,10 +221,10 @@ func (i *ingester) write( downsampleAndStoragePolicies.DownsampleMappingRules = rule.mappingRules downsampleAndStoragePolicies.WriteStoragePolicies = rule.storagePolicies - if i.opts.Debug { - i.logger.Info("carbon metric matched by pattern", - zap.String("name", string(resources.name)), - zap.Any("pattern", rule.rule.Pattern), + debugLog := i.logger.Check(zapcore.DebugLevel, "carbon metric matched by pattern") + if debugLog != nil { + debugLog.Write(zap.ByteString("name", resources.name), + zap.String("pattern", rule.rule.Pattern), zap.Any("mappingRules", rule.mappingRules), zap.Any("storagePolicies", rule.storagePolicies)) } @@ -237,9 +237,9 @@ func (i *ingester) write( if len(downsampleAndStoragePolicies.DownsampleMappingRules) == 0 && len(downsampleAndStoragePolicies.WriteStoragePolicies) == 0 { // Nothing to do if none of the policies matched. - if i.opts.Debug { - i.logger.Info("no rules matched carbon metric, skipping", - zap.String("name", string(resources.name))) + debugLog := i.logger.Check(zapcore.DebugLevel, "no rules matched carbon metric, skipping") + if debugLog != nil { + debugLog.Write(zap.ByteString("name", resources.name)) } return false } @@ -264,9 +264,9 @@ func (i *ingester) write( return false } - if i.opts.Debug { - i.logger.Info("successfully wrote carbon metric", - zap.String("name", string(resources.name))) + debugLog := i.logger.Check(zapcore.DebugLevel, "successfully wrote carbon metric") + if debugLog != nil { + debugLog.Write(zap.ByteString("name", resources.name)) } return true } diff --git a/src/cmd/services/m3query/config/config.go b/src/cmd/services/m3query/config/config.go index 61bfec3b70..ce3efcc834 100644 --- a/src/cmd/services/m3query/config/config.go +++ b/src/cmd/services/m3query/config/config.go @@ -292,10 +292,12 @@ type CarbonConfiguration struct { // CarbonIngesterConfiguration is the configuration struct for carbon ingestion. type CarbonIngesterConfiguration struct { - Debug bool `yaml:"debug"` - ListenAddress string `yaml:"listenAddress"` - MaxConcurrency int `yaml:"maxConcurrency"` - Rules []CarbonIngesterRuleConfiguration `yaml:"rules"` + // Deprecated: simply use the logger debug level, this has been deprecated + // in favor of setting the log level to debug. + DeprecatedDebug bool `yaml:"debug"` + ListenAddress string `yaml:"listenAddress"` + MaxConcurrency int `yaml:"maxConcurrency"` + Rules []CarbonIngesterRuleConfiguration `yaml:"rules"` } // LookbackDurationOrDefault validates the LookbackDuration diff --git a/src/query/server/server.go b/src/query/server/server.go index 1ddde0f678..896574b0d3 100644 --- a/src/query/server/server.go +++ b/src/query/server/server.go @@ -953,7 +953,6 @@ func startCarbonIngestion( // Create ingester. ingester, err := ingestcarbon.NewIngester( downsamplerAndWriter, rules, ingestcarbon.Options{ - Debug: ingesterCfg.Debug, InstrumentOptions: carbonIOpts, WorkerPool: workerPool, })