Skip to content

Commit

Permalink
Merge pull request #305 from jaysonsantos/newrelic-distributed-tracing
Browse files Browse the repository at this point in the history
Add ability to enable newrelic's distributed tracing
  • Loading branch information
zhouzhuojie authored Mar 12, 2020
2 parents 6bfc89e + bdd533c commit 88d0960
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
7 changes: 4 additions & 3 deletions pkg/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 88d0960

Please sign in to comment.