Skip to content

Commit

Permalink
Add Config Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mirackara committed Mar 1, 2024
1 parent da32def commit 10634f3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
12 changes: 11 additions & 1 deletion v3/newrelic/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ type Config struct {
DynoNamePrefixesToShorten []string
}

// AIMonitoring controls the behavior of AI monitoring features.
AIMonitoring struct {
Enabled bool
// Indicates whether streams will be instrumented
Streaming struct {
Enabled bool
}
}

// CrossApplicationTracer controls behavior relating to cross application
// tracing (CAT). In the case where CrossApplicationTracer and
// DistributedTracer are both enabled, DistributedTracer takes precedence.
Expand Down Expand Up @@ -666,7 +675,8 @@ func defaultConfig() Config {

c.Heroku.UseDynoNames = true
c.Heroku.DynoNamePrefixesToShorten = []string{"scheduler", "run"}

c.AIMonitoring.Enabled = false
c.AIMonitoring.Streaming.Enabled = true
c.InfiniteTracing.TraceObserver.Port = 443
c.InfiniteTracing.SpanEvents.QueueSize = 10000

Expand Down
10 changes: 10 additions & 0 deletions v3/newrelic/config_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ func ConfigAppLogDecoratingEnabled(enabled bool) ConfigOption {
}
}

func ConfigAIMonitoringEnabled(enabled bool) ConfigOption {
return func(cfg *Config) {
if enabled && !cfg.HighSecurity {
cfg.AIMonitoring.Enabled = true
} else {
cfg.AIMonitoring.Enabled = false
}
}
}

// ConfigAppLogMetricsEnabled enables or disables the collection of metrics
// data for logs seen by an instrumented logging framework
// default: true
Expand Down
12 changes: 12 additions & 0 deletions v3/newrelic/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ func TestCopyConfigReferenceFieldsPresent(t *testing.T) {
"agent_version":"0.2.2",
"host":"my-hostname",
"settings":{
"AIMonitoring": {
"Enabled": false,
"Streaming": {
"Enabled": true
}
},
"AppName":"my appname",
"ApplicationLogging": {
"Enabled": true,
Expand Down Expand Up @@ -326,6 +332,12 @@ func TestCopyConfigReferenceFieldsAbsent(t *testing.T) {
"agent_version":"0.2.2",
"host":"my-hostname",
"settings":{
"AIMonitoring": {
"Enabled": false,
"Streaming": {
"Enabled": true
}
},
"AppName":"my appname",
"ApplicationLogging": {
"Enabled": true,
Expand Down

0 comments on commit 10634f3

Please sign in to comment.