Repository navigation
Expand file tree
/
Copy pathsqlactivity.yaml
More file actions
84 lines (82 loc) · 2.76 KB
/
Copy pathsqlactivity.yaml
File metadata and controls
84 lines (82 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2024 The Cockroach Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Privileges: none beyond what "visus init" grants (VIEWACTIVITY).
name: sqlactivity
enabled: true
scope: node
frequency: 5
maxresults: 20
labels: [statement,application,database]
metrics:
- name : exec_count
kind : counter
help : number of times the statement was executed.
- name : net_bytes
kind : gauge
help : amount of data transferred over the network.
- name : max_disk
kind : gauge
help : maximum data transferred from the disk.
- name : run_lat
kind : gauge
help : average runtime.
- name : rows_read
kind : gauge
help : average number of rows read from disk.
- name : rows_avg
kind : gauge
help : average number of rows returned.
- name : bytes_avg
kind : gauge
help : average number of bytes read from disk.
- name : total_lat
kind : gauge
help : total runtime for the statement.
- name : max_retries
kind : gauge
help : cumulative number of automatic retries.
- name : max_mem
kind : gauge
help : maximum memory used by the statement.
- name : cont_time
kind : gauge
help : number of times the statement was executed.
query:
SELECT
statement_id as statement,
application_name as application,
database_name as database,
sum(count) AS exec_count,
max(max_disk_usage_avg) AS max_disk,
sum(network_bytes_avg * count::FLOAT8) / sum(count)::FLOAT8 AS net_bytes,
sum(run_lat_avg * count::FLOAT8) / sum(count)::FLOAT8 AS run_lat,
sum(rows_read_avg * count::FLOAT8) / sum(count)::FLOAT8 AS rows_read,
sum(rows_avg * count::FLOAT8) / sum(count)::FLOAT8 AS rows_avg,
sum(bytes_read_avg * count::FLOAT8) / sum(count)::FLOAT8 AS bytes_avg,
sum(run_lat_avg * count::FLOAT8) AS total_lat,
sum(max_retries) AS max_retries,
max(max_mem_usage_avg) AS max_mem,
sum(contention_time_avg * count::FLOAT8) / sum(count)::FLOAT8 AS cont_time
FROM
crdb_internal.node_statement_statistics
WHERE
application_name NOT LIKE '$ internal-%'
GROUP BY
statement_id, application_name, database_name
ORDER BY
total_lat DESC
LIMIT
$1;