{
  "case_id": "representative-business-slow-queries-in-saas01-during-latest-window",
  "hook_runs": [
    {
      "args": [
        "resolve-window",
        "--cluster-id",
        "{{environment.cluster_id}}",
        "--cluster-label",
        "{{environment.cluster_label}}",
        "--local-hour",
        "11",
        "--local-minute",
        "0",
        "--duration-minutes",
        "5",
        "--top-n",
        "3"
      ],
      "id": "resolve_runtime_window",
      "kind": "python_script",
      "output_id": "resolved_window",
      "output_path": "runtime/resolved_window.json",
      "path": "runtime_hook.py",
      "required": true,
      "stage": "before_acp",
      "status": "ok"
    },
    {
      "args": [
        "build-reference",
        "--cluster-id",
        "{{environment.cluster_id}}",
        "--cluster-label",
        "{{environment.cluster_label}}",
        "--start",
        "{{runtime.resolved_window.start}}",
        "--end",
        "{{runtime.resolved_window.end}}",
        "--top-n",
        "3"
      ],
      "id": "build_runtime_reference",
      "kind": "python_script",
      "output_id": "reference_answer",
      "output_path": "runtime/reference_answer.json",
      "path": "runtime_hook.py",
      "required": true,
      "stage": "before_judge",
      "status": "ok"
    }
  ],
  "outputs": {
    "reference_answer": {
      "data": {
        "cluster_id": "10989049060142230334",
        "cluster_label": "saas01",
        "debug": {
          "excluded_control_sql_count": 5,
          "filter_rule": "exclude_transaction_and_control_sql",
          "query_sql": "SELECT digest, any_value(query) AS sample_sql, COUNT(*) AS exec_count, MAX(query_time) AS max_time, AVG(query_time) AS avg_time, MAX(mem_max) AS max_mem FROM clinic_data_proxy.slow_query_logs WHERE date = '20260721' AND time >= 1784602800 AND time <= 1784603100 GROUP BY digest ORDER BY exec_count DESC LIMIT 30",
          "ranking_rule": "exec_count_desc_then_avg_time_desc_then_digest_asc",
          "raw_row_count": 30
        },
        "evidence_sufficient": true,
        "reference_rows": [
          {
            "avg_time_s": 2.549,
            "digest": "2d142ccf344650a9226ea89d072cdae8eeb850fff82d96e8bf0406cdf52ee69f",
            "exec_count": 404,
            "sample_sql_preview": "SELECT `dh_active_receive_logs`.`id`,`dh_active_receive_logs`.`activeType`,`dh_active_receive_logs`.`useridx`,`dh_active_receive_logs`.`username`,`dh_active_receive_logs`.`account_"
          },
          {
            "avg_time_s": 1.052,
            "digest": "18576e217f5f93fa2a934f84290447caa4b783cab493503c4ad71c912ea16930",
            "exec_count": 123,
            "sample_sql_preview": "SELECT * FROM `dh_audit_record` WHERE (user_id = ? and site_code = ?) AND status in (?,?,?) AND charge_time < ? ORDER BY charge_time asc,id asc [arguments: (677577915, \"5073\", 1, 2"
          },
          {
            "avg_time_s": 1.553,
            "digest": "7d75919b6fcc6bbbc8516539ac4a165887c4a9765b9e986314ef43ab77267874",
            "exec_count": 95,
            "sample_sql_preview": "SELECT ? as create_ymd,t2.register_currency as currency,IFNULL(t2.club_id,0) as club_id,count(distinct t1.useridx) as login_persons FROM dh_user_action_logs as t1 left join dh_acco"
          }
        ],
        "slow_queries": [
          {
            "avg_time_s": 2.549,
            "digest": "2d142ccf344650a9226ea89d072cdae8eeb850fff82d96e8bf0406cdf52ee69f",
            "exec_count": 404
          },
          {
            "avg_time_s": 1.052,
            "digest": "18576e217f5f93fa2a934f84290447caa4b783cab493503c4ad71c912ea16930",
            "exec_count": 123
          },
          {
            "avg_time_s": 1.553,
            "digest": "7d75919b6fcc6bbbc8516539ac4a165887c4a9765b9e986314ef43ab77267874",
            "exec_count": 95
          }
        ],
        "window": {
          "end": "2026-07-21T03:05:00Z",
          "start": "2026-07-21T03:00:00Z"
        }
      },
      "path": "runtime/reference_answer.json",
      "stage": "before_judge"
    },
    "resolved_window": {
      "data": {
        "cluster_id": "10989049060142230334",
        "cluster_label": "saas01",
        "duration_minutes": 5,
        "end": "2026-07-21T03:05:00Z",
        "filter_rule": "exclude_transaction_and_control_sql",
        "id": "bjt-2026-07-21-1100-5m",
        "local_date": "2026-07-21",
        "local_timezone": "Asia/Shanghai",
        "ranking_rule": "exec_count_desc_then_avg_time_desc_then_digest_asc",
        "start": "2026-07-21T03:00:00Z",
        "top_n": 3
      },
      "path": "runtime/resolved_window.json",
      "stage": "before_acp"
    }
  },
  "schema_version": 1,
  "template_context": {
    "audit": {
      "dir": "/data/eval_audits/evalrun-9ca3e149083040cfa6e5a554382fc030/evalcase-5f2c9ecf4b124edfb6000bcb9431a778"
    },
    "case": {
      "case_version": "d540a138adf6",
      "id": "representative-business-slow-queries-in-saas01-during-latest-window"
    },
    "environment": {
      "cluster_id": "10989049060142230334",
      "cluster_label": "saas01",
      "cluster_type": "dedicated",
      "profile": "stable-dedicated",
      "tidb_version": "v8.5.x"
    },
    "time_window": {
      "resolved_by_output": "resolved_window"
    },
    "workspace": {
      "dir": "/data/workspaces/ws-eval-1784628501401-3950606f",
      "id": "ws-eval-1784628501401-3950606f"
    }
  },
  "workspace_id": "ws-eval-1784628501401-3950606f"
}
