Skip cluster metadata collection when telemetry is disabled (#1261)

collect_cluster_metadata runs unconditionally after every scenario,
even when telemetry.enabled is false. On large OpenShift clusters
(e.g. ROSA with many namespaces), this takes up to 15 minutes
listing all Pods, Secrets, ConfigMaps, Routes, Builds, and nodes.

Guard the call with a telemetry.enabled check (default: true) so
base runs still collect metadata but users can opt out by setting
telemetry.enabled: false in their config.

Signed-off-by: Elijah DeLee <kdelee@redhat.com>
Co-authored-by: Paige Patton <64206430+paigerube14@users.noreply.github.com>
This commit is contained in:
Elijah DeLee
2026-05-07 12:39:06 -04:00
committed by GitHub
co-authored by Paige Patton
parent d202e3d196
commit e857f33cdb
+12 -10
View File
@@ -497,17 +497,19 @@ def main(options, command: Optional[str]) -> int:
post_kubevirt_check = kubevirt_checker.gather_post_virt_checks(kubevirt_check_telem)
chaos_telemetry.post_virt_checks = post_kubevirt_check
# if platform is openshift will be collected
# Cloud platform and network plugins metadata
# through OCP specific APIs
if distribution == "openshift":
logging.info(
"collecting OCP cluster metadata, this may take few minutes...."
)
telemetry_ocp.collect_cluster_metadata(chaos_telemetry)
# Collect cluster metadata only when telemetry is enabled
# (listing all k8s objects is very slow on large clusters)
if config["telemetry"].get("enabled", True):
if distribution == "openshift":
logging.info(
"collecting OCP cluster metadata, this may take few minutes...."
)
telemetry_ocp.collect_cluster_metadata(chaos_telemetry)
else:
logging.info("collecting Kubernetes cluster metadata....")
telemetry_k8s.collect_cluster_metadata(chaos_telemetry)
else:
logging.info("collecting Kubernetes cluster metadata....")
telemetry_k8s.collect_cluster_metadata(chaos_telemetry)
logging.info("telemetry disabled, skipping cluster metadata collection")
# Collect error logs from handler
error_logs = error_collection_handler.get_error_logs()