This doc describes how to define new configuration parameters for the Agent.
- Define your config.
- Add it to the config template (optional).
- Use your config in your code.
- Request a review from the Agent configuration team (team/agent-configuration)
If you have any questions, head over to #agent-configuration and ask (datadog internal).
A config must be declared before it can be used. If you don't do this, the Agent will log warnings about missing config at runtime that look like:
WARN | config keyconfig key "config.subsystem.bananas" is unknown
There are multiple places a config can be defined:
-
Above all else, prefer consistency. If there's existing similar config, put the new config item alongside that existing config.
-
If you want your config to be defined by the user in
system-probe.ymlthen your declaration belongs insystem_probe.go. -
Otherwise it lives in the default
datadog-agent.yamlfile and goes inconfig.go.
By default newly declared configs are not added to the sample config file a user sees.
If you want your config to appear in the sample config file, add it to the config template.
You can access your configured value (or the declared default) using the config
model.Reader. For example:
if cfg.GetBool("config.subsystem.bananas") {
// Go bananas
}See the package documentation for available methods.
Please add this label to your PRs: team/agent-configuration
This will summon a config wizard who can review your changes and suggest any changes.