Skip to content

Conversation

@gabedos
Copy link
Contributor

@gabedos gabedos commented Jan 27, 2026

What does this PR do?

For legacy reasons, the kube_endpoint_file Autodiscovery config provider does not function independently like other file providers. This provider also listens to KubeEndpoints as well to provide some additional configuration to the check config. The provider ends up caching all the Endpoint objects which are tied to a config.

With the previous implementation, every single Endpoint on a cluster could be potentially associated with a config using a CELSelector and thus this provider would end up caching every endpoint definition even if it ends up being unneeded downstream.

Thus, this PR shifts up the CELSelector filtering for KubeEndpoints upstream into the KubeEndpointsFileConfigProvider so that the decision to store an endpoint earlier and can properly discard endpoints that will never be monitored.

Note: no additional cost is paid by users who don't have an CELSelector based KubeEndpoint check definitions defined on the Cluster Agent's filesystem.

Motivation

Clean up implementation for kube_endpoint_file Autodiscovery config provider to avoid caching unneeded Endpoints in memory.

Describe how you validated your changes

Unit Tests and CI

@github-actions github-actions bot added team/container-platform The Container Platform Team medium review PR review might take time labels Jan 27, 2026
@gabedos gabedos force-pushed the gabedos/optimize-kube-endpoints-cel-selector branch from 46add72 to 167bc02 Compare January 27, 2026 23:52
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Jan 28, 2026

Go Package Import Differences

Baseline: 73bca2a
Comparison: 362f0ae

binaryosarchchange
dogstatsdlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
dogstatsdlinuxarm64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
process-agentlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
process-agentlinuxarm64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
process-agentwindowsamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
process-agentdarwinamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
process-agentdarwinarm64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
heroku-process-agentlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
otel-agentlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
otel-agentlinuxarm64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
installerlinuxamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
installerlinuxarm64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types
installerwindowsamd64
+1, -0
+github.com/DataDog/datadog-agent/comp/core/autodiscovery/common/types

@gabedos gabedos force-pushed the gabedos/optimize-kube-endpoints-cel-selector branch from 167bc02 to 362f0ae Compare January 28, 2026 03:17
@agent-platform-auto-pr
Copy link
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 73bca2a
📊 Static Quality Gates Dashboard

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 -13.3 KiB (0.00% reduction) 752.300 → 752.287 → 754.830
agent_deb_amd64_fips -13.27 KiB (0.00% reduction) 700.981 → 700.969 → 704.000
agent_heroku_amd64 -13.36 KiB (0.00% reduction) 326.623 → 326.610 → 329.530
agent_msi -7.49 KiB (0.00% reduction) 662.887 → 662.880 → 1072.620
agent_rpm_amd64 -13.3 KiB (0.00% reduction) 752.284 → 752.271 → 754.800
agent_rpm_amd64_fips -13.27 KiB (0.00% reduction) 700.965 → 700.952 → 703.990
agent_rpm_arm64 -13.33 KiB (0.00% reduction) 731.036 → 731.023 → 737.340
agent_rpm_arm64_fips -9.27 KiB (0.00% reduction) 683.087 → 683.078 → 688.480
agent_suse_amd64 -13.3 KiB (0.00% reduction) 752.284 → 752.271 → 754.800
agent_suse_amd64_fips -13.27 KiB (0.00% reduction) 700.965 → 700.952 → 703.990
agent_suse_arm64 -13.33 KiB (0.00% reduction) 731.036 → 731.023 → 737.340
agent_suse_arm64_fips -9.27 KiB (0.00% reduction) 683.087 → 683.078 → 688.480
docker_agent_amd64 -6.61 KiB (0.00% reduction) 814.422 → 814.415 → 817.140
docker_agent_arm64 -13.36 KiB (0.00% reduction) 817.808 → 817.794 → 824.020
docker_agent_jmx_amd64 -13.33 KiB (0.00% reduction) 1005.300 → 1005.287 → 1008.020
docker_agent_jmx_arm64 -13.36 KiB (0.00% reduction) 997.405 → 997.392 → 1003.620
docker_cluster_agent_amd64 +4.0 KiB (0.00% increase) 181.177 → 181.181 → 181.200
14 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
docker_cluster_agent_arm64 196.983 MiB
docker_cws_instrumentation_amd64 7.135 MiB
docker_cws_instrumentation_arm64 6.689 MiB
docker_dogstatsd_amd64 38.816 MiB
docker_dogstatsd_arm64 37.127 MiB
dogstatsd_deb_amd64 30.035 MiB
dogstatsd_deb_arm64 28.184 MiB
dogstatsd_rpm_amd64 30.035 MiB
dogstatsd_suse_amd64 30.035 MiB
iot_agent_deb_amd64 43.013 MiB
iot_agent_deb_arm64 40.119 MiB
iot_agent_deb_armhf 40.689 MiB
iot_agent_rpm_amd64 43.014 MiB
iot_agent_suse_amd64 43.014 MiB
On-wire sizes (compressed)
Quality gate Change Size (prev → curr → max)
agent_deb_amd64 -25.24 KiB (0.01% reduction) 183.845 → 183.821 → 184.810
agent_deb_amd64_fips -46.61 KiB (0.03% reduction) 172.601 → 172.555 → 173.790
agent_heroku_amd64 neutral 87.117 MiB → 88.450
agent_msi +16.0 KiB (0.01% increase) 143.109 → 143.125 → 143.300
agent_rpm_amd64 +18.83 KiB (0.01% increase) 186.827 → 186.845 → 188.160
agent_rpm_amd64_fips -19.48 KiB (0.01% reduction) 175.640 → 175.621 → 176.600
agent_rpm_arm64 +19.32 KiB (0.01% increase) 168.467 → 168.486 → 169.930
agent_rpm_arm64_fips +48.19 KiB (0.03% increase) 159.104 → 159.151 → 160.550
agent_suse_amd64 +18.83 KiB (0.01% increase) 186.827 → 186.845 → 188.160
agent_suse_amd64_fips -19.48 KiB (0.01% reduction) 175.640 → 175.621 → 176.600
agent_suse_arm64 +19.32 KiB (0.01% increase) 168.467 → 168.486 → 169.930
agent_suse_arm64_fips +48.19 KiB (0.03% increase) 159.104 → 159.151 → 160.550
docker_agent_amd64 -11.76 KiB (0.00% reduction) 276.541 → 276.530 → 277.400
docker_agent_arm64 -28.19 KiB (0.01% reduction) 263.970 → 263.942 → 266.040
docker_agent_jmx_amd64 -14.69 KiB (0.00% reduction) 345.175 → 345.160 → 346.020
docker_agent_jmx_arm64 -25.36 KiB (0.01% reduction) 328.586 → 328.561 → 330.660
docker_cluster_agent_amd64 -4.1 KiB (0.01% reduction) 64.003 → 63.999 → 64.510
docker_cluster_agent_arm64 neutral 60.267 MiB → 61.170
docker_cws_instrumentation_amd64 neutral 2.994 MiB → 3.330
docker_cws_instrumentation_arm64 neutral 2.726 MiB → 3.090
docker_dogstatsd_amd64 neutral 15.023 MiB → 15.820
docker_dogstatsd_arm64 -6.63 KiB (0.05% reduction) 14.350 → 14.344 → 14.830
dogstatsd_deb_amd64 neutral 7.939 MiB → 8.790
dogstatsd_deb_arm64 neutral 6.821 MiB → 7.710
dogstatsd_rpm_amd64 neutral 7.950 MiB → 8.800
dogstatsd_suse_amd64 neutral 7.950 MiB → 8.800
iot_agent_deb_amd64 -2.55 KiB (0.02% reduction) 11.288 → 11.286 → 12.040
iot_agent_deb_arm64 neutral 9.646 MiB → 10.450
iot_agent_deb_armhf neutral 9.842 MiB → 10.620
iot_agent_rpm_amd64 -2.17 KiB (0.02% reduction) 11.306 → 11.304 → 12.060
iot_agent_suse_amd64 -2.17 KiB (0.02% reduction) 11.306 → 11.304 → 12.060

@cit-pr-commenter-54b7da
Copy link

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 7ba6d8a4-b1be-4a98-b124-556959683683

Baseline: 73bca2a
Comparison: 362f0ae
Diff

Optimization Goals: ✅ Improvement(s) detected

perf experiment goal Δ mean % Δ mean % CI trials links
tcp_syslog_to_blackhole ingress throughput +40.46 [+40.38, +40.54] 1 Logs
quality_gate_logs % cpu utilization -51.56 [-52.91, -50.21] 1 Logs bounds checks dashboard

Experiments ignored for regressions

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

perf experiment goal Δ mean % Δ mean % CI trials links
docker_containers_cpu % cpu utilization -3.72 [-6.81, -0.63] 1 Logs

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
tcp_syslog_to_blackhole ingress throughput +40.46 [+40.38, +40.54] 1 Logs
uds_dogstatsd_to_api ingress throughput +0.02 [-0.11, +0.16] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.10, +0.09] 1 Logs
uds_dogstatsd_to_api_v3 ingress throughput -0.01 [-0.14, +0.11] 1 Logs
ddot_metrics_sum_cumulativetodelta_exporter memory utilization -0.12 [-0.35, +0.11] 1 Logs
ddot_logs memory utilization -0.27 [-0.34, -0.20] 1 Logs
ddot_metrics_sum_cumulative memory utilization -0.58 [-0.75, -0.42] 1 Logs
ddot_metrics memory utilization -0.61 [-0.82, -0.40] 1 Logs
file_to_blackhole_0ms_latency egress throughput -0.65 [-1.13, -0.16] 1 Logs
file_to_blackhole_500ms_latency egress throughput -0.65 [-1.04, -0.25] 1 Logs
file_to_blackhole_100ms_latency egress throughput -0.66 [-0.70, -0.62] 1 Logs
file_to_blackhole_1000ms_latency egress throughput -0.68 [-1.07, -0.30] 1 Logs
ddot_metrics_sum_delta memory utilization -1.29 [-1.50, -1.09] 1 Logs
quality_gate_idle_all_features memory utilization -2.56 [-2.60, -2.53] 1 Logs bounds checks dashboard
docker_containers_memory memory utilization -2.63 [-2.72, -2.55] 1 Logs
file_tree memory utilization -2.66 [-2.71, -2.60] 1 Logs
quality_gate_idle memory utilization -2.68 [-2.72, -2.64] 1 Logs bounds checks dashboard
otlp_ingest_metrics memory utilization -2.90 [-3.05, -2.75] 1 Logs
otlp_ingest_logs memory utilization -2.91 [-3.00, -2.82] 1 Logs
uds_dogstatsd_20mb_12k_contexts_20_senders memory utilization -3.01 [-3.06, -2.96] 1 Logs
docker_containers_cpu % cpu utilization -3.72 [-6.81, -0.63] 1 Logs
quality_gate_metrics_logs memory utilization -4.17 [-4.37, -3.98] 1 Logs bounds checks dashboard
quality_gate_logs % cpu utilization -51.56 [-52.91, -50.21] 1 Logs bounds checks dashboard

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
docker_containers_cpu simple_check_run 10/10
docker_containers_memory memory_usage 10/10
docker_containers_memory simple_check_run 10/10
file_to_blackhole_0ms_latency lost_bytes 10/10
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency lost_bytes 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_100ms_latency lost_bytes 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency lost_bytes 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
quality_gate_idle intake_connections 10/10 bounds checks dashboard
quality_gate_idle memory_usage 10/10 bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 bounds checks dashboard
quality_gate_logs intake_connections 10/10 bounds checks dashboard
quality_gate_logs lost_bytes 10/10 bounds checks dashboard
quality_gate_logs memory_usage 10/10 bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 bounds checks dashboard
quality_gate_metrics_logs lost_bytes 10/10 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 bounds checks dashboard

Explanation

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

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

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".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

medium review PR review might take time team/container-platform The Container Platform Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants