Skip to content

Commit 121d175

Browse files
authored
Merge pull request #154388 from cockroachdb/blathers/backport-release-25.4-151946
release-25.4: metric: add labels for `sql.*.started.count`
2 parents 5e5c41a + 357db91 commit 121d175

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
@@ -7701,22 +7777,6 @@ layers:
77017777
unit: COUNT
77027778
aggregation: AVG
77037779
derivative: NON_NEGATIVE_DERIVATIVE
7704-
- name: sql.delete.started.count
7705-
exported_name: sql_delete_started_count
7706-
description: Number of SQL DELETE statements started
7707-
y_axis_label: SQL Statements
7708-
type: COUNTER
7709-
unit: COUNT
7710-
aggregation: AVG
7711-
derivative: NON_NEGATIVE_DERIVATIVE
7712-
- name: sql.delete.started.count.internal
7713-
exported_name: sql_delete_started_count_internal
7714-
description: Number of SQL DELETE statements started (internal queries)
7715-
y_axis_label: SQL Internal Statements
7716-
type: COUNTER
7717-
unit: COUNT
7718-
aggregation: AVG
7719-
derivative: NON_NEGATIVE_DERIVATIVE
77207780
- name: sql.disk.distsql.current
77217781
exported_name: sql_disk_distsql_current
77227782
description: Current sql statement disk usage for distsql
@@ -8141,22 +8201,6 @@ layers:
81418201
unit: COUNT
81428202
aggregation: AVG
81438203
derivative: NON_NEGATIVE_DERIVATIVE
8144-
- name: sql.insert.started.count
8145-
exported_name: sql_insert_started_count
8146-
description: Number of SQL INSERT statements started
8147-
y_axis_label: SQL Statements
8148-
type: COUNTER
8149-
unit: COUNT
8150-
aggregation: AVG
8151-
derivative: NON_NEGATIVE_DERIVATIVE
8152-
- name: sql.insert.started.count.internal
8153-
exported_name: sql_insert_started_count_internal
8154-
description: Number of SQL INSERT statements started (internal queries)
8155-
y_axis_label: SQL Internal Statements
8156-
type: COUNTER
8157-
unit: COUNT
8158-
aggregation: AVG
8159-
derivative: NON_NEGATIVE_DERIVATIVE
81608204
- name: sql.insights.anomaly_detection.evictions
81618205
exported_name: sql_insights_anomaly_detection_evictions
81628206
description: Evictions of fingerprint latency summaries due to memory pressure
@@ -8821,22 +8865,6 @@ layers:
88218865
unit: COUNT
88228866
aggregation: AVG
88238867
derivative: NONE
8824-
- name: sql.select.started.count
8825-
exported_name: sql_select_started_count
8826-
description: Number of SQL SELECT statements started
8827-
y_axis_label: SQL Statements
8828-
type: COUNTER
8829-
unit: COUNT
8830-
aggregation: AVG
8831-
derivative: NON_NEGATIVE_DERIVATIVE
8832-
- name: sql.select.started.count.internal
8833-
exported_name: sql_select_started_count_internal
8834-
description: Number of SQL SELECT statements started (internal queries)
8835-
y_axis_label: SQL Internal Statements
8836-
type: COUNTER
8837-
unit: COUNT
8838-
aggregation: AVG
8839-
derivative: NON_NEGATIVE_DERIVATIVE
88408868
- name: sql.service.latency.consistent
88418869
exported_name: sql_service_latency_consistent
88428870
description: Latency of SQL request execution of non-historical queries
@@ -9277,22 +9305,6 @@ layers:
92779305
unit: COUNT
92789306
aggregation: AVG
92799307
derivative: NON_NEGATIVE_DERIVATIVE
9280-
- name: sql.update.started.count
9281-
exported_name: sql_update_started_count
9282-
description: Number of SQL UPDATE statements started
9283-
y_axis_label: SQL Statements
9284-
type: COUNTER
9285-
unit: COUNT
9286-
aggregation: AVG
9287-
derivative: NON_NEGATIVE_DERIVATIVE
9288-
- name: sql.update.started.count.internal
9289-
exported_name: sql_update_started_count_internal
9290-
description: Number of SQL UPDATE statements started (internal queries)
9291-
y_axis_label: SQL Internal Statements
9292-
type: COUNTER
9293-
unit: COUNT
9294-
aggregation: AVG
9295-
derivative: NON_NEGATIVE_DERIVATIVE
92969308
- name: sql.vecindex.pending_splits_merges
92979309
exported_name: sql_vecindex_pending_splits_merges
92989310
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)