Support file-based configurations (Phase 1)#3438
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 4562 Passed, 65 Skipped, 3m 16.41s Total Time |
…es. Plus, apply stable config check to all phase 1 env vars, except for DD_APSEC_ENABLED
| "github.com/DataDog/dd-trace-go/v2/internal/telemetry" | ||
| ) | ||
|
|
||
| func BoolStableConfig(env string, def bool) (value bool, origin telemetry.Origin, err error) { |
There was a problem hiding this comment.
Should BoolStableConfig and StringStableConfig live in internal/env.go instead?
0435678 to
d8fb6c4
Compare
nsrip-dd
left a comment
There was a problem hiding this comment.
Approving for the profiling portion of the change. Let me know if you want me to take a closer look at the rest.
eliottness
left a comment
There was a problem hiding this comment.
Awesome work. Excited to test it 👍
| localFilePath = "/etc/datadog-agent/application_monitoring.yaml" | ||
| managedFilePath = "/etc/datadog-agent/managed/datadog-agent/stable/application_monitoring.yaml" |
There was a problem hiding this comment.
Will this work on Windows ?
There was a problem hiding this comment.
No. Support is for linux, only (ref). Thanks to your comment, I've now called this out on line 19.
There was a problem hiding this comment.
This would probably warrant a test or at least a manual check in our windows CI to make we dont spit any uncomprehensible errors/logs for windows users. If it is the case then adding a if runtime.GOOS == "linux" somewhere could be something. WDYT ?
| if val, err := strconv.ParseBool(v); err == nil { | ||
| return val, o, nil | ||
| } | ||
| err = fmt.Errorf("non-boolean value for %s: '%s' in %s configuration, dropping", env, v, o) |
There was a problem hiding this comment.
I would say it makes sense to use errors.Join if there is multiple errors here.
Also maybe adding a special case to not report an error if val is an empty string can also make sense I believe
There was a problem hiding this comment.
Would it be possible to have functions for duration, for int, for float and for net.IP to cover all cases that where previously convered by internal/env.go?
There was a problem hiding this comment.
I am also wondering if we should call telemetry.RegisterAppConfig directly here. What do you think?
There was a problem hiding this comment.
Would it be possible to have functions for duration, for int, for float and for net.IP...
Yes, I will add this in a separate PR, so that this work is not blocked! #3537
I am also wondering if we should call telemetry.RegisterAppConfig directly here. What do you think?
Good idea. Telemetry will be added in a separate PR, as part of Phase "1.5," also scheduled for this quarter (by contrast, sourcing stable configurations is "Phase 1").
3076429 to
a49337b
Compare
What does this PR do?
Support reading product-enablement configurations from user-managed (
/etc/datadog-agent/application_monitoring.yaml) and fleet-managed (/etc/datadog-agent/managed/datadog-agent/stable/application_monitoring.yaml) yaml files for dd-trace-go. In-scope configurations include:DD_APM_TRACING_ENABLEDDD_RUNTIME_METRICS_ENABLEDDD_LOGS_INJECTIONDD_PROFILING_ENABLEDDD_DATA_STREAMS_ENABLEDDD_APPSEC_ENABLEDDD_IAST_ENABLEDDD_DYNAMIC_INSTRUMENTATION_ENABLEDDD_DATA_JOBS_ENABLEDDD_APPSEC_SCA_ENABLEDDD_TRACE_DEBUGRFC: Stable Configuration Phase 1
Notes
APMAPI-1358are just markers for the next phase of work, where we report Origin to telemetry.Testing
This PR passes all system-tests as per: DataDog/system-tests#4604. To pass the system-tests, I had to update the startup log to include data streams info.
Motivation
Reviewer's Checklist
golangci-lint runlocally.Unsure? Have a question? Request a review!