Skip to content

Commit 2eb84bc

Browse files
craig[bot]ZhouXing19
andcommitted
Merge #151689
151689: sql: add routine statement counters for tracking execution metrics r=ZhouXing19 a=ZhouXing19 Informs #151173 This commit introduces the following metrics for statements got executed via calling a store procedure or executing a routine: - sql_routine_select_started_count - sql_routine_update_started_count - sql_routine_insert_started_count - sql_routine_delete_started_count - sql_routine_select_count - sql_routine_update_count - sql_routine_insert_count - sql_routine_delete_count The metrics with `started` are for statement that started execution, including those might error during execution. The ones without `started` are those successfully executed. Like the existing counters for sql statements (e.g. sql_select_count), it increments before the changes is committed or aborted in an explicit transaction. These counters are global, as in, calling different routines (i.e. UDF/SPs) will eventually aggregate to the same counter. Release note (sql change): This commit introduces the following metrics for statements got executed via calling a store procedure: sql_routine_select_started_count, sql_routine_update_started_count,sql_routine_insert_started_count, sql_routine_delete_started_count,sql_routine_select_count,sql_routine_update_count,sql_routine_insert_count,sql_routine_delete_count. Co-authored-by: ZhouXing19 <zhouxing@uchicago.edu>
2 parents 87d077a + ef4acb4 commit 2eb84bc

File tree

11 files changed

+870
-48
lines changed

11 files changed

+870
-48
lines changed

docs/generated/metrics/metrics.yaml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,166 @@ layers:
571571
derivative: NON_NEGATIVE_DERIVATIVE
572572
how_to_use: The rate of this metric shows how frequently new connections are being established. This can be useful in determining if a high rate of incoming new connections is causing additional load on the server due to a misconfigured application.
573573
essential: true
574+
- name: sql.routine.delete.count
575+
exported_name: sql_routine_delete_count
576+
labeled_name: 'sql.count{query_type: routine-delete}'
577+
description: Number of SQL DELETE statements successfully executed within routine invocation
578+
y_axis_label: SQL Statements
579+
type: COUNTER
580+
unit: COUNT
581+
aggregation: AVG
582+
derivative: NON_NEGATIVE_DERIVATIVE
583+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
584+
essential: true
585+
- name: sql.routine.delete.count.internal
586+
exported_name: sql_routine_delete_count_internal
587+
labeled_name: 'sql.count{query_type: routine-delete, query_internal: true}'
588+
description: Number of SQL DELETE statements successfully executed within routine invocation (internal queries)
589+
y_axis_label: SQL Internal Statements
590+
type: COUNTER
591+
unit: COUNT
592+
aggregation: AVG
593+
derivative: NON_NEGATIVE_DERIVATIVE
594+
- name: sql.routine.delete.started.count
595+
exported_name: sql_routine_delete_started_count
596+
labeled_name: 'sql.count{query_type: routine-started-delete}'
597+
description: Number of SQL DELETE statements started within routine invocation
598+
y_axis_label: SQL Statements
599+
type: COUNTER
600+
unit: COUNT
601+
aggregation: AVG
602+
derivative: NON_NEGATIVE_DERIVATIVE
603+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
604+
essential: true
605+
- name: sql.routine.delete.started.count.internal
606+
exported_name: sql_routine_delete_started_count_internal
607+
labeled_name: 'sql.count{query_type: routine-started-delete, query_internal: true}'
608+
description: Number of SQL DELETE statements started within routine invocation (internal queries)
609+
y_axis_label: SQL Internal Statements
610+
type: COUNTER
611+
unit: COUNT
612+
aggregation: AVG
613+
derivative: NON_NEGATIVE_DERIVATIVE
614+
- name: sql.routine.insert.count
615+
exported_name: sql_routine_insert_count
616+
labeled_name: 'sql.count{query_type: routine-insert}'
617+
description: Number of SQL INSERT statements successfully executed within routine invocation
618+
y_axis_label: SQL Statements
619+
type: COUNTER
620+
unit: COUNT
621+
aggregation: AVG
622+
derivative: NON_NEGATIVE_DERIVATIVE
623+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
624+
essential: true
625+
- name: sql.routine.insert.count.internal
626+
exported_name: sql_routine_insert_count_internal
627+
labeled_name: 'sql.count{query_type: routine-insert, query_internal: true}'
628+
description: Number of SQL INSERT statements successfully executed within routine invocation (internal queries)
629+
y_axis_label: SQL Internal Statements
630+
type: COUNTER
631+
unit: COUNT
632+
aggregation: AVG
633+
derivative: NON_NEGATIVE_DERIVATIVE
634+
- name: sql.routine.insert.started.count
635+
exported_name: sql_routine_insert_started_count
636+
labeled_name: 'sql.count{query_type: routine-started-insert}'
637+
description: Number of SQL INSERT statements started within routine invocation
638+
y_axis_label: SQL Statements
639+
type: COUNTER
640+
unit: COUNT
641+
aggregation: AVG
642+
derivative: NON_NEGATIVE_DERIVATIVE
643+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
644+
essential: true
645+
- name: sql.routine.insert.started.count.internal
646+
exported_name: sql_routine_insert_started_count_internal
647+
labeled_name: 'sql.count{query_type: routine-started-insert, query_internal: true}'
648+
description: Number of SQL INSERT statements started within routine invocation (internal queries)
649+
y_axis_label: SQL Internal Statements
650+
type: COUNTER
651+
unit: COUNT
652+
aggregation: AVG
653+
derivative: NON_NEGATIVE_DERIVATIVE
654+
- name: sql.routine.select.count
655+
exported_name: sql_routine_select_count
656+
labeled_name: 'sql.count{query_type: routine-select}'
657+
description: Number of SQL SELECT statements successfully executed within routine invocation
658+
y_axis_label: SQL Statements
659+
type: COUNTER
660+
unit: COUNT
661+
aggregation: AVG
662+
derivative: NON_NEGATIVE_DERIVATIVE
663+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
664+
essential: true
665+
- name: sql.routine.select.count.internal
666+
exported_name: sql_routine_select_count_internal
667+
labeled_name: 'sql.count{query_type: routine-select, query_internal: true}'
668+
description: Number of SQL SELECT statements successfully executed within routine invocation (internal queries)
669+
y_axis_label: SQL Internal Statements
670+
type: COUNTER
671+
unit: COUNT
672+
aggregation: AVG
673+
derivative: NON_NEGATIVE_DERIVATIVE
674+
- name: sql.routine.select.started.count
675+
exported_name: sql_routine_select_started_count
676+
labeled_name: 'sql.count{query_type: routine-started-select}'
677+
description: Number of SQL SELECT statements started within routine invocation
678+
y_axis_label: SQL Statements
679+
type: COUNTER
680+
unit: COUNT
681+
aggregation: AVG
682+
derivative: NON_NEGATIVE_DERIVATIVE
683+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
684+
essential: true
685+
- name: sql.routine.select.started.count.internal
686+
exported_name: sql_routine_select_started_count_internal
687+
labeled_name: 'sql.count{query_type: routine-started-select, query_internal: true}'
688+
description: Number of SQL SELECT statements started within routine invocation (internal queries)
689+
y_axis_label: SQL Internal Statements
690+
type: COUNTER
691+
unit: COUNT
692+
aggregation: AVG
693+
derivative: NON_NEGATIVE_DERIVATIVE
694+
- name: sql.routine.update.count
695+
exported_name: sql_routine_update_count
696+
labeled_name: 'sql.count{query_type: routine-update}'
697+
description: Number of SQL UPDATE statements successfully executed within routine invocation
698+
y_axis_label: SQL Statements
699+
type: COUNTER
700+
unit: COUNT
701+
aggregation: AVG
702+
derivative: NON_NEGATIVE_DERIVATIVE
703+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
704+
essential: true
705+
- name: sql.routine.update.count.internal
706+
exported_name: sql_routine_update_count_internal
707+
labeled_name: 'sql.count{query_type: routine-update, query_internal: true}'
708+
description: Number of SQL UPDATE statements successfully executed within routine invocation (internal queries)
709+
y_axis_label: SQL Internal Statements
710+
type: COUNTER
711+
unit: COUNT
712+
aggregation: AVG
713+
derivative: NON_NEGATIVE_DERIVATIVE
714+
- name: sql.routine.update.started.count
715+
exported_name: sql_routine_update_started_count
716+
labeled_name: 'sql.count{query_type: routine-started-update}'
717+
description: Number of SQL UPDATE statements started within routine invocation
718+
y_axis_label: SQL Statements
719+
type: COUNTER
720+
unit: COUNT
721+
aggregation: AVG
722+
derivative: NON_NEGATIVE_DERIVATIVE
723+
how_to_use: This high-level metric reflects workload volume. Monitor this metric to identify abnormal application behavior or patterns over time. If abnormal patterns emerge, apply the metric's time range to the SQL Activity pages to investigate interesting outliers or patterns. For example, on the Transactions page and the Statements page, sort on the Execution Count column. To find problematic sessions, on the Sessions page, sort on the Transaction Count column. Find the sessions with high transaction counts and trace back to a user or application.
724+
essential: true
725+
- name: sql.routine.update.started.count.internal
726+
exported_name: sql_routine_update_started_count_internal
727+
labeled_name: 'sql.count{query_type: routine-started-update, query_internal: true}'
728+
description: Number of SQL UPDATE statements started within routine invocation (internal queries)
729+
y_axis_label: SQL Internal Statements
730+
type: COUNTER
731+
unit: COUNT
732+
aggregation: AVG
733+
derivative: NON_NEGATIVE_DERIVATIVE
574734
- name: sql.select.count
575735
exported_name: sql_select_count
576736
labeled_name: 'sql.count{query_type: select}'

0 commit comments

Comments
 (0)