Skip to content

Commit

Permalink
[coordinator] Remove carbon debug flag and rely on log debug level (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
robskillington authored Oct 29, 2019
1 parent a08f268 commit 7da4640
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
22 changes: 11 additions & 11 deletions src/cmd/services/m3coordinator/ingest/carbon/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (

"github.com/uber-go/tally"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)

const (
Expand All @@ -67,7 +68,6 @@ var (

// Options configures the ingester.
type Options struct {
Debug bool
InstrumentOptions instrument.Options
WorkerPool xsync.PooledWorkerPool
}
Expand Down Expand Up @@ -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))
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
10 changes: 6 additions & 4 deletions src/cmd/services/m3query/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/query/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ func startCarbonIngestion(
// Create ingester.
ingester, err := ingestcarbon.NewIngester(
downsamplerAndWriter, rules, ingestcarbon.Options{
Debug: ingesterCfg.Debug,
InstrumentOptions: carbonIOpts,
WorkerPool: workerPool,
})
Expand Down

0 comments on commit 7da4640

Please sign in to comment.