Skip to content

Commit c19c6df

Browse files
committed
metric: add labels for sql.*.started.count
Previously, only metrics for *executed* `SELECT|UPDATE|DELETE|INSERT` statements are labeled, while their *started* equivalent are not labeled. This commit is to label these metrics. Ref #143536 Release note (ops change): sql.select.started.count, sql.insert.started.count, sql.update.started.count, sql.delete.started.count are now labeled with sql.started.count. <what was there before: Previously, ...> <why it needed to change: This was inadequate because ...> <what you did about it: To address this, this patch ...>
1 parent 892744f commit c19c6df

File tree

2 files changed

+108
-80
lines changed

2 files changed

+108
-80
lines changed

docs/generated/metrics/metrics.yaml

Lines changed: 76 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,25 @@ layers:
518518
unit: COUNT
519519
aggregation: AVG
520520
derivative: NON_NEGATIVE_DERIVATIVE
521+
- name: sql.delete.started.count
522+
exported_name: sql_delete_started_count
523+
labeled_name: 'sql.started.count{query_type: delete}'
524+
description: Number of SQL DELETE statements started
525+
y_axis_label: SQL Statements
526+
type: COUNTER
527+
unit: COUNT
528+
aggregation: AVG
529+
derivative: NON_NEGATIVE_DERIVATIVE
530+
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.
531+
- name: sql.delete.started.count.internal
532+
exported_name: sql_delete_started_count_internal
533+
labeled_name: 'sql.started.count{query_type: delete, query_internal: true}'
534+
description: Number of SQL DELETE statements started (internal queries)
535+
y_axis_label: SQL Internal Statements
536+
type: COUNTER
537+
unit: COUNT
538+
aggregation: AVG
539+
derivative: NON_NEGATIVE_DERIVATIVE
521540
- name: sql.distsql.contended_queries.count
522541
exported_name: sql_distsql_contended_queries_count
523542
description: Number of SQL queries that experienced contention
@@ -584,6 +603,25 @@ layers:
584603
unit: COUNT
585604
aggregation: AVG
586605
derivative: NON_NEGATIVE_DERIVATIVE
606+
- name: sql.insert.started.count
607+
exported_name: sql_insert_started_count
608+
labeled_name: 'sql.started.count{query_type: insert}'
609+
description: Number of SQL INSERT statements started
610+
y_axis_label: SQL Statements
611+
type: COUNTER
612+
unit: COUNT
613+
aggregation: AVG
614+
derivative: NON_NEGATIVE_DERIVATIVE
615+
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.
616+
- name: sql.insert.started.count.internal
617+
exported_name: sql_insert_started_count_internal
618+
labeled_name: 'sql.started.count{query_type: insert, query_internal: true}'
619+
description: Number of SQL INSERT statements started (internal queries)
620+
y_axis_label: SQL Internal Statements
621+
type: COUNTER
622+
unit: COUNT
623+
aggregation: AVG
624+
derivative: NON_NEGATIVE_DERIVATIVE
587625
- name: sql.mem.root.current
588626
exported_name: sql_mem_root_current
589627
description: Current sql statement memory usage for root
@@ -780,6 +818,25 @@ layers:
780818
unit: COUNT
781819
aggregation: AVG
782820
derivative: NON_NEGATIVE_DERIVATIVE
821+
- name: sql.select.started.count
822+
exported_name: sql_select_started_count
823+
labeled_name: 'sql.started.count{query_type: select}'
824+
description: Number of SQL SELECT statements started
825+
y_axis_label: SQL Statements
826+
type: COUNTER
827+
unit: COUNT
828+
aggregation: AVG
829+
derivative: NON_NEGATIVE_DERIVATIVE
830+
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.
831+
- name: sql.select.started.count.internal
832+
exported_name: sql_select_started_count_internal
833+
labeled_name: 'sql.started.count{query_type: select, query_internal: true}'
834+
description: Number of SQL SELECT statements started (internal queries)
835+
y_axis_label: SQL Internal Statements
836+
type: COUNTER
837+
unit: COUNT
838+
aggregation: AVG
839+
derivative: NON_NEGATIVE_DERIVATIVE
783840
- name: sql.service.latency
784841
exported_name: sql_service_latency
785842
description: Latency of SQL request execution
@@ -944,6 +1001,25 @@ layers:
9441001
unit: COUNT
9451002
aggregation: AVG
9461003
derivative: NON_NEGATIVE_DERIVATIVE
1004+
- name: sql.update.started.count
1005+
exported_name: sql_update_started_count
1006+
labeled_name: 'sql.started.count{query_type: update}'
1007+
description: Number of SQL UPDATE statements started
1008+
y_axis_label: SQL Statements
1009+
type: COUNTER
1010+
unit: COUNT
1011+
aggregation: AVG
1012+
derivative: NON_NEGATIVE_DERIVATIVE
1013+
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.
1014+
- name: sql.update.started.count.internal
1015+
exported_name: sql_update_started_count_internal
1016+
labeled_name: 'sql.started.count{query_type: update, query_internal: true}'
1017+
description: Number of SQL UPDATE statements started (internal queries)
1018+
y_axis_label: SQL Internal Statements
1019+
type: COUNTER
1020+
unit: COUNT
1021+
aggregation: AVG
1022+
derivative: NON_NEGATIVE_DERIVATIVE
9471023
- name: txn.restarts.serializable
9481024
exported_name: txn_restarts_serializable
9491025
description: Number of restarts due to a forwarded commit timestamp and isolation=SERIALIZABLE
@@ -7717,22 +7793,6 @@ layers:
77177793
unit: COUNT
77187794
aggregation: AVG
77197795
derivative: NON_NEGATIVE_DERIVATIVE
7720-
- name: sql.delete.started.count
7721-
exported_name: sql_delete_started_count
7722-
description: Number of SQL DELETE statements started
7723-
y_axis_label: SQL Statements
7724-
type: COUNTER
7725-
unit: COUNT
7726-
aggregation: AVG
7727-
derivative: NON_NEGATIVE_DERIVATIVE
7728-
- name: sql.delete.started.count.internal
7729-
exported_name: sql_delete_started_count_internal
7730-
description: Number of SQL DELETE statements started (internal queries)
7731-
y_axis_label: SQL Internal Statements
7732-
type: COUNTER
7733-
unit: COUNT
7734-
aggregation: AVG
7735-
derivative: NON_NEGATIVE_DERIVATIVE
77367796
- name: sql.disk.distsql.current
77377797
exported_name: sql_disk_distsql_current
77387798
description: Current sql statement disk usage for distsql
@@ -8157,22 +8217,6 @@ layers:
81578217
unit: COUNT
81588218
aggregation: AVG
81598219
derivative: NON_NEGATIVE_DERIVATIVE
8160-
- name: sql.insert.started.count
8161-
exported_name: sql_insert_started_count
8162-
description: Number of SQL INSERT statements started
8163-
y_axis_label: SQL Statements
8164-
type: COUNTER
8165-
unit: COUNT
8166-
aggregation: AVG
8167-
derivative: NON_NEGATIVE_DERIVATIVE
8168-
- name: sql.insert.started.count.internal
8169-
exported_name: sql_insert_started_count_internal
8170-
description: Number of SQL INSERT statements started (internal queries)
8171-
y_axis_label: SQL Internal Statements
8172-
type: COUNTER
8173-
unit: COUNT
8174-
aggregation: AVG
8175-
derivative: NON_NEGATIVE_DERIVATIVE
81768220
- name: sql.insights.anomaly_detection.evictions
81778221
exported_name: sql_insights_anomaly_detection_evictions
81788222
description: Evictions of fingerprint latency summaries due to memory pressure
@@ -8837,22 +8881,6 @@ layers:
88378881
unit: COUNT
88388882
aggregation: AVG
88398883
derivative: NONE
8840-
- name: sql.select.started.count
8841-
exported_name: sql_select_started_count
8842-
description: Number of SQL SELECT statements started
8843-
y_axis_label: SQL Statements
8844-
type: COUNTER
8845-
unit: COUNT
8846-
aggregation: AVG
8847-
derivative: NON_NEGATIVE_DERIVATIVE
8848-
- name: sql.select.started.count.internal
8849-
exported_name: sql_select_started_count_internal
8850-
description: Number of SQL SELECT statements started (internal queries)
8851-
y_axis_label: SQL Internal Statements
8852-
type: COUNTER
8853-
unit: COUNT
8854-
aggregation: AVG
8855-
derivative: NON_NEGATIVE_DERIVATIVE
88568884
- name: sql.service.latency.consistent
88578885
exported_name: sql_service_latency_consistent
88588886
description: Latency of SQL request execution of non-historical queries
@@ -9293,22 +9321,6 @@ layers:
92939321
unit: COUNT
92949322
aggregation: AVG
92959323
derivative: NON_NEGATIVE_DERIVATIVE
9296-
- name: sql.update.started.count
9297-
exported_name: sql_update_started_count
9298-
description: Number of SQL UPDATE statements started
9299-
y_axis_label: SQL Statements
9300-
type: COUNTER
9301-
unit: COUNT
9302-
aggregation: AVG
9303-
derivative: NON_NEGATIVE_DERIVATIVE
9304-
- name: sql.update.started.count.internal
9305-
exported_name: sql_update_started_count_internal
9306-
description: Number of SQL UPDATE statements started (internal queries)
9307-
y_axis_label: SQL Internal Statements
9308-
type: COUNTER
9309-
unit: COUNT
9310-
aggregation: AVG
9311-
derivative: NON_NEGATIVE_DERIVATIVE
93129324
- name: sql.vecindex.pending_splits_merges
93139325
exported_name: sql_vecindex_pending_splits_merges
93149326
description: Total number of vector index splits and merges waiting to be processed

pkg/sql/exec_util.go

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,28 +1016,44 @@ var (
10161016
Unit: metric.Unit_COUNT,
10171017
}
10181018
MetaSelectStarted = metric.Metadata{
1019-
Name: "sql.select.started.count",
1020-
Help: "Number of SQL SELECT statements started",
1021-
Measurement: "SQL Statements",
1022-
Unit: metric.Unit_COUNT,
1019+
Name: "sql.select.started.count",
1020+
Help: "Number of SQL SELECT statements started",
1021+
Measurement: "SQL Statements",
1022+
Unit: metric.Unit_COUNT,
1023+
LabeledName: "sql.started.count",
1024+
StaticLabels: metric.MakeLabelPairs(metric.LabelQueryType, "select"),
1025+
Category: metric.Metadata_SQL,
1026+
HowToUse: "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.",
10231027
}
10241028
MetaUpdateStarted = metric.Metadata{
1025-
Name: "sql.update.started.count",
1026-
Help: "Number of SQL UPDATE statements started",
1027-
Measurement: "SQL Statements",
1028-
Unit: metric.Unit_COUNT,
1029+
Name: "sql.update.started.count",
1030+
Help: "Number of SQL UPDATE statements started",
1031+
Measurement: "SQL Statements",
1032+
Unit: metric.Unit_COUNT,
1033+
LabeledName: "sql.started.count",
1034+
StaticLabels: metric.MakeLabelPairs(metric.LabelQueryType, "update"),
1035+
Category: metric.Metadata_SQL,
1036+
HowToUse: "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.",
10291037
}
10301038
MetaInsertStarted = metric.Metadata{
1031-
Name: "sql.insert.started.count",
1032-
Help: "Number of SQL INSERT statements started",
1033-
Measurement: "SQL Statements",
1034-
Unit: metric.Unit_COUNT,
1039+
Name: "sql.insert.started.count",
1040+
Help: "Number of SQL INSERT statements started",
1041+
Measurement: "SQL Statements",
1042+
Unit: metric.Unit_COUNT,
1043+
LabeledName: "sql.started.count",
1044+
StaticLabels: metric.MakeLabelPairs(metric.LabelQueryType, "insert"),
1045+
Category: metric.Metadata_SQL,
1046+
HowToUse: "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.",
10351047
}
10361048
MetaDeleteStarted = metric.Metadata{
1037-
Name: "sql.delete.started.count",
1038-
Help: "Number of SQL DELETE statements started",
1039-
Measurement: "SQL Statements",
1040-
Unit: metric.Unit_COUNT,
1049+
Name: "sql.delete.started.count",
1050+
Help: "Number of SQL DELETE statements started",
1051+
Measurement: "SQL Statements",
1052+
Unit: metric.Unit_COUNT,
1053+
LabeledName: "sql.started.count",
1054+
StaticLabels: metric.MakeLabelPairs(metric.LabelQueryType, "delete"),
1055+
Category: metric.Metadata_SQL,
1056+
HowToUse: "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.",
10411057
}
10421058
MetaCRUDStarted = metric.Metadata{
10431059
Name: "sql.crud_query.started.count",

0 commit comments

Comments
 (0)