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

Add ability to enable newrelic's distributed tracing #305

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you link some newrelic documentation for this? Thanks

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