diff --git a/handler/gather/gather_plan_monitor.py b/handler/gather/gather_plan_monitor.py index 81ec817a..f856c6b2 100644 --- a/handler/gather/gather_plan_monitor.py +++ b/handler/gather/gather_plan_monitor.py @@ -148,6 +148,8 @@ def handle_plan_monitor_from_ob(cluster_name): sql_plan_monitor_detail_v2 = str(sql_plan_monitor_detail_template).replace("##REPLACE_TRACE_ID##", trace_id).replace("##REPLACE_ORDER_BY##", "PROCESS_NAME ASC, PLAN_LINE_ID ASC, FIRST_REFRESH_TIME ASC") sql_plan_monitor_dfo_op = self.sql_plan_monitor_dfo_op_sql(tenant_id, plan_id, trace_id, svr_ip, svr_port) + sql_ash_top_event = self.sql_ash_top_event_sql(tenant_id, trace_id) + sql_plan_monitor_db_time = self.sql_plan_monitor_db_time_sql(tenant_id, trace_id) full_audit_sql_by_trace_id_sql = self.full_audit_sql_by_trace_id_sql(trace_id) plan_explain_sql = self.plan_explain_sql(tenant_id, plan_id, svr_ip, svr_port) @@ -167,6 +169,9 @@ def handle_plan_monitor_from_ob(cluster_name): # 输出表结构的信息 self.stdio.verbose("[sql plan monitor report task] report table schema") self.report_schema(user_sql, tenant_name) + # ASH 统计 + self.stdio.verbose("[ash report task] report ash, sql: [{0}]".format(sql_ash_top_event)) + self.report_ash_obversion4(sql_ash_top_event) self.init_monitor_stat() # 输出sql_audit的详细信息 self.stdio.verbose("[sql plan monitor report task] report sql_audit details") @@ -174,6 +179,9 @@ def handle_plan_monitor_from_ob(cluster_name): # 输出算子信息 表+图 self.stdio.verbose("[sql plan monitor report task] report sql plan monitor dfo") self.report_sql_plan_monitor_dfo_op(sql_plan_monitor_dfo_op) + # db time + self.stdio.verbose("[db time display task] report db time display") + self.report_db_time_display_op(sql_plan_monitor_db_time) # 输出算子信息按 svr 级汇总 表+图 self.stdio.verbose("[sql plan monitor report task] report sql plan monitor group by server") self.report_sql_plan_monitor_svr_agg(sql_plan_monitor_svr_agg_v1, sql_plan_monitor_svr_agg_v2) @@ -324,7 +332,10 @@ def report_pre(self, s): self.__report(pre) def report_header(self): - header = GlobalHtmlMeta().get_value(key="sql_plan_monitor_report_header") + if self.ob_major_version >= 4: + header = GlobalHtmlMeta().get_value(key="sql_plan_monitor_report_header_obversion4") + else: + header = GlobalHtmlMeta().get_value(key="sql_plan_monitor_report_header") with open(self.report_file_path, 'w') as f: f.write(header) self.stdio.verbose("report header complete") @@ -627,6 +638,7 @@ def report_svr_agg_graph_data_obversion4(self, ident, cursor, title=''): def report_fast_preview(self): content = ''' + + + + + +
+