Skip to content

Commit

Permalink
[serverless] Default DD_TRACE_MANAGED_SERVICES to true (#16176)
Browse files Browse the repository at this point in the history
* default DD_TRACE_MANAGED_SERVICES to true

* add unit tests
  • Loading branch information
zARODz11z authored and purple4reina committed Mar 22, 2023
1 parent a512e20 commit 255f6e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ func InitConfig(config Config) {
config.BindEnvAndSetDefault("enhanced_metrics", true)
config.BindEnvAndSetDefault("capture_lambda_payload", false)
config.BindEnvAndSetDefault("serverless.trace_enabled", false, "DD_TRACE_ENABLED")
config.BindEnvAndSetDefault("serverless.trace_managed_services", false, "DD_TRACE_MANAGED_SERVICES")
config.BindEnvAndSetDefault("serverless.trace_managed_services", true, "DD_TRACE_MANAGED_SERVICES")

// trace-agent's evp_proxy
config.BindEnv("evp_proxy_config.enabled")
Expand Down
11 changes: 11 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ func TestSiteEnvVar(t *testing.T) {
assert.Equal(t, "https://external-agent.datadoghq.eu", externalAgentURL)
}

func TestDefaultTraceManagedServicesEnvVarValue(t *testing.T) {
testConfig := setupConfFromYAML("")
assert.Equal(t, true, testConfig.Get("serverless.trace_managed_services"))
}

func TestExplicitFalseTraceManagedServicesEnvVar(t *testing.T) {
t.Setenv("DD_TRACE_MANAGED_SERVICES", "false")
testConfig := setupConfFromYAML("")
assert.Equal(t, false, testConfig.Get("serverless.trace_managed_services"))
}

func TestDDHostnameFileEnvVar(t *testing.T) {
t.Setenv("DD_API_KEY", "fakeapikey")
t.Setenv("DD_HOSTNAME_FILE", "somefile")
Expand Down

0 comments on commit 255f6e7

Please sign in to comment.