You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql: add routine statement counters for tracking execution metrics
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.
The labeling of these metrics follows guidelines here:
- https://cockroachlabs.slack.com/archives/C063CP41TG9/p1755202224602859
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.
Copy file name to clipboardExpand all lines: docs/generated/metrics/metrics.yaml
+160Lines changed: 160 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -533,6 +533,166 @@ layers:
533
533
derivative: NON_NEGATIVE_DERIVATIVE
534
534
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.
description: Number of SQL DELETE statements successfully executed within routine invocation
540
+
y_axis_label: SQL Statements
541
+
type: COUNTER
542
+
unit: COUNT
543
+
aggregation: AVG
544
+
derivative: NON_NEGATIVE_DERIVATIVE
545
+
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.
description: Number of SQL DELETE statements started within routine invocation
560
+
y_axis_label: SQL Statements
561
+
type: COUNTER
562
+
unit: COUNT
563
+
aggregation: AVG
564
+
derivative: NON_NEGATIVE_DERIVATIVE
565
+
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.
description: Number of SQL INSERT statements successfully executed within routine invocation
580
+
y_axis_label: SQL Statements
581
+
type: COUNTER
582
+
unit: COUNT
583
+
aggregation: AVG
584
+
derivative: NON_NEGATIVE_DERIVATIVE
585
+
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.
description: Number of SQL INSERT statements started within routine invocation
600
+
y_axis_label: SQL Statements
601
+
type: COUNTER
602
+
unit: COUNT
603
+
aggregation: AVG
604
+
derivative: NON_NEGATIVE_DERIVATIVE
605
+
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.
description: Number of SQL SELECT statements successfully executed within routine invocation
620
+
y_axis_label: SQL Statements
621
+
type: COUNTER
622
+
unit: COUNT
623
+
aggregation: AVG
624
+
derivative: NON_NEGATIVE_DERIVATIVE
625
+
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.
description: Number of SQL SELECT statements started within routine invocation
640
+
y_axis_label: SQL Statements
641
+
type: COUNTER
642
+
unit: COUNT
643
+
aggregation: AVG
644
+
derivative: NON_NEGATIVE_DERIVATIVE
645
+
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.
description: Number of SQL UPDATE statements successfully executed within routine invocation
660
+
y_axis_label: SQL Statements
661
+
type: COUNTER
662
+
unit: COUNT
663
+
aggregation: AVG
664
+
derivative: NON_NEGATIVE_DERIVATIVE
665
+
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.
description: Number of SQL UPDATE statements started within routine invocation
680
+
y_axis_label: SQL Statements
681
+
type: COUNTER
682
+
unit: COUNT
683
+
aggregation: AVG
684
+
derivative: NON_NEGATIVE_DERIVATIVE
685
+
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.
0 commit comments