Skip to content

Commit

Permalink
system-probe: flare: Pull runtime configuration via the config handle…
Browse files Browse the repository at this point in the history
…r of system-probe (#33655)

(cherry picked from commit 5025a79)
  • Loading branch information
guyarb authored and github-actions[bot] committed Feb 4, 2025
1 parent d70c1e4 commit 557f13b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/flare/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ func provideRemoteConfig(fb flaretypes.FlareBuilder) error {
}

func provideConfigDump(fb flaretypes.FlareBuilder) error {
fb.AddFileFromFunc("process_agent_runtime_config_dump.yaml", getProcessAgentFullConfig) //nolint:errcheck
fb.AddFileFromFunc("runtime_config_dump.yaml", func() ([]byte, error) { return yaml.Marshal(pkgconfigsetup.Datadog().AllSettings()) }) //nolint:errcheck
fb.AddFileFromFunc("system_probe_runtime_config_dump.yaml", func() ([]byte, error) { return yaml.Marshal(pkgconfigsetup.SystemProbe().AllSettings()) }) //nolint:errcheck
fb.AddFileFromFunc("process_agent_runtime_config_dump.yaml", getProcessAgentFullConfig) //nolint:errcheck
fb.AddFileFromFunc("runtime_config_dump.yaml", func() ([]byte, error) { return yaml.Marshal(pkgconfigsetup.Datadog().AllSettings()) }) //nolint:errcheck
return nil
}

Expand All @@ -148,6 +147,10 @@ func provideSystemProbe(fb flaretypes.FlareBuilder) error {
if pkgconfigsetup.SystemProbe().GetBool("system_probe_config.enabled") {
_ = fb.AddFileFromFunc(filepath.Join("expvar", "system-probe"), getSystemProbeStats)
_ = fb.AddFileFromFunc(filepath.Join("system-probe", "system_probe_telemetry.log"), getSystemProbeTelemetry)
_ = fb.AddFileFromFunc("system_probe_runtime_config_dump.yaml", getSystemProbeConfig)
} else {
// If system probe is disabled, we still want to include the system probe config file
_ = fb.AddFileFromFunc("system_probe_runtime_config_dump.yaml", func() ([]byte, error) { return yaml.Marshal(pkgconfigsetup.SystemProbe().AllSettings()) })
}
return nil
}
Expand Down Expand Up @@ -261,6 +264,12 @@ func getSystemProbeTelemetry() ([]byte, error) {
return getHTTPData(sysProbeClient, url)
}

func getSystemProbeConfig() ([]byte, error) {
sysProbeClient := sysprobeclient.Get(getSystemProbeSocketPath())
url := sysprobeclient.URL("/config")
return getHTTPData(sysProbeClient, url)
}

// getProcessAgentFullConfig fetches process-agent runtime config as YAML and returns it to be added to process_agent_runtime_config_dump.yaml
func getProcessAgentFullConfig() ([]byte, error) {
addressPort, err := pkgconfigsetup.GetProcessAPIAddressPort(pkgconfigsetup.Datadog())
Expand Down

0 comments on commit 557f13b

Please sign in to comment.