datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

[ASCII-1169] Refresh non-core agents configs using core-agent API

Open pgimalac opened this issue 1 year ago • 4 comments

What does this PR do?

Implement synchronizing config values in non-core agent using the API of the core agent as source of truth.

Motivation

Enabling API key refresh in non-core agents, and in general enabling updating non-core agents config values (not just API key).

Additional Notes

The list of config keys which can be refreshed is hardcoded here.

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Ideally I would like to write an e2e test for this feature but leaving manual QA instructions here in case I don't have time before the freeze.

Use the same setup as in the QA instructions of https://github.com/DataDog/datadog-agent/pull/22031.

Set the configs controlling this feature so that is it enabled:

  • agent_ipc.port: 5004
  • agent_ipc.config_refresh_interval: 30

Then:

  • start the core agent, trace-agent, process-agent, and security-agent
  • check that they both resolve the api key to the correct value
  • run touch alt.cfg so that the script starts returning the second API key
  • run datadog-agent secret refresh so that the core-agent resolve the new secret
  • check that after the period configured in agent_ipc.config_refresh_interval, the api_key is also refreshed in the non-core agents

The security-agent also needs to be tested specifically on Windows as its start function is different.

pgimalac avatar Feb 27 '24 17:02 pgimalac

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: a0dc73fb-a2a9-4337-a721-ab03ee4b02fd Baseline: 3365b2a179dcbcee7655eae2e550444d712b1593 Comparison: 1d4eb9a75c1eeae67e5f8760318cdf0b93748c11

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

Experiments with missing or malformed data

  • basic_py_check

Usually, this warning means that there is no usable optimization goal data for that experiment, which could be a result of misconfiguration.

No significant changes in experiment optimization goals

Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.73 [-5.82, +7.28]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.73 [-5.82, +7.28]
process_agent_standard_check_with_stats memory utilization +0.35 [+0.31, +0.38]
uds_dogstatsd_to_api_cpu % cpu utilization +0.34 [-1.06, +1.74]
file_tree memory utilization +0.34 [+0.25, +0.43]
process_agent_real_time_mode memory utilization +0.11 [+0.07, +0.14]
idle memory utilization +0.08 [+0.05, +0.11]
trace_agent_json ingress throughput +0.02 [-0.00, +0.04]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.00, +0.00]
trace_agent_msgpack ingress throughput -0.03 [-0.04, -0.02]
process_agent_standard_check memory utilization -0.14 [-0.17, -0.10]
otel_to_otel_logs ingress throughput -0.69 [-1.32, -0.07]
tcp_syslog_to_blackhole ingress throughput -0.76 [-0.81, -0.71]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

pr-commenter[bot] avatar Feb 27 '24 19:02 pr-commenter[bot]

Go Package Import Differences

Baseline: 8879d8e06d8977b2a8d5e1b1cdb9893d4dc3c77a Comparison: f85a0ac0b4849b23f793a42e21d7ebf9b946a6e2

binaryosarchchange
process-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
process-agentlinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
process-agentwindowsamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
process-agentdarwinamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
process-agentdarwinarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
heroku-process-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
security-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
security-agentlinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
trace-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
trace-agentlinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
trace-agentwindowsamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
trace-agentwindows386
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
trace-agentdarwinamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
trace-agentdarwinarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl
heroku-trace-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/api/authtoken
+github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl
+github.com/DataDog/datadog-agent/comp/core/configsync
+github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl

cit-pr-commenter[bot] avatar Mar 14 '24 13:03 cit-pr-commenter[bot]

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=30441082 --os-family=ubuntu

pr-commenter[bot] avatar Mar 14 '24 14:03 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: e0fb8bfc-b5f7-4ff1-b770-b7c911fdfdb9 Baseline: 8879d8e06d8977b2a8d5e1b1cdb9893d4dc3c77a Comparison: f85a0ac0b4849b23f793a42e21d7ebf9b946a6e2

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +2.42 [-4.00, +8.84]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
pycheck_1000_100byte_tags % cpu utilization +2.95 [-2.03, +7.93]
file_to_blackhole % cpu utilization +2.42 [-4.00, +8.84]
tcp_syslog_to_blackhole ingress throughput +1.42 [+1.34, +1.50]
uds_dogstatsd_to_api_cpu % cpu utilization +0.88 [-1.82, +3.58]
process_agent_standard_check_with_stats memory utilization +0.19 [+0.16, +0.22]
process_agent_real_time_mode memory utilization +0.15 [+0.10, +0.20]
process_agent_standard_check memory utilization +0.02 [-0.02, +0.07]
tcp_dd_logs_filter_exclude ingress throughput +0.01 [-0.00, +0.03]
trace_agent_json ingress throughput +0.01 [-0.01, +0.04]
trace_agent_msgpack ingress throughput +0.00 [-0.00, +0.00]
uds_dogstatsd_to_api ingress throughput -0.00 [-0.21, +0.20]
otel_to_otel_logs ingress throughput -0.04 [-0.48, +0.41]
file_tree memory utilization -0.22 [-0.32, -0.12]
basic_py_check % cpu utilization -0.22 [-2.74, +2.30]
idle memory utilization -0.64 [-0.67, -0.60]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

pr-commenter[bot] avatar Mar 14 '24 14:03 pr-commenter[bot]

/merge

pgimalac avatar Mar 20 '24 17:03 pgimalac

:steam_locomotive: MergeQueue

Pull request added to the queue.

There are 4 builds ahead! (estimated merge in less than 28m)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Mar 20 '24 17:03 dd-devflow[bot]