@@ -531,6 +531,7 @@ def sample_health(samples: list[dict[str, Any]], compose_project: str) -> dict[s
531531 return {
532532 "required" : False ,
533533 "unhealthy_samples" : 0 ,
534+ "unhealthy_field_counts" : {},
534535 "unhealthy_final_sample" : False ,
535536 }
536537
@@ -539,6 +540,10 @@ def sample_health(samples: list[dict[str, Any]], compose_project: str) -> dict[s
539540 "redis_sample_ok" ,
540541 "mysql_sample_ok" ,
541542 )
543+ unhealthy_field_counts = {
544+ field : sum (1 for row in samples if int (row .get (field ) or 0 ) != 1 )
545+ for field in required_ok_fields
546+ }
542547 unhealthy_indexes = [
543548 index
544549 for index , row in enumerate (samples )
@@ -549,6 +554,7 @@ def sample_health(samples: list[dict[str, Any]], compose_project: str) -> dict[s
549554 "required" : True ,
550555 "required_ok_fields" : list (required_ok_fields ),
551556 "unhealthy_samples" : len (unhealthy_indexes ),
557+ "unhealthy_field_counts" : unhealthy_field_counts ,
552558 "unhealthy_sample_indexes" : unhealthy_indexes [:20 ],
553559 "unhealthy_final_sample" : bool (unhealthy_indexes and unhealthy_indexes [- 1 ] == len (samples ) - 1 ),
554560 }
@@ -808,7 +814,8 @@ def main() -> int:
808814 if int (sampling_health .get ("unhealthy_samples" ) or 0 ) > 0 :
809815 failures .append (
810816 "resource sampling failed for "
811- f"{ sampling_health ['unhealthy_samples' ]} compose-backed samples"
817+ f"{ sampling_health ['unhealthy_samples' ]} compose-backed samples "
818+ f"(field failures: { sampling_health .get ('unhealthy_field_counts' )} )"
812819 )
813820 if max_server_memory_bytes > args .max_server_memory_mb * 1024 * 1024 :
814821 failures .append (
0 commit comments