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] Remove carbon debug flag and rely on log debug level #2024

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw may be prudent to put a deprecation warning here (unfortunately don't think we can delete the field without yaml parser complaining...)

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