diff --git a/pkg/config/config.go b/pkg/config/config.go index 1881f171..22401cdf 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -93,6 +93,9 @@ func setupNewrelic() { if Config.NewRelicEnabled { nCfg := newrelic.NewConfig(Config.NewRelicAppName, Config.NewRelicKey) nCfg.Enabled = true + // These two cannot be enabled at the same time and cross application is enabled by default + nCfg.DistributedTracer.Enabled = Config.NewRelicDistributedTracingEnabled + nCfg.CrossApplicationTracer.Enabled = !Config.NewRelicDistributedTracingEnabled app, err := newrelic.NewApplication(nCfg) if err != nil { panic(fmt.Sprintf("unable to initialize newrelic. %s", err)) diff --git a/pkg/config/env.go b/pkg/config/env.go index ba10dde1..b3bfed4b 100644 --- a/pkg/config/env.go +++ b/pkg/config/env.go @@ -76,9 +76,10 @@ var Config = struct { SentryDSN string `env:"FLAGR_SENTRY_DSN" envDefault:""` // NewRelicEnabled - enable the NewRelic monitoring for all the endpoints and DB operations - NewRelicEnabled bool `env:"FLAGR_NEWRELIC_ENABLED" envDefault:"false"` - NewRelicAppName string `env:"FLAGR_NEWRELIC_NAME" envDefault:"flagr"` - NewRelicKey string `env:"FLAGR_NEWRELIC_KEY" envDefault:""` + NewRelicEnabled bool `env:"FLAGR_NEWRELIC_ENABLED" envDefault:"false"` + NewRelicDistributedTracingEnabled bool `env:"FLAGR_NEWRELIC_DISTRIBUTED_TRACING_ENABLED" envDefault:"false"` + NewRelicAppName string `env:"FLAGR_NEWRELIC_NAME" envDefault:"flagr"` + NewRelicKey string `env:"FLAGR_NEWRELIC_KEY" envDefault:""` // StatsdEnabled - enable statsd metrics for all the endpoints and DB operations StatsdEnabled bool `env:"FLAGR_STATSD_ENABLED" envDefault:"false"`