Regenerate integrations docs (#21627)
Co-authored-by: ilyam8 <22274335+ilyam8@users.noreply.github.com>
Netdata bot committed
Jan 24, 2026 at 10:46 UTC
eeb68223abcc224ad1894d6ca73b63215e17375b
17 files changed
+1266
-595
src/go/plugin/go.d/collector/clickhouse/integrations/clickhouse.md
+53
-25
@@ -178,23 +178,51 @@ This collector exposes real-time functions for interactive troubleshooting in th
178
179
### Top Queries
180
181
-Top SQL queries from ClickHouse system.query_log.
181
+Retrieves and aggregates SQL query performance metrics from ClickHouse [system.query_log](https://clickhouse.com/docs/en/operations/system-tables/query_log) table.
182
183
-Queries system.query_log, aggregates by query, and returns the top entries sorted by the selected column.
183
+This function queries the `system.query_log` table, which contains information about executed queries including timing, resource usage, and execution statistics. Queries are grouped by their normalized hash (`normalized_query_hash`) to aggregate statistics for identical query patterns with different literal values.
184
+
185
+Use cases:
186
+- Identify slow queries that consume the most execution time
187
+- Find frequently executed queries that may benefit from optimization
188
+- Analyze I/O patterns by examining read/written rows and bytes
189
+
190
+Query text is truncated at 4096 characters for display purposes.
191
192
193
| Aspect | Description |
194
|:-------|:------------|
195
| Name | `Clickhouse:top-queries` |
189
-| Performance | Uses system.query_log and can be expensive on busy systems. Use limits to control response size. |
190
-| Security | Query text may include sensitive literals depending on server settings. |
191
-| Availability | Available when the collector can query system tables; returns 503 if system.query_log is not available. |
196
+| Require Cloud | yes |
197
+| Performance | Queries `system.query_log` table and aggregates by `normalized_query_hash`:<br/>• On busy systems with high query throughput, the table can grow large<br/>• Default limit of 500 rows balances usefulness with performance |
198
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in query parameters<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
199
+| Availability | Available when:<br/>• The collector has successfully connected to ClickHouse<br/>• `system.query_log` table is accessible<br/>• Returns HTTP 503 if `system.query_log` is not accessible<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
200
201
#### Prerequisites
202
195
-##### Grant access to system.query_log
203
+##### Grant access to `system.query_log`
204
+
205
+Ensure the Netdata user can read `system.query_log` on the target ClickHouse instance.
206
+
207
+1. Verify `query_log` is enabled (enabled by default):
208
+
209
+ ```sql
210
+ SELECT * FROM system.query_log LIMIT 1;
211
+ ```
212
197
-Ensure the Netdata user can read system.query_log on the target ClickHouse instance.
213
+2. If using a dedicated monitoring user, grant SELECT access:
214
+
215
+ ```sql
216
+ GRANT SELECT ON system.query_log TO netdata_user;
217
+ ```
218
+
219
+:::info
220
+
221
+- The `query_log` table is enabled by default in ClickHouse
222
+- Only queries with `type='QueryFinish'` are included in the results
223
+- The `normalized_query_hash` column is used for grouping when available
224
+
225
+:::
226
227
228
@@ -202,30 +230,30 @@ Ensure the Netdata user can read system.query_log on the target ClickHouse insta
230
231
| Parameter | Type | Description | Required | Default | Options |
232
|:---------|:-----|:------------|:--------:|:--------|:--------|
205
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
233
+| Filter By | select | Select the primary sort column. The available options include total execution time, number of calls, rows read, and more. Defaults to total execution time to focus on most resource-intensive queries. | yes | totalTime | |
234
235
#### Returns
236
209
-Aggregated query statistics from system.query_log.
237
+Aggregated query statistics from `system.query_log`, grouped by normalized query hash. Each row represents a unique query pattern with cumulative metrics across all executions.
238
239
| Column | Type | Unit | Visibility | Description |
240
|:-------|:-----|:-----|:-----------|:------------|
213
-| Query ID | string | | hidden | |
214
-| Query | string | | | |
215
-| Database | string | | | |
216
-| User | string | | | |
217
-| Calls | integer | | | |
218
-| Total Time | duration | milliseconds | | |
219
-| Avg Time | duration | milliseconds | | |
220
-| Min Time | duration | milliseconds | hidden | |
221
-| Max Time | duration | milliseconds | hidden | |
222
-| Read Rows | integer | | | |
223
-| Read Bytes | integer | | | |
224
-| Written Rows | integer | | hidden | |
225
-| Written Bytes | integer | | hidden | |
226
-| Result Rows | integer | | | |
227
-| Result Bytes | integer | | hidden | |
228
-| Max Memory | float | | hidden | |
241
+| Query ID | string | | hidden | Unique hash identifier for the normalized query pattern. Queries with identical structure but different literal values share the same hash. |
242
+| Query | string | | | SQL query text from one of the executions. Truncated to 4096 characters. Use this to identify the actual SQL being executed. |
243
+| Database | string | | | Database name where the query was executed. Empty string for queries without a database context or system queries. |
244
+| User | string | | | ClickHouse user that executed the query. Useful for identifying query sources and implementing per-user resource monitoring. |
245
+| Calls | integer | | | Total number of times this query pattern has been executed. High values indicate frequently run queries that impact overall server load. |
246
+| Total Time | duration | milliseconds | | Cumulative execution time across all executions. High values indicate queries that consume significant server resources over time. |
247
+| Avg Time | duration | milliseconds | | Average execution time per query run. Use this to compare typical performance across different query patterns. |
248
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed for a single execution. Helps identify best-case query performance. |
249
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed for a single execution. Large gaps between min and max may indicate data skew or resource contention. |
250
+| Read Rows | integer | | | Total number of rows read from storage across all executions. High values suggest queries scanning large amounts of data that may benefit from better filtering or indexing. |
251
+| Read Bytes | integer | | | Total bytes read from storage across all executions. Indicates I/O load and data transfer volume for the query pattern. |
252
+| Written Rows | integer | | hidden | Total number of rows written across all executions. Relevant for INSERT, CREATE, or materialized view queries. |
253
+| Written Bytes | integer | | hidden | Total bytes written across all executions. Indicates storage impact of write operations. |
254
+| Result Rows | integer | | | Total number of rows returned to clients across all executions. A high ratio of read rows to result rows indicates filtering or aggregation happening on large datasets. |
255
+| Result Bytes | integer | | hidden | Total bytes returned to clients across all executions. Large values may indicate queries returning more data than necessary. |
256
+| Max Memory | float | | hidden | Maximum memory used during any single execution. High values may indicate queries at risk of hitting memory limits under load. |
257
258
259
src/go/plugin/go.d/collector/cockroachdb/integrations/cockroachdb.md
+105
-51
@@ -27,7 +27,7 @@ This collector monitors CockroachDB servers.
27
28
It scrapes Prometheus metrics from the CockroachDB `/_status/vars` endpoint.
29
30
-It also provides `top-queries` and `running-queries` functions using SQL statement statistics (`crdb_internal.cluster_statement_statistics`) and `SHOW CLUSTER STATEMENTS`.
30
+It also provides `top-queries` and `running-queries` functions using SQL statement statistics (`crdb_internal.cluster_statement_statistics`) and the `SHOW CLUSTER STATEMENTS` command.
31
32
33
This collector is supported on all platforms.
@@ -36,7 +36,7 @@ This collector supports collecting metrics from multiple instances of this integ
36
37
The `top-queries` and `running-queries` functions require:
38
39
-- A SQL user with `VIEWACTIVITY` (or `VIEWACTIVITYREDACTED`) privileges.
39
+- A SQL user with `VIEWACTIVITY` or `VIEWACTIVITYREDACTED` privileges.
40
- Access to `crdb_internal.cluster_statement_statistics` (may require `SET allow_unsafe_internals = on` on newer versions).
41
42
@@ -142,23 +142,53 @@ This collector exposes real-time functions for interactive troubleshooting in th
142
143
### Top Queries
144
145
-Top SQL statements from crdb_internal.cluster_statement_statistics.
145
+Retrieves and aggregates SQL statement performance metrics from CockroachDB [crdb_internal.cluster_statement_statistics](https://www.cockroachlabs.com/docs/stable/crdb-internal#cluster_statement_statistics) table.
146
147
-Queries crdb_internal.cluster_statement_statistics and returns the top entries sorted by the selected column.
147
+This function queries cluster-wide statement statistics grouped by fingerprint (normalized query pattern). It provides aggregated metrics including execution counts, timing breakdowns, and row operation statistics.
148
+
149
+Use cases:
150
+- Identify slow queries consuming the most total execution time
151
+- Find frequently executed queries that may benefit from optimization
152
+- Analyze row read/write patterns to detect inefficient queries
153
+
154
+Query text is truncated at 4096 characters for display purposes.
155
156
157
| Aspect | Description |
158
|:-------|:------------|
159
| Name | `Cockroachdb:top-queries` |
153
-| Performance | Executes SQL queries against system tables and may be expensive on busy clusters. |
154
-| Security | Query text may contain unmasked literals (potential PII). |
155
-| Availability | Requires SQL DSN configuration and access to system tables; returns errors if DSN is missing or SQL is unavailable. |
160
+| Require Cloud | yes |
161
+| Performance | Queries the `crdb_internal.cluster_statement_statistics` table which aggregates data across the cluster:<br/>• On busy clusters with high query throughput, this query may take longer<br/>• Default limit of 500 rows balances usefulness with performance |
162
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
163
+| Availability | Available when:<br/>• The collector has successfully connected to CockroachDB<br/>• The SQL user has `VIEWACTIVITY` or `VIEWACTIVITYREDACTED` privileges<br/>• Returns HTTP 503 if the SQL connection cannot be established<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
164
165
#### Prerequisites
166
159
-##### Grant VIEWACTIVITY access to cluster statement stats
167
+##### Grant `VIEWACTIVITY` access to cluster statement stats
168
+
169
+The SQL user must have appropriate privileges to access statement statistics.
170
+
171
+1. Grant `VIEWACTIVITY` (shows full query text) or `VIEWACTIVITYREDACTED` (masks literals):
172
+
173
+ ```sql
174
+ GRANT SYSTEM VIEWACTIVITY TO netdata_user;
175
+ -- OR for privacy:
176
+ GRANT SYSTEM VIEWACTIVITYREDACTED TO netdata_user;
177
+ ```
178
161
-Use a SQL user with VIEWACTIVITY (or VIEWACTIVITYREDACTED) and access to crdb_internal.cluster_statement_statistics.
179
+2. On newer CockroachDB versions, access to `crdb_internal` may require:
180
+
181
+ ```sql
182
+ SET allow_unsafe_internals = on;
183
+ ```
184
+
185
+:::info
186
+
187
+- The collector automatically sets `allow_unsafe_internals = on` for the session when querying `crdb_internal` tables (required on newer versions)
188
+- `VIEWACTIVITYREDACTED` replaces literal values with underscores for privacy
189
+- Statement statistics are collected by default but can be disabled via cluster settings
190
+
191
+:::
192
193
194
@@ -166,54 +196,78 @@ Use a SQL user with VIEWACTIVITY (or VIEWACTIVITYREDACTED) and access to crdb_in
196
197
| Parameter | Type | Description | Required | Default | Options |
198
|:---------|:-----|:------------|:--------:|:--------|:--------|
169
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
199
+| Filter By | select | Select the primary sort column. Options include total time, executions, rows read, rows written, and more. Defaults to total time to focus on most resource-intensive queries. | yes | totalTime | |
200
201
#### Returns
202
173
-Aggregated SQL statement statistics.
203
+Aggregated SQL statement statistics grouped by fingerprint. Each row represents a unique query pattern with cumulative metrics across all executions.
204
205
| Column | Type | Unit | Visibility | Description |
206
|:-------|:-----|:-----|:-----------|:------------|
177
-| Fingerprint ID | string | | hidden | |
178
-| Query | string | | | |
179
-| Database | string | | | |
180
-| Application | string | | | |
181
-| Statement Type | string | | hidden | |
182
-| Distributed | string | | hidden | |
183
-| Full Scan | string | | hidden | |
184
-| Implicit Txn | string | | hidden | |
185
-| Vectorized | string | | hidden | |
186
-| Executions | integer | | | |
187
-| Total Time | duration | milliseconds | | |
188
-| Mean Time | duration | milliseconds | | |
189
-| Run Time | duration | milliseconds | hidden | |
190
-| Plan Time | duration | milliseconds | hidden | |
191
-| Parse Time | duration | milliseconds | hidden | |
192
-| Rows Read | integer | | | |
193
-| Rows Written | integer | | | |
194
-| Rows Returned | integer | | | |
195
-| Bytes Read | integer | | hidden | |
196
-| Max Retries | integer | | hidden | |
207
+| Fingerprint ID | string | | hidden | Unique hash identifier for the normalized query pattern. Queries with identical structure but different literal values share the same fingerprint. |
208
+| Query | string | | | Normalized SQL statement text with literals replaced. Truncated to 4096 characters. |
209
+| Database | string | | | Database name where the query was executed. Empty for queries without database context. |
210
+| Application | string | | | Application name that executed the query. Useful for identifying query sources across services. |
211
+| Statement Type | string | | hidden | Type of SQL statement (SELECT, INSERT, UPDATE, DELETE, etc.). |
212
+| Distributed | string | | hidden | Whether the query used DistSQL execution (true/false). Distributed queries span multiple nodes. |
213
+| Full Scan | string | | hidden | Whether the query performed a full table scan (true/false). Full scans may indicate missing indexes. |
214
+| Implicit Txn | string | | hidden | Whether the statement ran in an implicit transaction (true/false). |
215
+| Vectorized | string | | hidden | Whether the query used vectorized execution (true/false). Vectorized execution improves performance for analytical queries. |
216
+| Executions | integer | | | Total number of times this query pattern has been executed. High values indicate frequently run queries. |
217
+| Total Time | duration | milliseconds | | Cumulative service latency across all executions (mean time × executions). High values indicate queries consuming significant cluster resources. |
218
+| Mean Time | duration | milliseconds | | Average service latency per execution. Use this to compare typical performance across query patterns. |
219
+| Run Time | duration | milliseconds | hidden | Average time spent executing the query after planning. Excludes parse and plan time. |
220
+| Plan Time | duration | milliseconds | hidden | Average time spent generating the query execution plan. High values may indicate complex queries or stale statistics. |
221
+| Parse Time | duration | milliseconds | hidden | Average time spent parsing the SQL statement. |
222
+| Rows Read | integer | | | Total rows read across all executions. High values relative to rows returned suggest missing indexes or inefficient scans. |
223
+| Rows Written | integer | | | Total rows written across all executions. Indicates write workload for INSERT, UPDATE, DELETE statements. |
224
+| Rows Returned | integer | | | Total rows returned to clients across all executions. Compare with rows read to assess query efficiency. |
225
+| Bytes Read | integer | | hidden | Total bytes read from storage across all executions. Indicates I/O load for the query pattern. |
226
+| Max Retries | integer | | hidden | Maximum number of automatic retries observed for this query pattern. High values indicate transaction contention. |
227
228
### Running Queries
229
200
-Currently running SQL statements from SHOW CLUSTER STATEMENTS.
230
+Retrieves currently executing SQL statements across the CockroachDB cluster using [SHOW CLUSTER STATEMENTS](https://www.cockroachlabs.com/docs/stable/show-statements).
231
+
232
+This function provides a real-time snapshot of all active queries across all nodes in the cluster, including their execution phase, duration, and associated metadata.
233
202
-Queries SHOW CLUSTER STATEMENTS and returns running statements sorted by the selected column.
234
+Use cases:
235
+- Identify long-running queries that may be blocking other operations
236
+- Monitor active workload distribution across the cluster
237
+- Debug stuck or slow queries in real-time
238
+
239
+Query text is truncated at 4096 characters for display purposes.
240
241
242
| Aspect | Description |
243
|:-------|:------------|
244
| Name | `Cockroachdb:running-queries` |
208
-| Performance | Executes SQL queries against system tables and may be expensive on busy clusters. |
209
-| Security | Query text may contain unmasked literals (potential PII). |
210
-| Availability | Requires SQL DSN configuration and access to system tables; returns errors if DSN is missing or SQL is unavailable. |
245
+| Require Cloud | yes |
246
+| Performance | Executes the `SHOW CLUSTER STATEMENTS` command which queries all nodes in the cluster:<br/>• Lightweight operation with minimal overhead<br/>• Returns only currently active queries, typically a small result set |
247
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or VALUES<br/>• Session tokens or credentials<br/>• Access should be restricted to authorized personnel only |
248
+| Availability | Available when:<br/>• The collector has successfully connected to CockroachDB<br/>• The SQL user has `VIEWACTIVITY` or `VIEWACTIVITYREDACTED` privileges<br/>• Returns HTTP 503 if the SQL connection cannot be established<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
249
250
#### Prerequisites
251
214
-##### Grant VIEWACTIVITY access to system tables
252
+##### Grant `VIEWACTIVITY` access to system tables
253
+
254
+The SQL user must have appropriate privileges to view running statements.
255
+
256
+1. Grant `VIEWACTIVITY` (shows full query text) or `VIEWACTIVITYREDACTED` (masks literals):
257
+
258
+ ```sql
259
+ GRANT SYSTEM VIEWACTIVITY TO netdata_user;
260
+ -- OR for privacy:
261
+ GRANT SYSTEM VIEWACTIVITYREDACTED TO netdata_user;
262
+ ```
263
+
264
+ :::info
265
+
266
+ - `SHOW CLUSTER STATEMENTS` shows queries across all nodes, not just the connected node
267
+ - `VIEWACTIVITYREDACTED` replaces literal values with underscores for privacy
268
+ - Queries shown are point-in-time snapshots and may complete between retrieval and display
269
216
-Use a SQL user with VIEWACTIVITY (or VIEWACTIVITYREDACTED) and access to system tables.
270
+ :::
271
272
273
@@ -221,25 +275,25 @@ Use a SQL user with VIEWACTIVITY (or VIEWACTIVITYREDACTED) and access to system
275
276
| Parameter | Type | Description | Required | Default | Options |
277
|:---------|:-----|:------------|:--------:|:--------|:--------|
224
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | elapsedMs | |
278
+| Filter By | select | Select the primary sort column. Defaults to elapsed time to show longest-running queries first. | yes | elapsedMs | |
279
280
#### Returns
281
228
-Snapshot of currently running SQL statements.
282
+Real-time snapshot of currently executing SQL statements across all cluster nodes. Each row represents a single active query.
283
284
| Column | Type | Unit | Visibility | Description |
285
|:-------|:-----|:-----|:-----------|:------------|
232
-| Query ID | string | | hidden | |
233
-| Query | string | | | |
234
-| User | string | | | |
235
-| Application | string | | | |
236
-| Client Address | string | | hidden | |
237
-| Node ID | string | | hidden | |
238
-| Session ID | string | | hidden | |
239
-| Phase | string | | | |
240
-| Distributed | string | | hidden | |
241
-| Start Time | string | | hidden | |
242
-| Elapsed | duration | milliseconds | | |
286
+| Query ID | string | | hidden | Unique identifier for this specific query execution. Can be used with CANCEL QUERY if needed. |
287
+| Query | string | | | The SQL statement currently being executed. Truncated to 4096 characters. |
288
+| User | string | | | Database user executing the query. Useful for identifying workload by user. |
289
+| Application | string | | | Application name from the client connection. Helps identify which service is running the query. |
290
+| Client Address | string | | hidden | IP address of the client connection. Useful for identifying query sources. |
291
+| Node ID | string | | hidden | CockroachDB node currently executing the query. Helps identify workload distribution. |
292
+| Session ID | string | | hidden | Session identifier for the connection. Multiple queries may share a session. |
293
+| Phase | string | | | Current execution phase (executing, preparing, etc.). Indicates query progress. |
294
+| Distributed | string | | hidden | Whether the query is using distributed execution across multiple nodes. |
295
+| Start Time | string | | hidden | Timestamp when the query started executing. |
296
+| Elapsed | duration | milliseconds | | Time elapsed since query started. High values indicate long-running queries that may need investigation. |
297
298
299
src/go/plugin/go.d/collector/couchbase/integrations/couchbase.md
+50
-20
@@ -82,23 +82,53 @@ This collector exposes real-time functions for interactive troubleshooting in th
82
83
### Top Queries
84
85
-Top N1QL requests from system:completed_requests.
85
+Retrieves completed N1QL query statistics from Couchbase [system:completed_requests](https://docs.couchbase.com/server/current/manage/monitor/monitoring-n1ql-query.html#sys-completed-req) keyspace.
86
87
-Queries the system:completed_requests keyspace and returns the top entries sorted by the selected column.
87
+This function queries the `system:completed_requests` keyspace which stores information about recently completed N1QL requests. It provides timing metrics, result statistics, and error/warning counts for each completed query.
88
+
89
+Use cases:
90
+- Identify slow N1QL queries consuming the most elapsed time
91
+- Find queries with high error or warning counts
92
+- Analyze query patterns by user to understand workload distribution
93
+
94
+Statement text is truncated at 4096 characters for display purposes.
95
96
97
| Aspect | Description |
98
|:-------|:------------|
99
| Name | `Couchbase:top-queries` |
93
-| Performance | Runs N1QL queries against system keyspaces; use top_queries_limit to control response size. |
94
-| Security | Query text may include sensitive literals depending on workload. |
95
-| Availability | Available when the collector can query system keyspaces; returns 503 until the collector is initialized. |
100
+| Require Cloud | yes |
101
+| Performance | Queries `system:completed_requests` via the N1QL query service:<br/>• The `completed_requests` keyspace has a configurable size limit (`completed-limit` setting)<br/>• Default limit of 500 rows balances usefulness with performance |
102
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data embedded in queries<br/>• Access should be restricted to authorized personnel only |
103
+| Availability | Available when:<br/>• The collector has successfully connected to Couchbase<br/>• The N1QL (Query) service is running<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
104
105
#### Prerequisites
106
99
-##### Grant access to system:completed_requests
107
+##### Grant access to `system:completed_requests`
108
+
109
+The user must have appropriate privileges to query system keyspaces and the N1QL service must be available.
110
+
111
+1. Ensure the N1QL (Query) service is running on the cluster
112
+
113
+2. Grant query system catalog privileges to the monitoring user:
114
+
115
+ ```sql
116
+ GRANT QUERY_SYSTEM_CATALOG TO netdata_user;
117
+ ```
118
+
119
+3. Verify access to `completed_requests`:
120
+
121
+ ```sql
122
+ SELECT * FROM system:completed_requests LIMIT 1;
123
+ ```
124
+
125
+ :::info
126
+
127
+ - The `system:completed_requests` keyspace stores recently completed queries based on Couchbase server settings `completed-limit` and `completed-threshold`
128
+ - Only queries exceeding `completed-threshold` (default 1000ms) are logged to `completed_requests`
129
+ - Adjust `completed-threshold` in Couchbase Query Settings to capture faster queries if needed
130
101
-Ensure the user can query system:completed_requests and the N1QL service is available.
131
+ :::
132
133
134
@@ -106,25 +136,25 @@ Ensure the user can query system:completed_requests and the N1QL service is avai
136
137
| Parameter | Type | Description | Required | Default | Options |
138
|:---------|:-----|:------------|:--------:|:--------|:--------|
109
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | elapsedTime | |
139
+| Filter By | select | Select the primary sort column. Options include elapsed time, service time, request time, and result count. Defaults to elapsed time to focus on slowest queries. | yes | elapsedTime | |
140
141
#### Returns
142
113
-Completed N1QL request statistics.
143
+Completed N1QL request statistics. Each row represents a single completed query with its timing and result metrics.
144
145
| Column | Type | Unit | Visibility | Description |
146
|:-------|:-----|:-----|:-----------|:------------|
117
-| Request ID | string | | hidden | |
118
-| Request Time | timestamp | | | |
119
-| Statement | string | | | |
120
-| Elapsed Time | duration | milliseconds | | |
121
-| Service Time | duration | milliseconds | | |
122
-| Result Count | integer | | | |
123
-| Result Size | integer | | hidden | |
124
-| Error Count | integer | | hidden | |
125
-| Warning Count | integer | | hidden | |
126
-| User | string | | | |
127
-| Client Context ID | string | | hidden | |
147
+| Request ID | string | | hidden | Unique identifier for the N1QL request. Can be used for correlation with Couchbase logs. |
148
+| Request Time | timestamp | | | Timestamp when the request was received by the query service. |
149
+| Statement | string | | | The N1QL statement that was executed. Truncated to 4096 characters. |
150
+| Elapsed Time | duration | milliseconds | | Total time from request receipt to response completion, including queue time, planning, execution, and result streaming. |
151
+| Service Time | duration | milliseconds | | Time spent actively processing the request, excluding network latency and queue wait time. Compare with elapsed time to identify network or queueing delays. |
152
+| Result Count | integer | | | Number of documents/rows returned by the query. High values may indicate queries returning excessive data. |
153
+| Result Size | integer | | hidden | Total size of the result set in bytes. Large result sizes may indicate inefficient queries or missing projections. |
154
+| Error Count | integer | | hidden | Number of errors encountered during query execution. Non-zero values require investigation. |
155
+| Warning Count | integer | | hidden | Number of warnings generated during query execution. Warnings may indicate suboptimal query patterns or index usage. |
156
+| User | string | | | Couchbase user who executed the query. Useful for identifying workload by user or application. |
157
+| Client Context ID | string | | hidden | Client-provided context identifier for request tracking and correlation. |
158
159
160
src/go/plugin/go.d/collector/elasticsearch/integrations/elasticsearch.md
+50
-18
@@ -173,44 +173,76 @@ This collector exposes real-time functions for interactive troubleshooting in th
173
174
### Top Queries
175
176
-Running queries from the Elasticsearch Tasks API.
176
+Retrieves currently running search tasks from the Elasticsearch [Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html).
177
178
-Calls the Tasks API and returns running task details sorted by the selected column.
178
+This function queries the `/_tasks` endpoint filtered for search actions (`*search`), providing a real-time snapshot of all active search operations across all nodes in the cluster.
179
+
180
+Use cases:
181
+- Identify long-running search queries that may be impacting cluster performance
182
+- Monitor active search workload distribution across cluster nodes
183
+- Debug slow or stuck search operations in real-time
184
185
186
| Aspect | Description |
187
|:-------|:------------|
188
| Name | `Elasticsearch:top-queries` |
184
-| Performance | Queries the Tasks API; on large clusters this may return many rows. |
185
-| Security | Task descriptions may include query details. |
186
-| Availability | Available when the collector can query the Tasks API; returns 503 until the collector is initialized. |
189
+| Require Cloud | yes |
190
+| Performance | Queries the `/_tasks` API filtered for search actions:<br/>• Lightweight operation with minimal cluster overhead<br/>• Returns only currently active search tasks, typically a small result set |
191
+| Security | Task descriptions may contain query details including potentially sensitive information:<br/>• Index names and search patterns<br/>• Query terms and filter values<br/>• Access should be restricted to authorized personnel only |
192
+| Availability | Available when:<br/>• The collector has successfully connected to Elasticsearch/OpenSearch<br/>• The user has `monitor` or `manage` cluster privileges<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the Tasks API query fails<br/>• Returns HTTP 504 if the query times out |
193
194
#### Prerequisites
195
190
-No additional configuration is required.
196
+##### Ensure access to Tasks API
197
+
198
+The user must have appropriate privileges to access the Tasks API.
199
+
200
+1. For secured clusters, grant the `monitor` or `manage` cluster privilege:
201
+
202
+ ```json
203
+ {
204
+ "cluster": ["monitor"]
205
+ }
206
+ ```
207
+
208
+2. Verify access to the Tasks API:
209
+
210
+ ```bash
211
+ curl -u user:password "http://localhost:9200/_tasks?actions=*search"
212
+ ```
213
+
214
+:::info
215
+
216
+- The Tasks API returns only currently running tasks; completed tasks are not stored
217
+- Search tasks can be cancelled using `POST /_tasks/{task_id}/_cancel` if they are cancellable
218
+- Works with both Elasticsearch and OpenSearch clusters
219
+
220
+:::
221
+
222
+
223
224
#### Parameters
225
226
| Parameter | Type | Description | Required | Default | Options |
227
|:---------|:-----|:------------|:--------:|:--------|:--------|
196
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | runningTime | |
228
+| Filter By | select | Select the primary sort column. Options include running time, start time, and task ID. Defaults to running time to show longest-running searches first. | yes | runningTime | |
229
230
#### Returns
231
200
-Snapshot of running tasks from the Tasks API.
232
+Real-time snapshot of currently executing search tasks across all cluster nodes. Each row represents a single active search operation.
233
234
| Column | Type | Unit | Visibility | Description |
235
|:-------|:-----|:-----|:-----------|:------------|
204
-| Task ID | string | | hidden | |
205
-| Node ID | string | | | |
206
-| Node Name | string | | | |
207
-| Action | string | | | |
208
-| Type | string | | hidden | |
209
-| Description | string | | | |
210
-| Start Time | timestamp | | | |
211
-| Running Time | duration | milliseconds | | |
212
-| Cancellable | boolean | | hidden | |
213
-| Cancelled | boolean | | hidden | |
236
+| Task ID | string | | hidden | Unique identifier for the task in format `nodeId:taskId`. Can be used with the Task Management API to cancel long-running tasks. |
237
+| Node ID | string | | | Internal identifier of the node executing this search task. |
238
+| Node Name | string | | | Human-readable name of the node executing the search. Useful for identifying workload distribution across the cluster. |
239
+| Action | string | | | The search action being performed (e.g., `indices:data/read/search`). Indicates the type of search operation. |
240
+| Type | string | | hidden | Task type classification (typically `transport` for search tasks). |
241
+| Description | string | | | Detailed description of the search task including indices being searched and query details. Truncated to 4096 characters. |
242
+| Start Time | timestamp | | | Timestamp when the search task started executing. |
243
+| Running Time | duration | milliseconds | | Time elapsed since the search started. High values indicate long-running searches that may need investigation or cancellation. |
244
+| Cancellable | boolean | | hidden | Whether the task supports cancellation via the Task Management API. |
245
+| Cancelled | boolean | | hidden | Whether a cancellation request has been issued for this task. |
246
247
248
src/go/plugin/go.d/collector/elasticsearch/integrations/opensearch.md
+50
-18
@@ -173,44 +173,76 @@ This collector exposes real-time functions for interactive troubleshooting in th
173
174
### Top Queries
175
176
-Running queries from the Elasticsearch Tasks API.
176
+Retrieves currently running search tasks from the Elasticsearch [Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html).
177
178
-Calls the Tasks API and returns running task details sorted by the selected column.
178
+This function queries the `/_tasks` endpoint filtered for search actions (`*search`), providing a real-time snapshot of all active search operations across all nodes in the cluster.
179
+
180
+Use cases:
181
+- Identify long-running search queries that may be impacting cluster performance
182
+- Monitor active search workload distribution across cluster nodes
183
+- Debug slow or stuck search operations in real-time
184
185
186
| Aspect | Description |
187
|:-------|:------------|
188
| Name | `Elasticsearch:top-queries` |
184
-| Performance | Queries the Tasks API; on large clusters this may return many rows. |
185
-| Security | Task descriptions may include query details. |
186
-| Availability | Available when the collector can query the Tasks API; returns 503 until the collector is initialized. |
189
+| Require Cloud | yes |
190
+| Performance | Queries the `/_tasks` API filtered for search actions:<br/>• Lightweight operation with minimal cluster overhead<br/>• Returns only currently active search tasks, typically a small result set |
191
+| Security | Task descriptions may contain query details including potentially sensitive information:<br/>• Index names and search patterns<br/>• Query terms and filter values<br/>• Access should be restricted to authorized personnel only |
192
+| Availability | Available when:<br/>• The collector has successfully connected to Elasticsearch/OpenSearch<br/>• The user has `monitor` or `manage` cluster privileges<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the Tasks API query fails<br/>• Returns HTTP 504 if the query times out |
193
194
#### Prerequisites
195
190
-No additional configuration is required.
196
+##### Ensure access to Tasks API
197
+
198
+The user must have appropriate privileges to access the Tasks API.
199
+
200
+1. For secured clusters, grant the `monitor` or `manage` cluster privilege:
201
+
202
+ ```json
203
+ {
204
+ "cluster": ["monitor"]
205
+ }
206
+ ```
207
+
208
+2. Verify access to the Tasks API:
209
+
210
+ ```bash
211
+ curl -u user:password "http://localhost:9200/_tasks?actions=*search"
212
+ ```
213
+
214
+:::info
215
+
216
+- The Tasks API returns only currently running tasks; completed tasks are not stored
217
+- Search tasks can be cancelled using `POST /_tasks/{task_id}/_cancel` if they are cancellable
218
+- Works with both Elasticsearch and OpenSearch clusters
219
+
220
+:::
221
+
222
+
223
224
#### Parameters
225
226
| Parameter | Type | Description | Required | Default | Options |
227
|:---------|:-----|:------------|:--------:|:--------|:--------|
196
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | runningTime | |
228
+| Filter By | select | Select the primary sort column. Options include running time, start time, and task ID. Defaults to running time to show longest-running searches first. | yes | runningTime | |
229
230
#### Returns
231
200
-Snapshot of running tasks from the Tasks API.
232
+Real-time snapshot of currently executing search tasks across all cluster nodes. Each row represents a single active search operation.
233
234
| Column | Type | Unit | Visibility | Description |
235
|:-------|:-----|:-----|:-----------|:------------|
204
-| Task ID | string | | hidden | |
205
-| Node ID | string | | | |
206
-| Node Name | string | | | |
207
-| Action | string | | | |
208
-| Type | string | | hidden | |
209
-| Description | string | | | |
210
-| Start Time | timestamp | | | |
211
-| Running Time | duration | milliseconds | | |
212
-| Cancellable | boolean | | hidden | |
213
-| Cancelled | boolean | | hidden | |
236
+| Task ID | string | | hidden | Unique identifier for the task in format `nodeId:taskId`. Can be used with the Task Management API to cancel long-running tasks. |
237
+| Node ID | string | | | Internal identifier of the node executing this search task. |
238
+| Node Name | string | | | Human-readable name of the node executing the search. Useful for identifying workload distribution across the cluster. |
239
+| Action | string | | | The search action being performed (e.g., `indices:data/read/search`). Indicates the type of search operation. |
240
+| Type | string | | hidden | Task type classification (typically `transport` for search tasks). |
241
+| Description | string | | | Detailed description of the search task including indices being searched and query details. Truncated to 4096 characters. |
242
+| Start Time | timestamp | | | Timestamp when the search task started executing. |
243
+| Running Time | duration | milliseconds | | Time elapsed since the search started. High values indicate long-running searches that may need investigation or cancellation. |
244
+| Cancellable | boolean | | hidden | Whether the task supports cancellation via the Task Management API. |
245
+| Cancelled | boolean | | hidden | Whether a cancellation request has been issued for this task. |
246
247
248
src/go/plugin/go.d/collector/mongodb/integrations/mongodb.md
+81
-36
@@ -212,23 +212,68 @@ This collector exposes real-time functions for interactive troubleshooting in th
212
213
### Top Queries
214
215
-Top queries from MongoDB Profiler (system.profile). WARNING: Query text may contain unmasked literals (potential PII).
215
+Retrieves profiled query statistics from MongoDB [system.profile](https://www.mongodb.com/docs/manual/reference/database-profiler/) collection.
216
217
-Reads from system.profile and returns the top profiled queries sorted by the selected column.
217
+This function queries the `system.profile` collection across all user databases (excluding admin, local, config) to retrieve slow or sampled queries captured by the MongoDB profiler. It provides detailed execution metrics including timing, document counts, and execution plan information.
218
+
219
+Use cases:
220
+- Identify slow queries that exceed the profiling threshold
221
+- Analyze query patterns by examining docs examined vs docs returned ratios
222
+- Detect collection scans (COLLSCAN) that may need index optimization
223
+
224
+Query text is truncated at 4096 characters for display purposes.
225
226
227
| Aspect | Description |
228
|:-------|:------------|
229
| Name | `Mongodb:top-queries` |
223
-| Performance | Requires profiling and reads from system.profile; may add load on busy systems. |
224
-| Security | Query text may contain unmasked literals (potential PII). |
225
-| Availability | Available when profiling is enabled and the collector is initialized; returns 403 if disabled in config. |
230
+| Require Cloud | yes |
231
+| Performance | Reads from `system.profile` collection across all user databases:<br/>• Profiling itself adds overhead to MongoDB operations (typically 1-5%)<br/>• Default limit of 500 rows balances usefulness with performance |
232
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Document field values in query filters<br/>• Personal information in inserted/updated documents<br/>• Access should be restricted to authorized personnel only |
233
+| Availability | Available when:<br/>• The collector has successfully connected to MongoDB<br/>• Profiling is enabled on at least one user database<br/>• Returns HTTP 503 if collector is still initializing or profiling is disabled on all databases<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
234
235
#### Prerequisites
236
237
##### Enable MongoDB profiling
238
231
-Enable profiling on the target databases and set top_queries_function_enabled to true.
239
+Database profiling must be enabled on each database you want to monitor, and the function must be enabled in the collector configuration.
240
+
241
+1. Enable profiling on a database (profile slow queries > 100ms):
242
+
243
+ ```javascript
244
+ use myDatabase
245
+ db.setProfilingLevel(1, { slowms: 100 })
246
+ ```
247
+
248
+2. Or profile all operations (level 2, use with caution):
249
+
250
+ ```javascript
251
+ db.setProfilingLevel(2)
252
+ ```
253
+
254
+3. Verify profiling status:
255
+
256
+ ```javascript
257
+ db.getProfilingStatus()
258
+ ```
259
+
260
+4. Enable the function in Netdata collector config:
261
+
262
+ ```yaml
263
+ jobs:
264
+ - name: local
265
+ uri: mongodb://localhost:27017
266
+ top_queries_function_enabled: true
267
+ ```
268
+
269
+:::info
270
+
271
+- Profiling level 0 = off, 1 = slow operations only, 2 = all operations
272
+- The `slowms` threshold determines which queries are captured at level 1
273
+- `system.profile` is a capped collection; old entries are automatically removed
274
+- System databases (admin, local, config) are excluded from profiling queries
275
+
276
+:::
277
278
279
@@ -236,42 +281,42 @@ Enable profiling on the target databases and set top_queries_function_enabled to
281
282
| Parameter | Type | Description | Required | Default | Options |
283
|:---------|:-----|:------------|:--------:|:--------|:--------|
239
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | execution_time | |
284
+| Filter By | select | Select the primary sort column. Options include execution time, docs examined, keys examined, and more. Defaults to execution time to focus on slowest queries. | yes | execution_time | |
285
286
#### Returns
287
243
-Profiled query statistics from system.profile.
288
+Profiled query statistics from `system.profile`. Each row represents a single profiled operation with execution metrics and plan details.
289
290
| Column | Type | Unit | Visibility | Description |
291
|:-------|:-----|:-----|:-----------|:------------|
247
-| Timestamp | timestamp | | | |
248
-| Namespace | string | | | |
249
-| Operation | string | | | |
250
-| Query | string | | | |
251
-| Execution Time | duration | seconds | | |
252
-| Docs Examined | integer | | | |
253
-| Keys Examined | integer | | | |
254
-| Docs Returned | integer | | | |
255
-| Plan Summary | string | | | |
256
-| Client | string | | | |
257
-| User | string | | | |
258
-| Docs Deleted | integer | | hidden | |
259
-| Docs Inserted | integer | | hidden | |
260
-| Docs Modified | integer | | hidden | |
261
-| Response Length | integer | | hidden | |
262
-| Num Yield | integer | | hidden | |
263
-| App Name | string | | | |
264
-| Cursor Exhausted | string | | hidden | |
265
-| Has Sort Stage | string | | hidden | |
266
-| Uses Disk | string | | hidden | |
267
-| From Multi Planner | string | | hidden | |
268
-| Replanned | string | | hidden | |
269
-| Query Hash | string | | hidden | |
270
-| Plan Cache Key | string | | hidden | |
271
-| Planning Time | duration | seconds | hidden | |
272
-| CPU Time | duration | seconds | hidden | |
273
-| Query Framework | string | | hidden | |
274
-| Query Shape Hash | string | | hidden | |
292
+| Timestamp | timestamp | | | When the operation was profiled. Useful for correlating slow queries with application events. |
293
+| Namespace | string | | | Database and collection name in format `database.collection`. Identifies which collection the operation targeted. |
294
+| Operation | string | | | Type of operation: query, insert, update, remove, command, getmore. Helps categorize workload patterns. |
295
+| Query | string | | | The command document as JSON showing the query filter, projection, and options. Truncated to 4096 characters. |
296
+| Execution Time | duration | seconds | | Total execution time of the operation. High values indicate slow queries that may need optimization. |
297
+| Docs Examined | integer | | | Number of documents scanned during execution. A high ratio of docs examined to docs returned suggests missing or inefficient indexes. |
298
+| Keys Examined | integer | | | Number of index keys scanned. Compare with docs examined to assess index efficiency. |
299
+| Docs Returned | integer | | | Number of documents returned to the client. Compare with docs examined to identify inefficient queries. |
300
+| Plan Summary | string | | | Execution plan summary (e.g., IXSCAN, COLLSCAN, SORT). COLLSCAN indicates a full collection scan that may need an index. |
301
+| Client | string | | | Client IP address or hostname that executed the operation. Useful for identifying query sources. |
302
+| User | string | | | Authenticated user who executed the operation. Empty for unauthenticated connections. |
303
+| Docs Deleted | integer | | hidden | Number of documents deleted by the operation. Relevant for remove operations. |
304
+| Docs Inserted | integer | | hidden | Number of documents inserted by the operation. Relevant for insert operations. |
305
+| Docs Modified | integer | | hidden | Number of documents modified by the operation. Relevant for update operations. |
306
+| Response Length | integer | | hidden | Size of the response in bytes. Large responses may indicate queries returning excessive data. |
307
+| Num Yield | integer | | hidden | Number of times the operation yielded to allow other operations to proceed. High yields may indicate lock contention. |
308
+| App Name | string | | | Application name from the client connection string. Useful for identifying which application generated the query. |
309
+| Cursor Exhausted | string | | hidden | Whether the cursor was fully exhausted (Yes/No). |
310
+| Has Sort Stage | string | | hidden | Whether the query required an in-memory sort stage (Yes/No). In-memory sorts are slower than index-based sorts. |
311
+| Uses Disk | string | | hidden | Whether the operation used disk for sorting or aggregation (Yes/No). Indicates memory pressure. |
312
+| From Multi Planner | string | | hidden | Whether multiple query plans were evaluated (Yes/No). |
313
+| Replanned | string | | hidden | Whether the query was replanned due to plan cache eviction (Yes/No). |
314
+| Query Hash | string | | hidden | Hash of the query shape for identifying similar queries. Available in MongoDB 4.2+. |
315
+| Plan Cache Key | string | | hidden | Key used for plan cache lookup. Available in MongoDB 4.2+. |
316
+| Planning Time | duration | seconds | hidden | Time spent planning the query execution. Available in MongoDB 6.2+. |
317
+| CPU Time | duration | seconds | hidden | CPU time consumed by the operation. Available in MongoDB 6.3+ on Linux only. |
318
+| Query Framework | string | | hidden | Query execution framework used (classic or SBE). Available in MongoDB 7.0+. |
319
+| Query Shape Hash | string | | hidden | Hash representing the query shape for grouping similar queries. Available in MongoDB 8.0+. |
320
321
322
src/go/plugin/go.d/collector/mssql/integrations/microsoft_sql_server.md
+108
-69
@@ -241,23 +241,62 @@ This collector exposes real-time functions for interactive troubleshooting in th
241
242
### Top Queries
243
244
-Top SQL queries from Query Store.
244
+Retrieves aggregated SQL query performance metrics from Microsoft SQL Server [Query Store](https://learn.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store) runtime statistics.
245
246
-Queries Query Store runtime statistics and returns the top entries sorted by the selected column.
246
+This function queries `sys.query_store_runtime_stats` and related views across all databases with Query Store enabled, aggregating execution statistics by query hash. It provides comprehensive timing, I/O, memory, and parallelism metrics.
247
+
248
+Use cases:
249
+- Identify slow or resource-intensive queries consuming excessive CPU time or memory
250
+- Analyze I/O patterns (logical reads, physical reads, writes) to detect bottlenecks
251
+- Monitor parallelism (DOP) and tempdb usage for capacity planning
252
+
253
+Query text is truncated at 4096 characters for display purposes. Columns are dynamically detected based on SQL Server version (some metrics only available in 2016+/2017+).
254
255
256
| Aspect | Description |
257
|:-------|:------------|
258
| Name | `Mssql:top-queries` |
252
-| Performance | Uses Query Store and can be expensive on busy instances. |
253
-| Security | Query Store may contain unmasked literals (potential PII). |
254
-| Availability | Available when Query Store is enabled and the collector is initialized; returns 403 if disabled in config. |
259
+| Require Cloud | yes |
260
+| Performance | Executes dynamic SQL to aggregate Query Store data across all enabled databases:<br/>• Execution time depends on Query Store workload and number of monitored databases<br/>• Default limit of 500 rows balances completeness with performance |
261
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
262
+| Availability | Available when:<br/>• The collector has successfully connected to SQL Server<br/>• Query Store is enabled on at least one user database<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
263
264
#### Prerequisites
265
258
-##### Enable Query Store functions
266
+##### Enable Query Store
267
+
268
+Query Store must be enabled on each database you want to monitor.
269
+
270
+1. Verify Query Store is enabled on your databases:
271
+
272
+ ```sql
273
+ SELECT name, is_query_store_on
274
+ FROM sys.databases
275
+ WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb');
276
+ ```
277
+
278
+2. Enable Query Store on databases where it is disabled:
279
260
-Enable Query Store and set query_store_function_enabled to true.
280
+ ```sql
281
+ ALTER DATABASE [YourDatabaseName] SET QUERY_STORE = ON;
282
+ ```
283
+
284
+3. Enable the function in Netdata collector config:
285
+
286
+ ```yaml
287
+ jobs:
288
+ - name: local
289
+ dsn: "sqlserver://user:pass@localhost:1433"
290
+ query_store_function_enabled: true
291
+ ```
292
+
293
+:::info
294
+
295
+- Query Store is available in SQL Server 2016+ and Azure SQL Database
296
+- Requires ALTER DATABASE permission to enable Query Store
297
+- System databases (master, tempdb, model, msdb) are excluded from queries
298
+
299
+:::
300
301
302
@@ -265,74 +304,74 @@ Enable Query Store and set query_store_function_enabled to true.
304
305
| Parameter | Type | Description | Required | Default | Options |
306
|:---------|:-----|:------------|:--------:|:--------|:--------|
268
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
307
+| Filter By | select | Select the primary sort column. The available options depend on your SQL Server version and include metrics like total execution time, number of calls, CPU time, logical I/O, memory grants, and more. Default is Total Time to focus on most resource-intensive queries. | yes | totalTime | |
308
309
#### Returns
310
272
-Query Store statistics for top queries.
311
+Aggregated query execution statistics from Query Store runtime views, providing comprehensive performance analysis across all monitored databases. Each row represents a unique query pattern (normalized query hash) with cumulative metrics across all its executions.
312
313
| Column | Type | Unit | Visibility | Description |
314
|:-------|:-----|:-----|:-----------|:------------|
276
-| Query Hash | string | | hidden | |
277
-| Query | string | | | |
278
-| Database | string | | | |
279
-| Calls | integer | | | |
280
-| Total Time | duration | milliseconds | | |
281
-| Avg Time | duration | milliseconds | | |
282
-| Last Time | duration | milliseconds | hidden | |
283
-| Min Time | duration | milliseconds | hidden | |
284
-| Max Time | duration | milliseconds | hidden | |
285
-| StdDev Time | duration | milliseconds | hidden | |
286
-| Avg CPU | duration | milliseconds | | |
287
-| Last CPU | duration | milliseconds | hidden | |
288
-| Min CPU | duration | milliseconds | hidden | |
289
-| Max CPU | duration | milliseconds | hidden | |
290
-| StdDev CPU | duration | milliseconds | hidden | |
291
-| Avg Logical Reads | float | | | |
292
-| Last Logical Reads | integer | | hidden | |
293
-| Min Logical Reads | integer | | hidden | |
294
-| Max Logical Reads | integer | | hidden | |
295
-| StdDev Logical Reads | float | | hidden | |
296
-| Avg Logical Writes | float | | | |
297
-| Last Logical Writes | integer | | hidden | |
298
-| Min Logical Writes | integer | | hidden | |
299
-| Max Logical Writes | integer | | hidden | |
300
-| StdDev Logical Writes | float | | hidden | |
301
-| Avg Physical Reads | float | | | |
302
-| Last Physical Reads | integer | | hidden | |
303
-| Min Physical Reads | integer | | hidden | |
304
-| Max Physical Reads | integer | | hidden | |
305
-| StdDev Physical Reads | float | | hidden | |
306
-| Avg CLR Time | duration | milliseconds | hidden | |
307
-| Last CLR Time | duration | milliseconds | hidden | |
308
-| Min CLR Time | duration | milliseconds | hidden | |
309
-| Max CLR Time | duration | milliseconds | hidden | |
310
-| StdDev CLR Time | duration | milliseconds | hidden | |
311
-| Avg DOP | float | | | |
312
-| Last DOP | integer | | hidden | |
313
-| Min DOP | integer | | hidden | |
314
-| Max DOP | integer | | hidden | |
315
-| StdDev DOP | float | | hidden | |
316
-| Avg Memory (8KB pages) | float | | | |
317
-| Last Memory (8KB pages) | integer | | hidden | |
318
-| Min Memory (8KB pages) | integer | | hidden | |
319
-| Max Memory (8KB pages) | integer | | hidden | |
320
-| StdDev Memory | float | | hidden | |
321
-| Avg Rows | float | | | |
322
-| Last Rows | integer | | hidden | |
323
-| Min Rows | integer | | hidden | |
324
-| Max Rows | integer | | hidden | |
325
-| StdDev Rows | float | | hidden | |
326
-| Avg Log Bytes | float | | | |
327
-| Last Log Bytes | integer | | hidden | |
328
-| Min Log Bytes | integer | | hidden | |
329
-| Max Log Bytes | integer | | hidden | |
330
-| StdDev Log Bytes | float | | hidden | |
331
-| Avg TempDB (8KB pages) | float | | | |
332
-| Last TempDB (8KB pages) | integer | | hidden | |
333
-| Min TempDB (8KB pages) | integer | | hidden | |
334
-| Max TempDB (8KB pages) | integer | | hidden | |
335
-| StdDev TempDB | float | | hidden | |
315
+| Query Hash | string | | hidden | Unique hash identifier for the normalized query pattern. Queries with identical structure but different literal values share the same digest. |
316
+| Query | string | | | The SQL query text with literal values truncated at 4096 characters. Use this to identify the actual SQL being executed and spot parameterized queries or injection risks. |
317
+| Database | string | | | Database name where the query was executed. Essential for multi-database analysis to identify which database is experiencing query load. |
318
+| Calls | integer | | | Total number of times this query pattern has been executed. High values indicate frequently run queries that may impact server performance significantly. |
319
+| Total Time | duration | milliseconds | | Cumulative execution time across all query executions. This is a key metric for identifying the most resource-intensive queries in terms of total server time consumption. |
320
+| Avg Time | duration | milliseconds | | Average execution time per query run, calculated as weighted average when execution count is greater than zero. Compare with Total Time to determine if individual executions or high frequency drives resource usage. |
321
+| Last Time | duration | milliseconds | hidden | Execution time of the most recent execution for this query pattern. Useful for identifying recent performance changes or individual outlier executions. |
322
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed. Helps identify variability in query performance and spot potential optimization opportunities for outliers. |
323
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed. Large gaps between Min Time and Max Time may indicate performance instability due to parameter sniffing, data skew, or lock contention. |
324
+| StdDev Time | duration | milliseconds | hidden | Standard deviation of execution time. High values indicate inconsistent query performance, making capacity planning difficult and suggesting need for query optimization or consistent indexing. |
325
+| Avg CPU | duration | milliseconds | | Average CPU time consumed per query execution. High values indicate CPU-intensive operations that may include complex calculations, string manipulations, or excessive function calls. Available in SQL Server 2016+. |
326
+| Last CPU | duration | milliseconds | hidden | CPU time of the most recent execution. Useful for identifying recent changes in query patterns and resource usage. |
327
+| Min CPU | duration | milliseconds | hidden | Minimum CPU time observed. Helps identify variability in CPU consumption and spot efficient vs. inefficient query executions. |
328
+| Max CPU | duration | milliseconds | hidden | Maximum CPU time observed. Spikes may indicate complex queries, large result sets, or parallelism issues. |
329
+| StdDev CPU | duration | milliseconds | hidden | Standard deviation of CPU time. High variability suggests inconsistent performance due to varying data volumes, plan cache hit rates, or changing execution contexts. |
330
+| Avg Logical Reads | float | | | Average number of logical read operations (8KB pages) per execution. High values indicate queries scanning large amounts of data through indexes or table scans. Monitor for I/O subsystem impact. |
331
+| Last Logical Reads | integer | | hidden | Logical reads from the most recent execution. Useful for identifying immediate query patterns and recent performance changes. |
332
+| Min Logical Reads | integer | | hidden | Minimum logical reads observed. Helps identify data access patterns and spot outliers. |
333
+| Max Logical Reads | integer | | hidden | Maximum logical reads observed. Very high values may indicate full table scans, missing indexes, or inefficient join operations requiring excessive data access. |
334
+| StdDev Logical Reads | float | | hidden | Standard deviation of logical reads. High variability suggests inconsistent access patterns, potentially indicating performance issues with certain queries or data volumes. |
335
+| Avg Logical Writes | float | | | Average number of logical write operations per execution. High values indicate heavy write workloads that may benefit from batching or optimization. |
336
+| Last Logical Writes | integer | | hidden | Logical writes from the most recent execution. Helps track recent write activity and identify immediate performance impact. |
337
+| Min Logical Writes | integer | | hidden | Minimum logical writes observed. Helps identify read-heavy vs. write-heavy query patterns and data access characteristics. |
338
+| Max Logical Writes | integer | | hidden | Maximum logical writes observed. Spikes may indicate bulk insert/update operations, large transactions, or data migration activities. |
339
+| StdDev Logical Writes | float | | hidden | Standard deviation of logical writes. High values indicate write performance variability, potentially suggesting inconsistent transaction sizes or periodic bulk operations. |
340
+| Avg Physical Reads | float | | | Average number of physical read operations from storage per execution. High values indicate queries requiring substantial disk I/O for data retrieval, potentially due to full table scans or missing covering indexes. |
341
+| Last Physical Reads | integer | | hidden | Physical reads from the most recent execution. Useful for identifying immediate I/O patterns and recent storage subsystem pressure. |
342
+| Min Physical Reads | integer | | hidden | Minimum physical reads observed. Helps baseline I/O patterns and identify read-intensive query scenarios. |
343
+| Max Physical Reads | integer | | hidden | Maximum physical reads observed. Extremely high values may indicate storage subsystem bottlenecks, full table scans without covering indexes, or queries processing very large data volumes. |
344
+| StdDev Physical Reads | float | | hidden | Standard deviation of physical reads. High variability suggests inconsistent disk access patterns, potentially indicating intermittent I/O performance issues or storage contention. |
345
+| Avg CLR Time | duration | milliseconds | | Average CLR (Common Language Runtime) time per execution. High values indicate managed code (stored procedures, functions, triggers) with heavy computations, garbage collection pressure, or inefficient memory allocations. Available in SQL Server 2016+. |
346
+| Last CLR Time | duration | milliseconds | hidden | CLR time of the most recent execution. Useful for identifying recent managed code performance changes and detecting inefficient code deployments. |
347
+| Min CLR Time | duration | milliseconds | hidden | Minimum CLR time observed. Helps identify efficient managed code executions and spot expensive CLR operations. |
348
+| Max CLR Time | duration | milliseconds | hidden | Maximum CLR time observed. Spikes may indicate complex managed code operations, large object allocations, or expensive .NET framework method calls. |
349
+| StdDev CLR Time | duration | milliseconds | hidden | Standard deviation of CLR time. High variability suggests inconsistent managed code execution patterns, potentially varying by execution parameters, data volumes, or different code paths being taken. |
350
+| Avg DOP | float | | | Average Degree of Parallelism (DOP) per query. Higher values indicate queries utilizing more CPU cores through parallelism, potentially consuming significant server resources. Values above 1 indicate intra-query parallelism; values of 1 indicate serial execution. |
351
+| Last DOP | integer | | hidden | DOP of the most recent execution. Helps track recent parallelism patterns and identify changes in query execution behavior. |
352
+| Min DOP | integer | | hidden | Minimum DOP observed. Values of 0 may indicate serial execution; values above 1 suggest parallel query execution within individual queries. |
353
+| Max DOP | integer | | hidden | Maximum DOP observed. Very high values (>4) may indicate aggressive parallelism consuming excessive resources and potentially affecting concurrent workloads. Available in SQL Server 2016+. |
354
+| StdDev DOP | float | | hidden | Standard deviation of DOP. High variability suggests inconsistent parallelism patterns across executions, potentially indicating performance variability based on data characteristics or query complexity. |
355
+| Avg Memory (8KB pages) | float | | | Average memory grant (in 8KB pages) per execution. High values indicate memory-intensive queries that may benefit from index optimization, reduced result sets, or query tuning to reduce working memory usage. |
356
+| Last Memory (8KB pages) | integer | | hidden | Memory grant from the most recent execution. Useful for identifying recent memory pressure and tracking immediate impact of resource-intensive queries. |
357
+| Min Memory (8KB pages) | integer | | hidden | Minimum memory grant observed. Helps identify memory-efficient queries and baseline memory requirements for common operations. |
358
+| Max Memory (8KB pages) | integer | | hidden | Maximum memory grant observed. Spikes may indicate queries with large sort operations, hash joins, temporary table creation, or excessive parameter lengths consuming working memory. |
359
+| StdDev Memory | float | | hidden | Standard deviation of memory grants. High variability suggests inconsistent memory usage patterns, potentially varying by execution parameters, result set sizes, or different code paths being executed. |
360
+| Avg Rows | float | | | Average number of rows processed per query execution. High values indicate queries returning large result sets that may consume significant network bandwidth, memory for result buffers, and client application resources. |
361
+| Last Rows | integer | | hidden | Row count from the most recent execution. Helps identify recent query patterns and track immediate data processing requirements. |
362
+| Min Rows | integer | | hidden | Minimum rows observed. Helps identify data access patterns and spot outliers in result set sizes. |
363
+| Max Rows | integer | | hidden | Maximum rows observed. Extremely high values may indicate full table scans without WHERE clauses, missing or inefficient filters, or data export operations. |
364
+| StdDev Rows | float | | hidden | Standard deviation of rows processed. High variability suggests inconsistent result set sizes, potentially due to varying query filters, parameterized inputs, or different data distributions across executions. |
365
+| Avg Log Bytes | float | | | Average transaction log bytes written per query execution (SQL Server 2017+). High values indicate write-intensive operations (INSERT/UPDATE/DELETE), large transactions, or bulk modifications. This measures WAL activity, not diagnostic logging. |
366
+| Last Log Bytes | integer | | hidden | Transaction log bytes from the most recent execution. Useful for tracking recent write activity. |
367
+| Min Log Bytes | integer | | hidden | Minimum transaction log bytes observed. Helps identify write-efficient queries and baseline requirements. |
368
+| Max Log Bytes | integer | | hidden | Maximum transaction log bytes observed. Spikes may indicate bulk operations, large transactions, or queries affecting many rows. |
369
+| StdDev Log Bytes | float | | hidden | Standard deviation of transaction log bytes. High variability suggests inconsistent write patterns, potentially varying by the number of rows affected or transaction sizes. |
370
+| Avg TempDB (8KB pages) | float | | | Average tempdb space usage (in 8KB pages) per execution. High values indicate queries that create or use large temporary objects, work tables, sort operations, or have heavy tempdb spillage from disk. High tempdb usage can lead to disk I/O contention and overall performance degradation. |
371
+| Last TempDB (8KB pages) | integer | | hidden | Tempdb space from the most recent execution. Useful for identifying recent tempdb pressure and tracking immediate disk I/O impact of resource-intensive queries. |
372
+| Min TempDB (8KB pages) | integer | | hidden | Minimum tempdb space observed. Helps identify tempdb-efficient queries and baseline temporary object requirements for common operations. |
373
+| Max TempDB (8KB pages) | integer | | hidden | Maximum tempdb space observed. Spikes may indicate queries with large sort operations, hash joins, index spool usage, or temporary table creation consuming substantial tempdb space. Can lead to tempdb autogrow and disk space issues. |
374
+| StdDev TempDB | float | | hidden | Standard deviation of tempdb space usage. High variability suggests inconsistent temporary object usage patterns, potentially varying by query complexity, parameter types, or different data access patterns affecting temporary object creation. |
375
376
377
src/go/plugin/go.d/collector/mysql/integrations/mariadb.md
+120
-47
@@ -190,23 +190,96 @@ This collector exposes real-time functions for interactive troubleshooting in th
190
191
### Top Queries
192
193
-Top SQL queries from performance_schema.
193
+Retrieves aggregated SQL query performance metrics from MySQL [performance_schema.events_statements_summary_by_digest](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-statement-summary-tables.html) table.
194
195
-Reads performance_schema statement digest tables and returns the top entries sorted by the selected column.
195
+This function queries the `events_statements_summary_by_digest` table which contains aggregated statistics for SQL statements grouped by their digest (normalized query pattern). The function dynamically detects available columns based on your MySQL/MariaDB version.
196
+
197
+Use cases:
198
+- Identify slow queries that consume the most execution time
199
+- Find frequently executed queries that may benefit from optimization
200
+- Detect queries with high lock time, errors, or table scans
201
+
202
+Query text is truncated at 4096 characters for display purposes.
203
204
205
| Aspect | Description |
206
|:-------|:------------|
207
| Name | `Mysql:top-queries` |
201
-| Performance | Requires performance_schema and can be expensive on busy servers. |
202
-| Security | Query text may contain unmasked literals (potential PII). |
203
-| Availability | Available when performance_schema tables are accessible and the collector is initialized. |
208
+| Require Cloud | yes |
209
+| Performance | Queries the `events_statements_summary_by_digest` table:<br/>• On busy servers with high query throughput, the digest table can grow large<br/>• Default limit of 500 rows balances usefulness with performance |
210
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
211
+| Availability | Available when:<br/>• The collector has successfully connected to MySQL<br/>• Performance Schema is enabled with statement digest collection<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
212
213
#### Prerequisites
214
207
-##### Enable performance_schema digest tables
215
+##### Enable performance_schema statement digest collection
216
+
217
+Performance Schema must be enabled and statement instrumentation must be configured to collect digest statistics.
218
+
219
+1. Check if Performance Schema is enabled:
220
+ ```sql
221
+ SELECT @@performance_schema;
222
+ ```
223
+
224
+2. Check statement instrumentation configuration:
225
+ ```sql
226
+ SELECT * FROM performance_schema.setup_consumers
227
+ WHERE NAME LIKE '%statement%';
228
+ ```
229
+
230
+3. The following consumers should be enabled:
231
+ - `events_statements_current`
232
+ - `events_statements_summary_by_digest`
233
+
234
+4. Enable statement consumers if needed:
235
+ ```sql
236
+ UPDATE performance_schema.setup_consumers
237
+ SET ENABLED = 'YES'
238
+ WHERE NAME LIKE 'events_statements%';
239
+ ```
240
+
241
+ :::info
242
+
243
+ - Changes to `setup_consumers` take effect immediately without requiring a server restart.
244
+ - MariaDB also supports the `events_statements_summary_by_digest` table. Exact consumer names may vary by MariaDB version, so checking `setup_consumers` first as shown above is recommended.
245
+
246
+ :::
247
+
248
+5. Verify digest table contains data:
249
+ ```sql
250
+ SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
251
+ ```
252
+
253
+ Note: Statement digest data is accumulated since server startup or since the table was last truncated. To reset statistics:
254
+ ```sql
255
+ TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
256
+ ```
257
+
258
+ Ensure that statement instruments are enabled in the Performance Schema so that statement digest statistics are collected. Refer to your MySQL or MariaDB version documentation for the appropriate configuration options.
259
+
260
+
261
+##### Grant SELECT permission on Performance Schema tables
262
+
263
+The netdata user must have SELECT permission on Performance Schema tables. The standard collector permissions
264
+(USAGE, REPLICATION CLIENT, PROCESS) do not automatically include Performance Schema access.
265
+
266
+1. Grant the required permission:
267
+ ```sql
268
+ GRANT SELECT ON performance_schema.* TO 'netdata'@'localhost';
269
+ FLUSH PRIVILEGES;
270
+ ```
271
+
272
+ :::info
273
+
274
+ The host part (`'localhost'`) should match how the netdata user connects. If connecting via TCP/IP, you may need `'netdata'@'%'` or a specific IP address instead.
275
+
276
+ :::
277
209
-Enable performance_schema and grant access to events_statements_summary_by_digest.
278
+2. Verify access:
279
+ ```sql
280
+ -- As the netdata user:
281
+ SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
282
+ ```
283
284
285
@@ -214,52 +287,52 @@ Enable performance_schema and grant access to events_statements_summary_by_diges
287
288
| Parameter | Type | Description | Required | Default | Options |
289
|:---------|:-----|:------------|:--------:|:--------|:--------|
217
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
290
+| Filter By | select | Select the primary sort column. The available options depend on your MySQL/MariaDB version and include metrics like total execution time, number of calls, lock time, errors, rows examined, and more. Defaults to total execution time. | yes | totalTime | |
291
292
#### Returns
293
221
-Aggregated statement statistics from performance_schema.
294
+Aggregated statement statistics from Performance Schema, grouped by query digest. Each row represents a unique query pattern with cumulative metrics across all executions.
295
296
| Column | Type | Unit | Visibility | Description |
297
|:-------|:-----|:-----|:-----------|:------------|
225
-| Digest | string | | hidden | |
226
-| Query | string | | | |
227
-| Schema | string | | | |
228
-| Calls | integer | | | |
229
-| Total Time | duration | milliseconds | | |
230
-| Min Time | duration | milliseconds | hidden | |
231
-| Avg Time | duration | milliseconds | | |
232
-| Max Time | duration | milliseconds | hidden | |
233
-| Lock Time | duration | milliseconds | | |
234
-| Errors | integer | | | |
235
-| Warnings | integer | | | |
236
-| Rows Affected | integer | | | |
237
-| Rows Sent | integer | | | |
238
-| Rows Examined | integer | | | |
239
-| Temp Disk Tables | integer | | | |
240
-| Temp Tables | integer | | | |
241
-| Full Joins | integer | | | |
242
-| Full Range Joins | integer | | hidden | |
243
-| Select Range | integer | | hidden | |
244
-| Select Range Check | integer | | hidden | |
245
-| Select Scan | integer | | | |
246
-| Sort Merge Passes | integer | | hidden | |
247
-| Sort Range | integer | | hidden | |
248
-| Sort Rows | integer | | | |
249
-| Sort Scan | integer | | hidden | |
250
-| No Index Used | integer | | | |
251
-| No Good Index Used | integer | | hidden | |
252
-| First Seen | string | | hidden | |
253
-| Last Seen | string | | hidden | |
254
-| P95 Time | duration | milliseconds | | |
255
-| P99 Time | duration | milliseconds | | |
256
-| P99.9 Time | duration | milliseconds | hidden | |
257
-| Sample Query | string | | hidden | |
258
-| Sample Seen | string | | hidden | |
259
-| Sample Time | duration | milliseconds | hidden | |
260
-| CPU Time | duration | milliseconds | | |
261
-| Max Controlled Memory | integer | | | |
262
-| Max Total Memory | integer | | | |
298
+| Digest | string | | hidden | Unique hash identifier for the normalized query pattern. Queries with the same structure (different literal values) share the same digest. |
299
+| Query | string | | | Normalized SQL query text with literals replaced by placeholders (e.g., '?' for values). Truncated to 4096 characters. |
300
+| Schema | string | | | Database schema name where the query was executed. Empty string for queries without a schema context. |
301
+| Calls | integer | | | Total number of times this query pattern has been executed since server startup or since the digest table was last truncated. |
302
+| Total Time | duration | milliseconds | | Cumulative execution time across all executions. High values indicate queries that consume significant server resources. |
303
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed for a single execution. Helps identify variability in query performance. |
304
+| Avg Time | duration | milliseconds | | Average execution time (total time divided by calls). Use this to compare performance across different query patterns. |
305
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed for a single execution. Large gaps between min and max may indicate performance instability. |
306
+| Lock Time | duration | milliseconds | | Total time spent waiting for table locks across all executions. High lock time may indicate contention from concurrent transactions. |
307
+| Errors | integer | | | Total number of times this query pattern resulted in an error. Non-zero values require investigation into the underlying issue. |
308
+| Warnings | integer | | | Total number of times this query pattern generated warnings. Warnings may indicate data type conversions, NULL handling issues, or other non-critical problems. |
309
+| Rows Affected | integer | | | Total number of rows modified by INSERT, UPDATE, DELETE, or REPLACE statements. Useful for tracking write workloads. |
310
+| Rows Sent | integer | | | Total number of rows returned to the client by SELECT statements. High values may indicate result sets that are too large. |
311
+| Rows Examined | integer | | | Total number of rows read during query execution. A high ratio of rows examined to rows sent suggests missing or inefficient indexes. |
312
+| Temp Disk Tables | integer | | | Total number of temporary tables created on disk across all executions. Disk-based temporary tables are significantly slower than in-memory tables and may indicate memory pressure or complex operations requiring sorting/grouping. |
313
+| Temp Tables | integer | | | Total number of temporary tables created (both in-memory and on-disk). High values suggest frequent sorting, grouping, or DISTINCT operations. |
314
+| Full Joins | integer | | | Total number of joins that performed a full table scan without using an index. These are typically very expensive operations that should be optimized. |
315
+| Full Range Joins | integer | | hidden | Total number of joins that used a range scan on the first table. Less efficient than indexed joins but better than full scans. |
316
+| Select Range | integer | | hidden | Total number of joins that used a range on the first table for row selection. |
317
+| Select Range Check | integer | | hidden | Total number of joins that checked each row after scanning for key ranges. Very inefficient operation. |
318
+| Select Scan | integer | | | Total number of joins that performed a full scan of the first table. Indicates missing indexes or suboptimal join order. |
319
+| Sort Merge Passes | integer | | hidden | Total number of merge passes performed during sort operations. More passes indicate larger datasets that exceed sort buffer size. |
320
+| Sort Range | integer | | hidden | Total number of sorts that used a range scan. |
321
+| Sort Rows | integer | | | Total number of rows sorted across all executions. High values indicate frequent sorting operations on large datasets. |
322
+| Sort Scan | integer | | hidden | Total number of sorts that required a full table scan. |
323
+| No Index Used | integer | | | Total number of executions where no index was used for table access. These queries are prime candidates for index optimization. |
324
+| No Good Index Used | integer | | hidden | Total number of executions where a non-optimal index was used. Indicates that while an index exists, a better one might improve performance. |
325
+| First Seen | string | | hidden | Timestamp when this query pattern was first observed. Helps identify new queries that may have been introduced by application changes. |
326
+| Last Seen | string | | hidden | Timestamp when this query pattern was last executed. Can help identify stale queries that are no longer in use. |
327
+| P95 Time | duration | milliseconds | | 95th percentile execution time. 95% of executions completed within this time. Available in MySQL 8.0+. Useful for understanding typical performance. |
328
+| P99 Time | duration | milliseconds | | 99th percentile execution time. 99% of executions completed within this time. Available in MySQL 8.0+. Helps identify outlier slow executions. |
329
+| P99.9 Time | duration | milliseconds | hidden | 99.9th percentile execution time. Available in MySQL 8.0+. Identifies extreme outliers in query performance. |
330
+| Sample Query | string | | hidden | Example of an actual query execution with literal values preserved. Available in MySQL 8.0+. Helpful for understanding the exact queries being executed. |
331
+| Sample Seen | string | | hidden | Timestamp when the sample query was captured. Available in MySQL 8.0+. |
332
+| Sample Time | duration | milliseconds | hidden | Execution time of the captured sample query. Available in MySQL 8.0+. |
333
+| CPU Time | duration | milliseconds | | Total CPU time consumed across all executions. Available in MySQL 8.0.28+. Helps identify CPU-intensive queries. |
334
+| Max Controlled Memory | integer | | | Maximum memory controlled by the query executor for this query pattern. Available in MySQL 8.0.31+. Helps identify memory-intensive operations. |
335
+| Max Total Memory | integer | | | Maximum total memory used by this query pattern including both controlled and uncontrolled allocations. Available in MySQL 8.0.31+. |
336
337
338
src/go/plugin/go.d/collector/mysql/integrations/mysql.md
+120
-47
@@ -190,23 +190,96 @@ This collector exposes real-time functions for interactive troubleshooting in th
190
191
### Top Queries
192
193
-Top SQL queries from performance_schema.
193
+Retrieves aggregated SQL query performance metrics from MySQL [performance_schema.events_statements_summary_by_digest](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-statement-summary-tables.html) table.
194
195
-Reads performance_schema statement digest tables and returns the top entries sorted by the selected column.
195
+This function queries the `events_statements_summary_by_digest` table which contains aggregated statistics for SQL statements grouped by their digest (normalized query pattern). The function dynamically detects available columns based on your MySQL/MariaDB version.
196
+
197
+Use cases:
198
+- Identify slow queries that consume the most execution time
199
+- Find frequently executed queries that may benefit from optimization
200
+- Detect queries with high lock time, errors, or table scans
201
+
202
+Query text is truncated at 4096 characters for display purposes.
203
204
205
| Aspect | Description |
206
|:-------|:------------|
207
| Name | `Mysql:top-queries` |
201
-| Performance | Requires performance_schema and can be expensive on busy servers. |
202
-| Security | Query text may contain unmasked literals (potential PII). |
203
-| Availability | Available when performance_schema tables are accessible and the collector is initialized. |
208
+| Require Cloud | yes |
209
+| Performance | Queries the `events_statements_summary_by_digest` table:<br/>• On busy servers with high query throughput, the digest table can grow large<br/>• Default limit of 500 rows balances usefulness with performance |
210
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
211
+| Availability | Available when:<br/>• The collector has successfully connected to MySQL<br/>• Performance Schema is enabled with statement digest collection<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
212
213
#### Prerequisites
214
207
-##### Enable performance_schema digest tables
215
+##### Enable performance_schema statement digest collection
216
+
217
+Performance Schema must be enabled and statement instrumentation must be configured to collect digest statistics.
218
+
219
+1. Check if Performance Schema is enabled:
220
+ ```sql
221
+ SELECT @@performance_schema;
222
+ ```
223
+
224
+2. Check statement instrumentation configuration:
225
+ ```sql
226
+ SELECT * FROM performance_schema.setup_consumers
227
+ WHERE NAME LIKE '%statement%';
228
+ ```
229
+
230
+3. The following consumers should be enabled:
231
+ - `events_statements_current`
232
+ - `events_statements_summary_by_digest`
233
+
234
+4. Enable statement consumers if needed:
235
+ ```sql
236
+ UPDATE performance_schema.setup_consumers
237
+ SET ENABLED = 'YES'
238
+ WHERE NAME LIKE 'events_statements%';
239
+ ```
240
+
241
+ :::info
242
+
243
+ - Changes to `setup_consumers` take effect immediately without requiring a server restart.
244
+ - MariaDB also supports the `events_statements_summary_by_digest` table. Exact consumer names may vary by MariaDB version, so checking `setup_consumers` first as shown above is recommended.
245
+
246
+ :::
247
+
248
+5. Verify digest table contains data:
249
+ ```sql
250
+ SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
251
+ ```
252
+
253
+ Note: Statement digest data is accumulated since server startup or since the table was last truncated. To reset statistics:
254
+ ```sql
255
+ TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
256
+ ```
257
+
258
+ Ensure that statement instruments are enabled in the Performance Schema so that statement digest statistics are collected. Refer to your MySQL or MariaDB version documentation for the appropriate configuration options.
259
+
260
+
261
+##### Grant SELECT permission on Performance Schema tables
262
+
263
+The netdata user must have SELECT permission on Performance Schema tables. The standard collector permissions
264
+(USAGE, REPLICATION CLIENT, PROCESS) do not automatically include Performance Schema access.
265
+
266
+1. Grant the required permission:
267
+ ```sql
268
+ GRANT SELECT ON performance_schema.* TO 'netdata'@'localhost';
269
+ FLUSH PRIVILEGES;
270
+ ```
271
+
272
+ :::info
273
+
274
+ The host part (`'localhost'`) should match how the netdata user connects. If connecting via TCP/IP, you may need `'netdata'@'%'` or a specific IP address instead.
275
+
276
+ :::
277
209
-Enable performance_schema and grant access to events_statements_summary_by_digest.
278
+2. Verify access:
279
+ ```sql
280
+ -- As the netdata user:
281
+ SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
282
+ ```
283
284
285
@@ -214,52 +287,52 @@ Enable performance_schema and grant access to events_statements_summary_by_diges
287
288
| Parameter | Type | Description | Required | Default | Options |
289
|:---------|:-----|:------------|:--------:|:--------|:--------|
217
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
290
+| Filter By | select | Select the primary sort column. The available options depend on your MySQL/MariaDB version and include metrics like total execution time, number of calls, lock time, errors, rows examined, and more. Defaults to total execution time. | yes | totalTime | |
291
292
#### Returns
293
221
-Aggregated statement statistics from performance_schema.
294
+Aggregated statement statistics from Performance Schema, grouped by query digest. Each row represents a unique query pattern with cumulative metrics across all executions.
295
296
| Column | Type | Unit | Visibility | Description |
297
|:-------|:-----|:-----|:-----------|:------------|
225
-| Digest | string | | hidden | |
226
-| Query | string | | | |
227
-| Schema | string | | | |
228
-| Calls | integer | | | |
229
-| Total Time | duration | milliseconds | | |
230
-| Min Time | duration | milliseconds | hidden | |
231
-| Avg Time | duration | milliseconds | | |
232
-| Max Time | duration | milliseconds | hidden | |
233
-| Lock Time | duration | milliseconds | | |
234
-| Errors | integer | | | |
235
-| Warnings | integer | | | |
236
-| Rows Affected | integer | | | |
237
-| Rows Sent | integer | | | |
238
-| Rows Examined | integer | | | |
239
-| Temp Disk Tables | integer | | | |
240
-| Temp Tables | integer | | | |
241
-| Full Joins | integer | | | |
242
-| Full Range Joins | integer | | hidden | |
243
-| Select Range | integer | | hidden | |
244
-| Select Range Check | integer | | hidden | |
245
-| Select Scan | integer | | | |
246
-| Sort Merge Passes | integer | | hidden | |
247
-| Sort Range | integer | | hidden | |
248
-| Sort Rows | integer | | | |
249
-| Sort Scan | integer | | hidden | |
250
-| No Index Used | integer | | | |
251
-| No Good Index Used | integer | | hidden | |
252
-| First Seen | string | | hidden | |
253
-| Last Seen | string | | hidden | |
254
-| P95 Time | duration | milliseconds | | |
255
-| P99 Time | duration | milliseconds | | |
256
-| P99.9 Time | duration | milliseconds | hidden | |
257
-| Sample Query | string | | hidden | |
258
-| Sample Seen | string | | hidden | |
259
-| Sample Time | duration | milliseconds | hidden | |
260
-| CPU Time | duration | milliseconds | | |
261
-| Max Controlled Memory | integer | | | |
262
-| Max Total Memory | integer | | | |
298
+| Digest | string | | hidden | Unique hash identifier for the normalized query pattern. Queries with the same structure (different literal values) share the same digest. |
299
+| Query | string | | | Normalized SQL query text with literals replaced by placeholders (e.g., '?' for values). Truncated to 4096 characters. |
300
+| Schema | string | | | Database schema name where the query was executed. Empty string for queries without a schema context. |
301
+| Calls | integer | | | Total number of times this query pattern has been executed since server startup or since the digest table was last truncated. |
302
+| Total Time | duration | milliseconds | | Cumulative execution time across all executions. High values indicate queries that consume significant server resources. |
303
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed for a single execution. Helps identify variability in query performance. |
304
+| Avg Time | duration | milliseconds | | Average execution time (total time divided by calls). Use this to compare performance across different query patterns. |
305
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed for a single execution. Large gaps between min and max may indicate performance instability. |
306
+| Lock Time | duration | milliseconds | | Total time spent waiting for table locks across all executions. High lock time may indicate contention from concurrent transactions. |
307
+| Errors | integer | | | Total number of times this query pattern resulted in an error. Non-zero values require investigation into the underlying issue. |
308
+| Warnings | integer | | | Total number of times this query pattern generated warnings. Warnings may indicate data type conversions, NULL handling issues, or other non-critical problems. |
309
+| Rows Affected | integer | | | Total number of rows modified by INSERT, UPDATE, DELETE, or REPLACE statements. Useful for tracking write workloads. |
310
+| Rows Sent | integer | | | Total number of rows returned to the client by SELECT statements. High values may indicate result sets that are too large. |
311
+| Rows Examined | integer | | | Total number of rows read during query execution. A high ratio of rows examined to rows sent suggests missing or inefficient indexes. |
312
+| Temp Disk Tables | integer | | | Total number of temporary tables created on disk across all executions. Disk-based temporary tables are significantly slower than in-memory tables and may indicate memory pressure or complex operations requiring sorting/grouping. |
313
+| Temp Tables | integer | | | Total number of temporary tables created (both in-memory and on-disk). High values suggest frequent sorting, grouping, or DISTINCT operations. |
314
+| Full Joins | integer | | | Total number of joins that performed a full table scan without using an index. These are typically very expensive operations that should be optimized. |
315
+| Full Range Joins | integer | | hidden | Total number of joins that used a range scan on the first table. Less efficient than indexed joins but better than full scans. |
316
+| Select Range | integer | | hidden | Total number of joins that used a range on the first table for row selection. |
317
+| Select Range Check | integer | | hidden | Total number of joins that checked each row after scanning for key ranges. Very inefficient operation. |
318
+| Select Scan | integer | | | Total number of joins that performed a full scan of the first table. Indicates missing indexes or suboptimal join order. |
319
+| Sort Merge Passes | integer | | hidden | Total number of merge passes performed during sort operations. More passes indicate larger datasets that exceed sort buffer size. |
320
+| Sort Range | integer | | hidden | Total number of sorts that used a range scan. |
321
+| Sort Rows | integer | | | Total number of rows sorted across all executions. High values indicate frequent sorting operations on large datasets. |
322
+| Sort Scan | integer | | hidden | Total number of sorts that required a full table scan. |
323
+| No Index Used | integer | | | Total number of executions where no index was used for table access. These queries are prime candidates for index optimization. |
324
+| No Good Index Used | integer | | hidden | Total number of executions where a non-optimal index was used. Indicates that while an index exists, a better one might improve performance. |
325
+| First Seen | string | | hidden | Timestamp when this query pattern was first observed. Helps identify new queries that may have been introduced by application changes. |
326
+| Last Seen | string | | hidden | Timestamp when this query pattern was last executed. Can help identify stale queries that are no longer in use. |
327
+| P95 Time | duration | milliseconds | | 95th percentile execution time. 95% of executions completed within this time. Available in MySQL 8.0+. Useful for understanding typical performance. |
328
+| P99 Time | duration | milliseconds | | 99th percentile execution time. 99% of executions completed within this time. Available in MySQL 8.0+. Helps identify outlier slow executions. |
329
+| P99.9 Time | duration | milliseconds | hidden | 99.9th percentile execution time. Available in MySQL 8.0+. Identifies extreme outliers in query performance. |
330
+| Sample Query | string | | hidden | Example of an actual query execution with literal values preserved. Available in MySQL 8.0+. Helpful for understanding the exact queries being executed. |
331
+| Sample Seen | string | | hidden | Timestamp when the sample query was captured. Available in MySQL 8.0+. |
332
+| Sample Time | duration | milliseconds | hidden | Execution time of the captured sample query. Available in MySQL 8.0+. |
333
+| CPU Time | duration | milliseconds | | Total CPU time consumed across all executions. Available in MySQL 8.0.28+. Helps identify CPU-intensive queries. |
334
+| Max Controlled Memory | integer | | | Maximum memory controlled by the query executor for this query pattern. Available in MySQL 8.0.31+. Helps identify memory-intensive operations. |
335
+| Max Total Memory | integer | | | Maximum total memory used by this query pattern including both controlled and uncontrolled allocations. Available in MySQL 8.0.31+. |
336
337
338
src/go/plugin/go.d/collector/mysql/integrations/percona_mysql.md
+120
-47
@@ -190,23 +190,96 @@ This collector exposes real-time functions for interactive troubleshooting in th
190
191
### Top Queries
192
193
-Top SQL queries from performance_schema.
193
+Retrieves aggregated SQL query performance metrics from MySQL [performance_schema.events_statements_summary_by_digest](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-statement-summary-tables.html) table.
194
195
-Reads performance_schema statement digest tables and returns the top entries sorted by the selected column.
195
+This function queries the `events_statements_summary_by_digest` table which contains aggregated statistics for SQL statements grouped by their digest (normalized query pattern). The function dynamically detects available columns based on your MySQL/MariaDB version.
196
+
197
+Use cases:
198
+- Identify slow queries that consume the most execution time
199
+- Find frequently executed queries that may benefit from optimization
200
+- Detect queries with high lock time, errors, or table scans
201
+
202
+Query text is truncated at 4096 characters for display purposes.
203
204
205
| Aspect | Description |
206
|:-------|:------------|
207
| Name | `Mysql:top-queries` |
201
-| Performance | Requires performance_schema and can be expensive on busy servers. |
202
-| Security | Query text may contain unmasked literals (potential PII). |
203
-| Availability | Available when performance_schema tables are accessible and the collector is initialized. |
208
+| Require Cloud | yes |
209
+| Performance | Queries the `events_statements_summary_by_digest` table:<br/>• On busy servers with high query throughput, the digest table can grow large<br/>• Default limit of 500 rows balances usefulness with performance |
210
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
211
+| Availability | Available when:<br/>• The collector has successfully connected to MySQL<br/>• Performance Schema is enabled with statement digest collection<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
212
213
#### Prerequisites
214
207
-##### Enable performance_schema digest tables
215
+##### Enable performance_schema statement digest collection
216
+
217
+Performance Schema must be enabled and statement instrumentation must be configured to collect digest statistics.
218
+
219
+1. Check if Performance Schema is enabled:
220
+ ```sql
221
+ SELECT @@performance_schema;
222
+ ```
223
+
224
+2. Check statement instrumentation configuration:
225
+ ```sql
226
+ SELECT * FROM performance_schema.setup_consumers
227
+ WHERE NAME LIKE '%statement%';
228
+ ```
229
+
230
+3. The following consumers should be enabled:
231
+ - `events_statements_current`
232
+ - `events_statements_summary_by_digest`
233
+
234
+4. Enable statement consumers if needed:
235
+ ```sql
236
+ UPDATE performance_schema.setup_consumers
237
+ SET ENABLED = 'YES'
238
+ WHERE NAME LIKE 'events_statements%';
239
+ ```
240
+
241
+ :::info
242
+
243
+ - Changes to `setup_consumers` take effect immediately without requiring a server restart.
244
+ - MariaDB also supports the `events_statements_summary_by_digest` table. Exact consumer names may vary by MariaDB version, so checking `setup_consumers` first as shown above is recommended.
245
+
246
+ :::
247
+
248
+5. Verify digest table contains data:
249
+ ```sql
250
+ SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
251
+ ```
252
+
253
+ Note: Statement digest data is accumulated since server startup or since the table was last truncated. To reset statistics:
254
+ ```sql
255
+ TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
256
+ ```
257
+
258
+ Ensure that statement instruments are enabled in the Performance Schema so that statement digest statistics are collected. Refer to your MySQL or MariaDB version documentation for the appropriate configuration options.
259
+
260
+
261
+##### Grant SELECT permission on Performance Schema tables
262
+
263
+The netdata user must have SELECT permission on Performance Schema tables. The standard collector permissions
264
+(USAGE, REPLICATION CLIENT, PROCESS) do not automatically include Performance Schema access.
265
+
266
+1. Grant the required permission:
267
+ ```sql
268
+ GRANT SELECT ON performance_schema.* TO 'netdata'@'localhost';
269
+ FLUSH PRIVILEGES;
270
+ ```
271
+
272
+ :::info
273
+
274
+ The host part (`'localhost'`) should match how the netdata user connects. If connecting via TCP/IP, you may need `'netdata'@'%'` or a specific IP address instead.
275
+
276
+ :::
277
209
-Enable performance_schema and grant access to events_statements_summary_by_digest.
278
+2. Verify access:
279
+ ```sql
280
+ -- As the netdata user:
281
+ SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
282
+ ```
283
284
285
@@ -214,52 +287,52 @@ Enable performance_schema and grant access to events_statements_summary_by_diges
287
288
| Parameter | Type | Description | Required | Default | Options |
289
|:---------|:-----|:------------|:--------:|:--------|:--------|
217
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
290
+| Filter By | select | Select the primary sort column. The available options depend on your MySQL/MariaDB version and include metrics like total execution time, number of calls, lock time, errors, rows examined, and more. Defaults to total execution time. | yes | totalTime | |
291
292
#### Returns
293
221
-Aggregated statement statistics from performance_schema.
294
+Aggregated statement statistics from Performance Schema, grouped by query digest. Each row represents a unique query pattern with cumulative metrics across all executions.
295
296
| Column | Type | Unit | Visibility | Description |
297
|:-------|:-----|:-----|:-----------|:------------|
225
-| Digest | string | | hidden | |
226
-| Query | string | | | |
227
-| Schema | string | | | |
228
-| Calls | integer | | | |
229
-| Total Time | duration | milliseconds | | |
230
-| Min Time | duration | milliseconds | hidden | |
231
-| Avg Time | duration | milliseconds | | |
232
-| Max Time | duration | milliseconds | hidden | |
233
-| Lock Time | duration | milliseconds | | |
234
-| Errors | integer | | | |
235
-| Warnings | integer | | | |
236
-| Rows Affected | integer | | | |
237
-| Rows Sent | integer | | | |
238
-| Rows Examined | integer | | | |
239
-| Temp Disk Tables | integer | | | |
240
-| Temp Tables | integer | | | |
241
-| Full Joins | integer | | | |
242
-| Full Range Joins | integer | | hidden | |
243
-| Select Range | integer | | hidden | |
244
-| Select Range Check | integer | | hidden | |
245
-| Select Scan | integer | | | |
246
-| Sort Merge Passes | integer | | hidden | |
247
-| Sort Range | integer | | hidden | |
248
-| Sort Rows | integer | | | |
249
-| Sort Scan | integer | | hidden | |
250
-| No Index Used | integer | | | |
251
-| No Good Index Used | integer | | hidden | |
252
-| First Seen | string | | hidden | |
253
-| Last Seen | string | | hidden | |
254
-| P95 Time | duration | milliseconds | | |
255
-| P99 Time | duration | milliseconds | | |
256
-| P99.9 Time | duration | milliseconds | hidden | |
257
-| Sample Query | string | | hidden | |
258
-| Sample Seen | string | | hidden | |
259
-| Sample Time | duration | milliseconds | hidden | |
260
-| CPU Time | duration | milliseconds | | |
261
-| Max Controlled Memory | integer | | | |
262
-| Max Total Memory | integer | | | |
298
+| Digest | string | | hidden | Unique hash identifier for the normalized query pattern. Queries with the same structure (different literal values) share the same digest. |
299
+| Query | string | | | Normalized SQL query text with literals replaced by placeholders (e.g., '?' for values). Truncated to 4096 characters. |
300
+| Schema | string | | | Database schema name where the query was executed. Empty string for queries without a schema context. |
301
+| Calls | integer | | | Total number of times this query pattern has been executed since server startup or since the digest table was last truncated. |
302
+| Total Time | duration | milliseconds | | Cumulative execution time across all executions. High values indicate queries that consume significant server resources. |
303
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed for a single execution. Helps identify variability in query performance. |
304
+| Avg Time | duration | milliseconds | | Average execution time (total time divided by calls). Use this to compare performance across different query patterns. |
305
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed for a single execution. Large gaps between min and max may indicate performance instability. |
306
+| Lock Time | duration | milliseconds | | Total time spent waiting for table locks across all executions. High lock time may indicate contention from concurrent transactions. |
307
+| Errors | integer | | | Total number of times this query pattern resulted in an error. Non-zero values require investigation into the underlying issue. |
308
+| Warnings | integer | | | Total number of times this query pattern generated warnings. Warnings may indicate data type conversions, NULL handling issues, or other non-critical problems. |
309
+| Rows Affected | integer | | | Total number of rows modified by INSERT, UPDATE, DELETE, or REPLACE statements. Useful for tracking write workloads. |
310
+| Rows Sent | integer | | | Total number of rows returned to the client by SELECT statements. High values may indicate result sets that are too large. |
311
+| Rows Examined | integer | | | Total number of rows read during query execution. A high ratio of rows examined to rows sent suggests missing or inefficient indexes. |
312
+| Temp Disk Tables | integer | | | Total number of temporary tables created on disk across all executions. Disk-based temporary tables are significantly slower than in-memory tables and may indicate memory pressure or complex operations requiring sorting/grouping. |
313
+| Temp Tables | integer | | | Total number of temporary tables created (both in-memory and on-disk). High values suggest frequent sorting, grouping, or DISTINCT operations. |
314
+| Full Joins | integer | | | Total number of joins that performed a full table scan without using an index. These are typically very expensive operations that should be optimized. |
315
+| Full Range Joins | integer | | hidden | Total number of joins that used a range scan on the first table. Less efficient than indexed joins but better than full scans. |
316
+| Select Range | integer | | hidden | Total number of joins that used a range on the first table for row selection. |
317
+| Select Range Check | integer | | hidden | Total number of joins that checked each row after scanning for key ranges. Very inefficient operation. |
318
+| Select Scan | integer | | | Total number of joins that performed a full scan of the first table. Indicates missing indexes or suboptimal join order. |
319
+| Sort Merge Passes | integer | | hidden | Total number of merge passes performed during sort operations. More passes indicate larger datasets that exceed sort buffer size. |
320
+| Sort Range | integer | | hidden | Total number of sorts that used a range scan. |
321
+| Sort Rows | integer | | | Total number of rows sorted across all executions. High values indicate frequent sorting operations on large datasets. |
322
+| Sort Scan | integer | | hidden | Total number of sorts that required a full table scan. |
323
+| No Index Used | integer | | | Total number of executions where no index was used for table access. These queries are prime candidates for index optimization. |
324
+| No Good Index Used | integer | | hidden | Total number of executions where a non-optimal index was used. Indicates that while an index exists, a better one might improve performance. |
325
+| First Seen | string | | hidden | Timestamp when this query pattern was first observed. Helps identify new queries that may have been introduced by application changes. |
326
+| Last Seen | string | | hidden | Timestamp when this query pattern was last executed. Can help identify stale queries that are no longer in use. |
327
+| P95 Time | duration | milliseconds | | 95th percentile execution time. 95% of executions completed within this time. Available in MySQL 8.0+. Useful for understanding typical performance. |
328
+| P99 Time | duration | milliseconds | | 99th percentile execution time. 99% of executions completed within this time. Available in MySQL 8.0+. Helps identify outlier slow executions. |
329
+| P99.9 Time | duration | milliseconds | hidden | 99.9th percentile execution time. Available in MySQL 8.0+. Identifies extreme outliers in query performance. |
330
+| Sample Query | string | | hidden | Example of an actual query execution with literal values preserved. Available in MySQL 8.0+. Helpful for understanding the exact queries being executed. |
331
+| Sample Seen | string | | hidden | Timestamp when the sample query was captured. Available in MySQL 8.0+. |
332
+| Sample Time | duration | milliseconds | hidden | Execution time of the captured sample query. Available in MySQL 8.0+. |
333
+| CPU Time | duration | milliseconds | | Total CPU time consumed across all executions. Available in MySQL 8.0.28+. Helps identify CPU-intensive queries. |
334
+| Max Controlled Memory | integer | | | Maximum memory controlled by the query executor for this query pattern. Available in MySQL 8.0.31+. Helps identify memory-intensive operations. |
335
+| Max Total Memory | integer | | | Maximum total memory used by this query pattern including both controlled and uncontrolled allocations. Available in MySQL 8.0.31+. |
336
337
338
src/go/plugin/go.d/collector/oracledb/integrations/oracle_db.md
+107
-42
@@ -143,23 +143,55 @@ This collector exposes real-time functions for interactive troubleshooting in th
143
144
### Top Queries
145
146
-Top SQL statements from V$SQLSTATS. WARNING: Query text may contain unmasked literals (potential PII).
146
+Retrieves aggregated SQL statement performance metrics from Oracle [V$SQLSTATS](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/V-SQLSTATS.html) view.
147
148
-Queries V$SQLSTATS and returns the top entries sorted by the selected column.
148
+This function queries `V$SQLSTATS` which provides SQL execution statistics aggregated across all cursors for each SQL statement. Statistics include execution counts, timing metrics, I/O operations, and resource consumption.
149
+
150
+Use cases:
151
+- Identify slow queries consuming the most total execution time
152
+- Find queries with high buffer gets or disk reads for I/O optimization
153
+- Analyze CPU-intensive queries for resource tuning
154
+
155
+Query text is truncated at 4096 characters for display purposes.
156
157
158
| Aspect | Description |
159
|:-------|:------------|
160
| Name | `Oracledb:top-queries` |
154
-| Performance | Queries system views and may be expensive on busy databases. |
155
-| Security | Query text may contain unmasked literals (potential PII). |
156
-| Availability | Available when the collector can query Oracle system views; returns errors if SQL is unavailable. |
161
+| Require Cloud | yes |
162
+| Performance | Queries `V$SQLSTATS` which is a lightweight view optimized for statistics retrieval:<br/>• On busy databases with many SQL statements, the query may take longer<br/>• Default limit of 500 rows balances usefulness with performance |
163
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
164
+| Availability | Available when:<br/>• The collector has successfully connected to Oracle DB<br/>• The user has SELECT privilege on `V$SQLSTATS`<br/>• Returns HTTP 503 if the connection cannot be established<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
165
166
#### Prerequisites
167
168
##### Grant access to V$SQLSTATS
169
162
-Use a SQL user with access to V$SQLSTATS and a working SQL connection.
170
+The monitoring user must have SELECT privilege on `V$SQLSTATS` and related views.
171
+
172
+1. Grant the required privileges:
173
+
174
+ ```sql
175
+ -- Note: Use V_$ (with underscore) for GRANT - this is the base fixed view
176
+ -- Queries use the V$ public synonym
177
+ GRANT SELECT ON V_$SQLSTATS TO netdata;
178
+ -- Or grant the broader role:
179
+ GRANT SELECT_CATALOG_ROLE TO netdata;
180
+ ```
181
+
182
+2. Verify access:
183
+
184
+ ```sql
185
+ SELECT COUNT(*) FROM V$SQLSTATS WHERE ROWNUM <= 1;
186
+ ```
187
+
188
+:::info
189
+
190
+- `V$SQLSTATS` is available in Oracle 10g and later
191
+- The view aggregates statistics across all child cursors for each SQL statement
192
+- Some columns like `MODULE` and `ACTION` require applications to set them via `DBMS_APPLICATION_INFO`
193
+
194
+:::
195
196
197
@@ -167,48 +199,81 @@ Use a SQL user with access to V$SQLSTATS and a working SQL connection.
199
200
| Parameter | Type | Description | Required | Default | Options |
201
|:---------|:-----|:------------|:--------:|:--------|:--------|
170
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
202
+| Filter By | select | Select the primary sort column. Options include total time, CPU time, executions, buffer gets, disk reads, and more. Defaults to total time to focus on most resource-intensive queries. | yes | totalTime | |
203
204
#### Returns
205
174
-Aggregated SQL statistics from V$SQLSTATS.
206
+Aggregated SQL statistics from `V$SQLSTATS`. Each row represents a unique SQL statement with cumulative metrics across all executions.
207
208
| Column | Type | Unit | Visibility | Description |
209
|:-------|:-----|:-----|:-----------|:------------|
178
-| SQL ID | string | | hidden | |
179
-| Query | string | | | |
180
-| Schema | string | | | |
181
-| Executions | integer | | | |
182
-| Total Time | duration | milliseconds | | |
183
-| Avg Time | duration | milliseconds | | |
184
-| CPU Time | duration | milliseconds | | |
185
-| Buffer Gets | integer | | | |
186
-| Disk Reads | integer | | | |
187
-| Rows Processed | integer | | | |
188
-| Parse Calls | integer | | hidden | |
189
-| Module | string | | hidden | |
190
-| Action | string | | hidden | |
191
-| Last Active | string | | hidden | |
210
+| SQL ID | string | | hidden | Unique identifier for the SQL statement in the shared pool. Can be used to find execution plans in `V$SQL_PLAN`. |
211
+| Query | string | | | SQL statement text. Truncated to 4096 characters for display purposes. |
212
+| Schema | string | | | Schema under which the SQL was parsed. Useful for identifying which application or user generated the query. |
213
+| Executions | integer | | | Total number of times this SQL statement has been executed. High values indicate frequently run queries. |
214
+| Total Time | duration | milliseconds | | Cumulative elapsed time across all executions. High values indicate queries consuming significant database resources. |
215
+| Avg Time | duration | milliseconds | | Average elapsed time per execution. Use this to compare typical performance across different SQL statements. |
216
+| CPU Time | duration | milliseconds | | Cumulative CPU time consumed across all executions. Compare with total time to identify I/O-bound vs CPU-bound queries. |
217
+| Buffer Gets | integer | | | Total number of logical reads from the buffer cache. High values relative to rows processed may indicate inefficient queries. |
218
+| Disk Reads | integer | | | Total number of physical reads from disk. High values indicate queries that cannot be satisfied from the buffer cache. |
219
+| Rows Processed | integer | | | Total number of rows processed across all executions. Compare with buffer gets to assess query efficiency. |
220
+| Parse Calls | integer | | hidden | Number of times the SQL was parsed (hard + soft parses). High values may indicate lack of bind variables. |
221
+| Module | string | | hidden | Application module name set via `DBMS_APPLICATION_INFO`. Useful for identifying which application component generated the query. |
222
+| Action | string | | hidden | Application action name set via `DBMS_APPLICATION_INFO`. Provides finer-grained identification within a module. |
223
+| Last Active | string | | hidden | Timestamp when this SQL statement was last executed. Helps identify recently active vs historical queries. |
224
225
### Running Queries
226
195
-Currently running SQL statements from V$SESSION. WARNING: Query text may contain unmasked literals (potential PII).
227
+Retrieves currently executing SQL statements from Oracle [V$SESSION](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/V-SESSION.html) view.
228
197
-Queries V$SESSION and returns running statements sorted by the selected column.
229
+This function queries `V$SESSION` joined with `V$SQL` to provide a real-time snapshot of all active user sessions currently executing SQL statements. It shows session details, elapsed time, and the SQL being executed.
230
+
231
+Use cases:
232
+- Identify long-running queries that may be blocking other sessions
233
+- Monitor active workload and session distribution
234
+- Debug stuck or slow queries in real-time
235
+
236
+Query text is truncated at 4096 characters for display purposes.
237
238
239
| Aspect | Description |
240
|:-------|:------------|
241
| Name | `Oracledb:running-queries` |
203
-| Performance | Queries system views and may be expensive on busy databases. |
204
-| Security | Query text may contain unmasked literals (potential PII). |
205
-| Availability | Available when the collector can query Oracle system views; returns errors if SQL is unavailable. |
242
+| Require Cloud | yes |
243
+| Performance | Queries `V$SESSION` joined with `V$SQL` for currently active sessions:<br/>• Lightweight operation as it only returns currently active user sessions<br/>• Default limit of 500 rows (rarely reached for running queries) |
244
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and credentials in query parameters<br/>• Access should be restricted to authorized personnel only |
245
+| Availability | Available when:<br/>• The collector has successfully connected to Oracle DB<br/>• The user has SELECT privilege on `V$SESSION` and `V$SQL`<br/>• Returns HTTP 503 if the connection cannot be established<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
246
247
#### Prerequisites
248
249
##### Grant access to V$SESSION
250
211
-Use a SQL user with access to V$SESSION and a working SQL connection.
251
+The monitoring user must have SELECT privilege on `V$SESSION` and `V$SQL`.
252
+
253
+1. Grant the required privileges:
254
+
255
+ ```sql
256
+ -- Note: Use V_$ (with underscore) for GRANT - this is the base fixed view
257
+ -- Queries use the V$ public synonym
258
+ GRANT SELECT ON V_$SESSION TO netdata;
259
+ GRANT SELECT ON V_$SQL TO netdata;
260
+ -- Or grant the broader role:
261
+ GRANT SELECT_CATALOG_ROLE TO netdata;
262
+ ```
263
+
264
+2. Verify access:
265
+
266
+ ```sql
267
+ SELECT COUNT(*) FROM V$SESSION WHERE ROWNUM <= 1;
268
+ ```
269
+
270
+:::info
271
+
272
+- Only USER sessions with ACTIVE status and a current SQL ID are returned
273
+- The elapsed time is based on `LAST_CALL_ET` which resets when a new SQL starts
274
+- BACKGROUND sessions (Oracle internal processes) are filtered out
275
+
276
+:::
277
278
279
@@ -216,26 +281,26 @@ Use a SQL user with access to V$SESSION and a working SQL connection.
281
282
| Parameter | Type | Description | Required | Default | Options |
283
|:---------|:-----|:------------|:--------:|:--------|:--------|
219
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | lastCallMs | |
284
+| Filter By | select | Select the primary sort column. Defaults to elapsed time to show longest-running queries first. | yes | lastCallMs | |
285
286
#### Returns
287
223
-Snapshot of currently running SQL sessions.
288
+Real-time snapshot of currently executing SQL statements. Each row represents an active user session with its current SQL.
289
290
| Column | Type | Unit | Visibility | Description |
291
|:-------|:-----|:-----|:-----------|:------------|
227
-| Session | string | | | |
228
-| User | string | | | |
229
-| Status | string | | | |
230
-| Type | string | | hidden | |
231
-| SQL ID | string | | hidden | |
232
-| Query | string | | | |
233
-| Elapsed | duration | milliseconds | | |
234
-| SQL Exec Start | string | | hidden | |
235
-| Module | string | | hidden | |
236
-| Action | string | | hidden | |
237
-| Program | string | | hidden | |
238
-| Machine | string | | hidden | |
292
+| Session | string | | | Session identifier in format `SID,SERIAL#`. Can be used with `ALTER SYSTEM KILL SESSION` if needed. |
293
+| User | string | | | Oracle username of the session. Useful for identifying workload by user. |
294
+| Status | string | | | Session status (ACTIVE for currently executing). Only active sessions with SQL are shown. |
295
+| Type | string | | hidden | Session type (USER or BACKGROUND). This function filters to USER sessions only. |
296
+| SQL ID | string | | hidden | Identifier of the currently executing SQL. Can be used to find the statement in `V$SQL`. |
297
+| Query | string | | | SQL statement text currently being executed. Truncated to 4096 characters. |
298
+| Elapsed | duration | milliseconds | | Time elapsed since the session's last call started. High values indicate long-running operations that may need investigation. |
299
+| SQL Exec Start | string | | hidden | Timestamp when the current SQL execution started. |
300
+| Module | string | | hidden | Application module name set via `DBMS_APPLICATION_INFO`. Identifies which application is running the query. |
301
+| Action | string | | hidden | Application action name set via `DBMS_APPLICATION_INFO`. |
302
+| Program | string | | hidden | Client program name that established the session (e.g., sqlplus, JDBC Thin Client). |
303
+| Machine | string | | hidden | Client machine name or IP address. Useful for identifying query sources. |
304
305
306
src/go/plugin/go.d/collector/postgres/integrations/postgresql.md
+85
-50
@@ -234,23 +234,58 @@ This collector exposes real-time functions for interactive troubleshooting in th
234
235
### Top Queries
236
237
-Top SQL queries from pg_stat_statements.
237
+Retrieves aggregated SQL query performance metrics from PostgreSQL [pg_stat_statements](https://www.postgresql.org/docs/current/pgstatstatements.html) extension.
238
239
-Reads pg_stat_statements and returns the top entries sorted by the selected column.
239
+This function queries `pg_stat_statements` which tracks execution statistics for all SQL statements. Statistics include execution counts, timing metrics, I/O operations, and resource consumption. Columns are dynamically detected based on your PostgreSQL version.
240
+
241
+Use cases:
242
+- Identify slow queries consuming the most total execution time
243
+- Find queries with high shared block reads for I/O optimization
244
+- Analyze temp block usage to detect queries needing memory tuning
245
+
246
+Query text is truncated at 4096 characters for display purposes.
247
248
249
| Aspect | Description |
250
|:-------|:------------|
251
| Name | `Postgres:top-queries` |
245
-| Performance | Requires pg_stat_statements and can be expensive on busy servers. |
246
-| Security | Query text may contain unmasked literals (potential PII). |
247
-| Availability | Available when pg_stat_statements is available and the collector is initialized. |
252
+| Require Cloud | yes |
253
+| Performance | Queries `pg_stat_statements` which maintains statistics in shared memory:<br/>• On busy servers with many unique queries, the extension may consume significant memory<br/>• Default limit of 500 rows balances usefulness with performance |
254
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only |
255
+| Availability | Available when:<br/>• The `pg_stat_statements` extension is installed in the database<br/>• The collector has successfully connected to PostgreSQL<br/>• Returns HTTP 503 if extension is not installed (with instructions to install)<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
256
257
#### Prerequisites
258
259
##### Enable pg_stat_statements
260
253
-Install and enable the pg_stat_statements extension.
261
+The `pg_stat_statements` extension must be installed and configured.
262
+
263
+1. Add to `postgresql.conf`:
264
+
265
+ ```ini
266
+ shared_preload_libraries = 'pg_stat_statements'
267
+ ```
268
+
269
+2. Restart PostgreSQL, then create the extension:
270
+
271
+ ```sql
272
+ CREATE EXTENSION pg_stat_statements;
273
+ ```
274
+
275
+3. Verify the extension is working:
276
+
277
+ ```sql
278
+ SELECT COUNT(*) FROM pg_stat_statements;
279
+ ```
280
+
281
+:::info
282
+
283
+- `pg_stat_statements` requires a server restart to load the shared library
284
+- Statistics can be reset with `SELECT pg_stat_statements_reset()`
285
+- The `pg_stat_statements.max` parameter controls maximum tracked statements (default 5000)
286
+- Enable `track_io_timing` for block read/write timing metrics (may add slight overhead)
287
+
288
+:::
289
290
291
@@ -258,56 +293,56 @@ Install and enable the pg_stat_statements extension.
293
294
| Parameter | Type | Description | Required | Default | Options |
295
|:---------|:-----|:------------|:--------:|:--------|:--------|
261
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
296
+| Filter By | select | Select the primary sort column. Options include total time, mean time, calls, rows, shared blocks hit/read, and temp blocks written. Defaults to total time to focus on most resource-intensive queries. | yes | totalTime | |
297
298
#### Returns
299
265
-Aggregated query statistics from pg_stat_statements.
300
+Aggregated query statistics from `pg_stat_statements`. Each row represents a unique query pattern with cumulative metrics across all executions.
301
302
| Column | Type | Unit | Visibility | Description |
303
|:-------|:-----|:-----|:-----------|:------------|
269
-| Query ID | string | | hidden | |
270
-| Query | string | | | |
271
-| Database | string | | | |
272
-| User | string | | | |
273
-| Calls | integer | | | |
274
-| Total Time | duration | milliseconds | | |
275
-| Mean Time | duration | milliseconds | | |
276
-| Min Time | duration | milliseconds | hidden | |
277
-| Max Time | duration | milliseconds | hidden | |
278
-| Stddev Time | duration | milliseconds | hidden | |
279
-| Plans | integer | | hidden | |
280
-| Total Plan Time | duration | milliseconds | hidden | |
281
-| Mean Plan Time | duration | milliseconds | hidden | |
282
-| Min Plan Time | duration | milliseconds | hidden | |
283
-| Max Plan Time | duration | milliseconds | hidden | |
284
-| Stddev Plan Time | duration | milliseconds | hidden | |
285
-| Rows | integer | | | |
286
-| Shared Blocks Hit | integer | | | |
287
-| Shared Blocks Read | integer | | | |
288
-| Shared Blocks Dirtied | integer | | hidden | |
289
-| Shared Blocks Written | integer | | hidden | |
290
-| Local Blocks Hit | integer | | hidden | |
291
-| Local Blocks Read | integer | | hidden | |
292
-| Local Blocks Dirtied | integer | | hidden | |
293
-| Local Blocks Written | integer | | hidden | |
294
-| Temp Blocks Read | integer | | | |
295
-| Temp Blocks Written | integer | | | |
296
-| Block Read Time | duration | milliseconds | | |
297
-| Block Write Time | duration | milliseconds | | |
298
-| WAL Records | integer | | hidden | |
299
-| WAL Full Page Images | integer | | hidden | |
300
-| WAL Bytes | integer | | hidden | |
301
-| JIT Functions | integer | | hidden | |
302
-| JIT Generation Time | duration | milliseconds | hidden | |
303
-| JIT Inlining Count | integer | | hidden | |
304
-| JIT Inlining Time | duration | milliseconds | hidden | |
305
-| JIT Optimization Count | integer | | hidden | |
306
-| JIT Optimization Time | duration | milliseconds | hidden | |
307
-| JIT Emission Count | integer | | hidden | |
308
-| JIT Emission Time | duration | milliseconds | hidden | |
309
-| Temp Block Read Time | duration | milliseconds | hidden | |
310
-| Temp Block Write Time | duration | milliseconds | hidden | |
304
+| Query ID | string | | hidden | Internal hash identifier for the normalized query. Can be used to track queries across statistics resets. |
305
+| Query | string | | | Normalized SQL query text with literals replaced by parameter placeholders. Truncated to 4096 characters. |
306
+| Database | string | | | Database name where the query was executed. |
307
+| User | string | | | PostgreSQL user who executed the query. |
308
+| Calls | integer | | | Total number of times this query pattern has been executed. High values indicate frequently run queries. |
309
+| Total Time | duration | milliseconds | | Cumulative execution time across all executions. High values indicate queries consuming significant database resources. |
310
+| Mean Time | duration | milliseconds | | Average execution time per call. Use this to compare typical performance across different query patterns. |
311
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed for a single execution. |
312
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed for a single execution. Large gaps between min and max may indicate performance variability. |
313
+| Stddev Time | duration | milliseconds | hidden | Standard deviation of execution time. High values indicate inconsistent query performance. |
314
+| Plans | integer | | hidden | Number of times the query was planned. Available in PostgreSQL 13+. |
315
+| Total Plan Time | duration | milliseconds | hidden | Cumulative time spent planning the query. Available in PostgreSQL 13+. |
316
+| Mean Plan Time | duration | milliseconds | hidden | Average time spent planning per execution. Available in PostgreSQL 13+. |
317
+| Min Plan Time | duration | milliseconds | hidden | Minimum planning time observed. Available in PostgreSQL 13+. |
318
+| Max Plan Time | duration | milliseconds | hidden | Maximum planning time observed. Available in PostgreSQL 13+. |
319
+| Stddev Plan Time | duration | milliseconds | hidden | Standard deviation of planning time. Available in PostgreSQL 13+. |
320
+| Rows | integer | | | Total number of rows retrieved or affected across all executions. |
321
+| Shared Blocks Hit | integer | | | Total shared buffer cache hits. High values indicate good cache utilization. |
322
+| Shared Blocks Read | integer | | | Total shared blocks read from disk. High values indicate queries that bypass the cache and may benefit from more `shared_buffers`. |
323
+| Shared Blocks Dirtied | integer | | hidden | Total shared blocks dirtied by the query. |
324
+| Shared Blocks Written | integer | | hidden | Total shared blocks written by the query. |
325
+| Local Blocks Hit | integer | | hidden | Total local buffer cache hits (temporary tables). |
326
+| Local Blocks Read | integer | | hidden | Total local blocks read from disk. |
327
+| Local Blocks Dirtied | integer | | hidden | Total local blocks dirtied. |
328
+| Local Blocks Written | integer | | hidden | Total local blocks written. |
329
+| Temp Blocks Read | integer | | | Total temp blocks read. Non-zero values indicate queries spilling to disk due to insufficient `work_mem`. |
330
+| Temp Blocks Written | integer | | | Total temp blocks written. High values suggest increasing `work_mem` may improve performance. |
331
+| Block Read Time | duration | milliseconds | | Time spent reading blocks from disk. Requires `track_io_timing` to be enabled. |
332
+| Block Write Time | duration | milliseconds | | Time spent writing blocks to disk. Requires `track_io_timing` to be enabled. |
333
+| WAL Records | integer | | hidden | Total number of WAL records generated. Available in PostgreSQL 13+. |
334
+| WAL Full Page Images | integer | | hidden | Total number of WAL full page images generated. Available in PostgreSQL 13+. |
335
+| WAL Bytes | integer | | hidden | Total bytes of WAL generated. Available in PostgreSQL 13+. |
336
+| JIT Functions | integer | | hidden | Total number of functions JIT-compiled. Available in PostgreSQL 15+. |
337
+| JIT Generation Time | duration | milliseconds | hidden | Time spent generating JIT code. Available in PostgreSQL 15+. |
338
+| JIT Inlining Count | integer | | hidden | Number of times JIT inlining was performed. Available in PostgreSQL 15+. |
339
+| JIT Inlining Time | duration | milliseconds | hidden | Time spent on JIT inlining. Available in PostgreSQL 15+. |
340
+| JIT Optimization Count | integer | | hidden | Number of times JIT optimization was performed. Available in PostgreSQL 15+. |
341
+| JIT Optimization Time | duration | milliseconds | hidden | Time spent on JIT optimization. Available in PostgreSQL 15+. |
342
+| JIT Emission Count | integer | | hidden | Number of times JIT code was emitted. Available in PostgreSQL 15+. |
343
+| JIT Emission Time | duration | milliseconds | hidden | Time spent emitting JIT code. Available in PostgreSQL 15+. |
344
+| Temp Block Read Time | duration | milliseconds | hidden | Time spent reading temp blocks. Available in PostgreSQL 15+. Requires `track_io_timing`. |
345
+| Temp Block Write Time | duration | milliseconds | hidden | Time spent writing temp blocks. Available in PostgreSQL 15+. Requires `track_io_timing`. |
346
347
348
src/go/plugin/go.d/collector/proxysql/integrations/proxysql.md
+32
-28
@@ -176,54 +176,58 @@ This collector exposes real-time functions for interactive troubleshooting in th
176
177
### Top Queries
178
179
-Top SQL queries from ProxySQL query digest stats.
179
+Retrieves aggregated query statistics from ProxySQL's [stats_mysql_query_digest](https://proxysql.com/documentation/stats-statistics/#stats_mysql_query_digest) table.
180
181
-Queries stats_mysql_query_digest and returns the top entries sorted by the selected column.
181
+This function queries the `stats_mysql_query_digest` table which stores runtime statistics for all queries proxied through ProxySQL, aggregated by query digest (normalized query pattern). It provides timing metrics, execution counts, and error statistics for each unique query pattern.
182
+
183
+Use cases:
184
+- Identify slow queries consuming excessive total execution time
185
+- Find high-frequency queries that may benefit from caching
186
+- Monitor query error rates across backends
187
+
188
+Query text is truncated at 4096 characters for display purposes.
189
190
191
| Aspect | Description |
192
|:-------|:------------|
193
| Name | `Proxysql:top-queries` |
187
-| Performance | Uses ProxySQL stats tables and can be expensive on busy systems. |
188
-| Security | Query text may contain unmasked literals (potential PII). |
189
-| Availability | Available when the collector can query ProxySQL stats; returns errors if the SQL connection is unavailable. |
194
+| Require Cloud | yes |
195
+| Performance | Queries ProxySQL admin interface for digest statistics:<br/>• Reads from in-memory `stats_mysql_query_digest` table<br/>• Default limit of 500 rows balances completeness with performance<br/>• Data is aggregated in-memory by ProxySQL from active connections |
196
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data embedded in queries<br/>• Access should be restricted to authorized personnel only |
197
+| Availability | Available when:<br/>• The collector has successfully connected to ProxySQL admin interface<br/>• Returns HTTP 503 if the connection cannot be established<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
198
199
#### Prerequisites
200
193
-##### Grant access to stats_mysql_query_digest
194
-
195
-Ensure the ProxySQL user can read stats_mysql_query_digest.
196
-
197
-
201
+No additional configuration is required.
202
203
#### Parameters
204
205
| Parameter | Type | Description | Required | Default | Options |
206
|:---------|:-----|:------------|:--------:|:--------|:--------|
203
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
207
+| Filter By | select | Select the primary sort column. Options include total execution time, number of calls, rows affected, rows sent, errors, and warnings. Defaults to total time to focus on most resource-intensive queries. | yes | totalTime | |
208
209
#### Returns
210
207
-Query digest statistics from ProxySQL.
211
+Aggregated query digest statistics from ProxySQL, providing comprehensive performance analysis across all monitored MySQL backends. Each row represents a unique query pattern (normalized digest) with cumulative metrics across all its executions.
212
213
| Column | Type | Unit | Visibility | Description |
214
|:-------|:-----|:-----|:-----------|:------------|
211
-| Digest | string | | hidden | |
212
-| Query | string | | | |
213
-| Schema | string | | | |
214
-| User | string | | hidden | |
215
-| Hostgroup | integer | | hidden | |
216
-| Calls | integer | | | |
217
-| Total Time | duration | milliseconds | | |
218
-| Avg Time | duration | milliseconds | | |
219
-| Min Time | duration | milliseconds | hidden | |
220
-| Max Time | duration | milliseconds | hidden | |
221
-| Rows Affected | integer | | | |
222
-| Rows Sent | integer | | | |
223
-| Errors | integer | | | |
224
-| Warnings | integer | | | |
225
-| First Seen | string | | hidden | |
226
-| Last Seen | string | | hidden | |
215
+| Digest | string | | hidden | Unique hash identifier for normalized query pattern. Queries with identical structure but different literal values share the same digest. |
216
+| Query | string | | | The SQL query text with literal values truncated at 4096 characters. Use this to identify the actual SQL being executed and spot parameterized queries or injection risks. |
217
+| Schema | string | | | Database name where the query was executed. Essential for multi-database analysis to identify which database or backend is experiencing query load. |
218
+| User | string | | hidden | MySQL username used to execute the query. Useful for identifying application users or connection pool attribution. |
219
+| Hostgroup | integer | | hidden | Backend hostgroup identifier from ProxySQL configuration. Allows grouping queries by backend server for multi-backend analysis. |
220
+| Calls | integer | | | Total number of times this query pattern has been executed. High values indicate frequently run queries that may impact server performance significantly. |
221
+| Total Time | duration | milliseconds | | Cumulative execution time across all query executions. This is a key metric for identifying the most resource-intensive queries in terms of total server time consumption. |
222
+| Avg Time | duration | milliseconds | | Average execution time per query run. Compare with Total Time to determine if individual executions or high frequency drives resource usage. |
223
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed. Helps identify variability in query performance and spot potential optimization opportunities for outliers. |
224
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed. Large gaps between Min Time and Max Time may indicate performance instability due to parameter sniffing, data skew, or lock contention. |
225
+| Rows Affected | integer | | | Total number of rows modified by INSERT, UPDATE, DELETE, or REPLACE statements. Useful for tracking write workloads and data modification patterns. |
226
+| Rows Sent | integer | | | Total number of rows returned to the client by SELECT statements. High values may indicate queries returning large result sets that consume significant network bandwidth and client resources. |
227
+| Errors | integer | | | Total number of times this query pattern resulted in an error. Non-zero values require investigation into the underlying SQL syntax, permission issues, or constraint violations. |
228
+| Warnings | integer | | | Total number of times this query pattern generated a warning. Warnings may indicate data type conversions, NULL handling issues, or other non-critical SQL problems that should be reviewed. |
229
+| First Seen | string | | hidden | Timestamp when this query pattern was first observed. Helps identify new queries that may have been introduced by application changes or code deployments. |
230
+| Last Seen | string | | hidden | Timestamp when this query pattern was last executed. Can help identify stale queries that are no longer in use or to track recent query activity. |
231
232
233
src/go/plugin/go.d/collector/redis/integrations/redis.md
+22
-14
@@ -109,17 +109,25 @@ This collector exposes real-time functions for interactive troubleshooting in th
109
110
### Top Queries
111
112
-Slow commands from Redis SLOWLOG. WARNING: Command arguments may contain unmasked literals (potential PII).
112
+Retrieves slow command entries from Redis [SLOWLOG](https://redis.io/docs/latest/commands/slowlog/).
113
114
-Reads Redis SLOWLOG and returns the top entries sorted by the selected column.
114
+This function executes the `SLOWLOG GET` command to retrieve entries of commands that exceeded the configured execution time threshold (`slowlog-log-slower-than`). It provides command details, execution duration, and client information for each slow command.
115
+
116
+Use cases:
117
+- Identify slow commands that may need optimization
118
+- Analyze command patterns to detect performance hotspots
119
+- Investigate client sources of slow commands
120
+
121
+Command text is truncated at 4096 characters for display purposes.
122
123
124
| Aspect | Description |
125
|:-------|:------------|
126
| Name | `Redis:top-queries` |
120
-| Performance | Uses SLOWLOG GET and may return many entries; use top_queries_limit to control size. |
121
-| Security | Command arguments may contain unmasked literals (potential PII). |
122
-| Availability | Available when the collector is initialized; returns 503 if the collector is still connecting. |
127
+| Require Cloud | yes |
128
+| Performance | Executes `SLOWLOG GET` command to retrieve entries from Redis memory:<br/>• Minimal overhead as SLOWLOG is stored in memory<br/>• Default limit of 500 entries balances completeness with performance<br/>• Large slowlogs with many entries may take slightly longer to transfer |
129
+| Security | Command arguments may contain unmasked literal values including potentially sensitive data:<br/>• Redis keys and values in command arguments<br/>• Application-specific identifiers or session tokens<br/>• Access should be restricted to authorized personnel only |
130
+| Availability | Available when:<br/>• The collector has successfully connected to Redis<br/>• SLOWLOG is enabled (`slowlog-log-slower-than` > 0)<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the command fails<br/>• Returns HTTP 504 if the command times out |
131
132
#### Prerequisites
133
@@ -129,21 +137,21 @@ No additional configuration is required.
137
138
| Parameter | Type | Description | Required | Default | Options |
139
|:---------|:-----|:------------|:--------:|:--------|:--------|
132
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | duration | |
140
+| Filter By | select | Select the primary sort column. Options include duration, timestamp, ID, and command name. Defaults to duration to focus on slowest commands. | yes | duration | |
141
142
#### Returns
143
136
-Slowlog entries with command timing and metadata.
144
+Slowlog entries with command timing and client metadata, providing insight into Redis performance patterns. Each row represents a single slow command execution that exceeded the configured threshold.
145
146
| Column | Type | Unit | Visibility | Description |
147
|:-------|:-----|:-----|:-----------|:------------|
140
-| ID | integer | | hidden | |
141
-| Timestamp | timestamp | | | |
142
-| Command | string | | | |
143
-| Command Name | string | | | |
144
-| Duration | duration | milliseconds | | |
145
-| Client Address | string | | hidden | |
146
-| Client Name | string | | hidden | |
148
+| ID | integer | | hidden | Unique identifier for the slowlog entry. Allows tracking individual command executions. |
149
+| Timestamp | timestamp | | | Date and time when the slow command was executed. Useful for correlating slow commands with application events or system changes. |
150
+| Command | string | | | Full command text including all arguments. May contain sensitive data (keys, values) depending on application implementation. Truncated to 4096 characters. |
151
+| Command Name | string | | | The Redis command name (e.g., SET, GET, HGETALL, ZADD). Useful for grouping and analyzing slow commands by type. |
152
+| Duration | duration | milliseconds | | Execution time that exceeded the slowlog threshold. Higher values indicate slower commands that may need optimization or investigation. |
153
+| Client Address | string | | hidden | IP address of the client that executed the slow command. Useful for identifying problematic clients or network segments. |
154
+| Client Name | string | | hidden | Client identifier or name reported by Redis. Useful for identifying specific applications or services generating slow commands. |
155
156
157
src/go/plugin/go.d/collector/rethinkdb/integrations/rethinkdb.md
+41
-17
@@ -104,23 +104,47 @@ This collector exposes real-time functions for interactive troubleshooting in th
104
105
### Running Queries
106
107
-Currently running queries from rethinkdb.jobs. WARNING: Query text may contain unmasked literals (potential PII).
107
+Retrieves currently executing queries from the RethinkDB [rethinkdb.jobs](https://rethinkdb.com/docs/system-jobs/) system table.
108
109
-Queries rethinkdb.jobs and returns running queries sorted by the selected column.
109
+This function queries the `rethinkdb.jobs` system table which contains information about background tasks and queries currently running on the cluster. It provides query text, execution duration, client information, and involved servers.
110
+
111
+Use cases:
112
+- Identify long-running queries that may be blocking resources
113
+- Monitor active query load across the cluster
114
+- Investigate client connections generating heavy workloads
115
+
116
+Query text is truncated at 4096 characters for display purposes.
117
118
119
| Aspect | Description |
120
|:-------|:------------|
121
| Name | `Rethinkdb:running-queries` |
115
-| Performance | Uses system tables and may be expensive on busy clusters. |
116
-| Security | Query text may contain unmasked literals (potential PII). |
117
-| Availability | Available when the collector is initialized; returns 503 if the collector is still connecting. |
122
+| Require Cloud | yes |
123
+| Performance | Queries the `rethinkdb.jobs` system table:<br/>• Minimal overhead as it reads from an in-memory system table<br/>• Default limit of 500 rows balances completeness with performance<br/>• Returns only currently active queries (no historical data) |
124
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Document field values in filter conditions<br/>• User-provided data in insert/update operations<br/>• Access should be restricted to authorized personnel only |
125
+| Availability | Available when:<br/>• The collector has successfully connected to RethinkDB<br/>• The user has admin access to `rethinkdb.jobs` table<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
126
127
#### Prerequisites
128
121
-##### Grant admin access to rethinkdb.jobs
129
+##### Grant admin access to `rethinkdb.jobs`
130
+
131
+The user must have admin privileges to query the `rethinkdb.jobs` system table.
132
+
133
+1. Connect with an admin user account that has access to system tables
134
+
135
+2. Verify access to `rethinkdb.jobs`:
136
123
-Use an admin user with access to rethinkdb.jobs and ensure the connection is working.
137
+ ```javascript
138
+ r.db('rethinkdb').table('jobs').run(conn)
139
+ ```
140
+
141
+:::info
142
+
143
+- The `rethinkdb.jobs` table is only accessible to admin users
144
+- Non-admin users will receive a permission error when attempting to query this table
145
+- The collector's regular metrics do not require admin access
146
+
147
+:::
148
149
150
@@ -128,22 +152,22 @@ Use an admin user with access to rethinkdb.jobs and ensure the connection is wor
152
153
| Parameter | Type | Description | Required | Default | Options |
154
|:---------|:-----|:------------|:--------:|:--------|:--------|
131
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | durationMs | |
155
+| Filter By | select | Select the primary sort column. Defaults to duration to focus on longest-running queries. | yes | durationMs | |
156
157
#### Returns
158
135
-Snapshot of running queries from rethinkdb.jobs.
159
+Currently running queries from the `rethinkdb.jobs` system table. Each row represents a single active query with its execution context.
160
161
| Column | Type | Unit | Visibility | Description |
162
|:-------|:-----|:-----|:-----------|:------------|
139
-| Job ID | string | | hidden | |
140
-| Query | string | | | |
141
-| Duration | duration | milliseconds | | |
142
-| Type | string | | | |
143
-| User | string | | | |
144
-| Client Address | string | | hidden | |
145
-| Client Port | integer | | hidden | |
146
-| Servers | string | | hidden | |
163
+| Job ID | string | | hidden | Unique identifier for the job entry. Can be used to track or kill specific queries. |
164
+| Query | string | | | The ReQL query text being executed. Truncated to 4096 characters. May contain literal values from application code. |
165
+| Duration | duration | milliseconds | | Time elapsed since the query started executing. High values indicate long-running queries that may need investigation. |
166
+| Type | string | | | Job type (e.g., query, index_construction, disk_compaction). Useful for distinguishing user queries from background tasks. |
167
+| User | string | | | RethinkDB user account that initiated the query. Useful for identifying workload by user or application. |
168
+| Client Address | string | | hidden | IP address of the client connection that submitted the query. |
169
+| Client Port | integer | | hidden | Port number of the client connection. |
170
+| Servers | string | | hidden | Comma-separated list of servers involved in executing this query. |
171
172
173
src/go/plugin/go.d/collector/snmp/integrations/snmp_devices.md
+34
-26
@@ -132,17 +132,25 @@ This collector exposes real-time functions for interactive troubleshooting in th
132
133
### Network Interfaces
134
135
-Network interface traffic and status metrics.
135
+Provides detailed network interface traffic and status metrics from SNMP-enabled devices.
136
137
-Uses the latest cached SNMP interface data, filters by the selected type group, and sorts by the default column.
137
+This function queries cached SNMP interface data collected during regular polling cycles and presents it in a sortable, filterable table. Each row represents a network interface on the monitored SNMP device, with comprehensive metrics for traffic analysis, error monitoring, and operational status tracking.
138
+
139
+Use cases:
140
+- Identify top bandwidth-consuming interfaces on routers, switches, and access points
141
+- Monitor interface operational and administrative status for network health
142
+- Investigate packet errors, discards, and unusual traffic patterns
143
+
144
+Data is sourced from the IF-MIB (RFC 2863) interface counters and is cached from the last successful SNMP collection. No additional SNMP requests are triggered when calling this function.
145
146
147
| Aspect | Description |
148
|:-------|:------------|
149
| Name | `Snmp:interfaces` |
143
-| Performance | Uses cached data only and does not trigger additional SNMP requests. Large devices may return many rows. |
144
-| Security | Exposes interface names and counters only. |
145
-| Availability | Available after the collector has completed at least one data collection; returns 503 until cache is ready. |
150
+| Require Cloud | no |
151
+| Performance | Uses cached SNMP data only, no additional SNMP requests are triggered:<br/>• Responses are instantaneous from memory cache<br/>• Large devices with many interfaces may return many rows |
152
+| Security | Exposes interface names, operational status, and traffic counters only:<br/>• No packet payloads or authentication credentials are exposed<br/>• No device configuration details are exposed |
153
+| Availability | Available when:<br/>• The collector has completed at least one data collection cycle<br/>• Interface data is cached from the last successful SNMP collection<br/>• Returns HTTP 503 if cache is not ready yet |
154
155
#### Prerequisites
156
@@ -152,33 +160,33 @@ No additional configuration is required.
160
161
| Parameter | Type | Description | Required | Default | Options |
162
|:---------|:-----|:------------|:--------:|:--------|:--------|
155
-| Type Group | select | Filter by interface type group. | yes | ethernet | Ethernet (default), Aggregation, Virtual, Other |
163
+| Type Group | select | Filter interfaces by their type classification group. Custom mapping categorizes IANA interface types into practical groups for easier filtering. | yes | ethernet | Ethernet (default), Aggregation, Virtual, Other |
164
165
#### Returns
166
159
-Table of interface traffic and status from cached SNMP data.
167
+Network interface metrics from cached SNMP data, including traffic rates, packet statistics, operational status, and error counters. Each row represents one physical or virtual interface.
168
169
| Column | Type | Unit | Visibility | Description |
170
|:-------|:-----|:-----|:-----------|:------------|
163
-| Interface | string | | | |
164
-| Type | string | | | |
165
-| Type Group | string | | | |
166
-| Admin Status | string | | | |
167
-| Oper Status | string | | | |
168
-| Traffic In | float | Mbits | | |
169
-| Traffic Out | float | Mbits | | |
170
-| Unicast In | float | Kpps | hidden | |
171
-| Unicast Out | float | Kpps | hidden | |
172
-| Broadcast In | float | Kpps | hidden | |
173
-| Broadcast Out | float | Kpps | hidden | |
174
-| Packets In | float | Kpps | | |
175
-| Packets Out | float | Kpps | | |
176
-| Errors In | float | packets/s | hidden | |
177
-| Errors Out | float | packets/s | hidden | |
178
-| Discards In | float | packets/s | | |
179
-| Discards Out | float | packets/s | | |
180
-| Multicast In | float | Kpps | hidden | |
181
-| Multicast Out | float | Kpps | hidden | |
171
+| Interface | string | | | Network interface name or identifier (e.g., eth0, GigabitEthernet1/0/1, Vlan100) |
172
+| Type | string | | | IANA-assigned interface type from IF-MIB (e.g., ethernetCsmacd, ieee80211, softwareLoopback) |
173
+| Type Group | string | | | Custom categorization mapping IANA interface types into practical groups: Ethernet (physical Ethernet interfaces), Aggregation (LAG/port-channels, bonds), Virtual (VLANs, loopbacks), or Other (all remaining types) |
174
+| Admin Status | string | | | Administrative state configured on the interface: up (enabled for use), down (administratively disabled), or testing (currently in test mode). Different from operational status. |
175
+| Oper Status | string | | | Current operational state of the interface: up (operational and passing traffic), down (not operational), testing (in test mode), unknown (status cannot be determined), dormant (waiting for external actions), notPresent (interface removed but configuration remains), or lowerLayerDown (interface down due to lower-layer issues) |
176
+| Traffic In | float | Mbits | | Inbound network traffic rate in megabits per second. High values indicate heavy inbound data flow that may require capacity planning. |
177
+| Traffic Out | float | Mbits | | Outbound network traffic rate in megabits per second. High values indicate heavy outbound data flow. Compare with Traffic In to identify asymmetric usage patterns. |
178
+| Unicast In | float | Kpps | hidden | Rate of unicast packets (destined for a single recipient) received per second in thousands. Normal traffic pattern for point-to-point communications. |
179
+| Unicast Out | float | Kpps | hidden | Rate of unicast packets (addressed to a single destination) transmitted per second in thousands. |
180
+| Broadcast In | float | Kpps | hidden | Rate of broadcast packets (sent to all nodes on network) received per second in thousands. High values may indicate network storms, ARP flooding, or misconfigured devices. |
181
+| Broadcast Out | float | Kpps | hidden | Rate of broadcast packets transmitted per second in thousands. Consistently high broadcast rates can degrade network performance. |
182
+| Packets In | float | Kpps | | Total inbound packet rate (sum of unicast, broadcast, and multicast) per second in thousands. Useful for overall interface load assessment. |
183
+| Packets Out | float | Kpps | | Total outbound packet rate (sum of unicast, broadcast, and multicast) per second in thousands. |
184
+| Errors In | float | packets/s | hidden | Rate of inbound packets with errors that prevented delivery. Non-zero values indicate physical layer issues (cable problems, signal integrity) or buffer overruns. |
185
+| Errors Out | float | packets/s | hidden | Rate of outbound packets with transmission errors. Non-zero values may indicate interface hardware issues, cabling problems, or duplex mismatches. |
186
+| Discards In | float | packets/s | | Rate of inbound packets deliberately discarded by the device (often due to resource constraints, security policies, or unrecognized frames). Unlike errors, the interface may have been functioning correctly but chose to drop the packet. |
187
+| Discards Out | float | packets/s | | Rate of outbound packets deliberately discarded. Can indicate output queue overflows, ACL drops, or security policy rejections. |
188
+| Multicast In | float | Kpps | hidden | Rate of multicast packets (destined for a group) received per second in thousands. Common in video streaming, multicast applications, and routing protocols. |
189
+| Multicast Out | float | Kpps | hidden | Rate of multicast packets transmitted per second in thousands. |
190
191
192
src/go/plugin/go.d/collector/yugabytedb/integrations/yugabytedb.md
+88
-40
@@ -340,23 +340,51 @@ This collector exposes real-time functions for interactive troubleshooting in th
340
341
### Top Queries
342
343
-Top SQL queries from pg_stat_statements. WARNING: Query text may contain unmasked literals (potential PII).
343
+Retrieves aggregated query statistics from the PostgreSQL-compatible [pg_stat_statements](https://docs.yugabyte.com/preview/explore/query-1-performance/pg-stat-statements/) extension in YSQL.
344
345
-Reads pg_stat_statements and returns the top entries sorted by the selected column.
345
+This function queries the `pg_stat_statements` view which tracks execution statistics for all SQL statements executed on the YSQL layer. It provides timing metrics, execution counts, and row statistics for each unique query pattern.
346
+
347
+Use cases:
348
+- Identify slow queries consuming excessive total execution time
349
+- Find high-frequency queries that may benefit from optimization
350
+- Analyze query patterns by database and user
351
+
352
+Query text is truncated at 4096 characters for display purposes.
353
354
355
| Aspect | Description |
356
|:-------|:------------|
357
| Name | `Yugabytedb:top-queries` |
351
-| Performance | Executes SQL queries and may be expensive on busy clusters; use top_queries_limit and sql_timeout. |
352
-| Security | Query text may contain unmasked literals (potential PII). |
353
-| Availability | Available when YSQL is accessible; returns errors if the SQL connection is unavailable. |
358
+| Require Cloud | yes |
359
+| Performance | Queries the `pg_stat_statements` view via YSQL connection:<br/>• Default limit of 500 rows balances completeness with performance<br/>• Use `sql_timeout` to prevent long-running queries |
360
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data embedded in queries<br/>• Access should be restricted to authorized personnel only |
361
+| Availability | Available when:<br/>• The collector has successfully connected to YSQL<br/>• The `pg_stat_statements` extension is installed<br/>• Returns HTTP 503 if the SQL connection cannot be established or extension is not installed<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
362
363
#### Prerequisites
364
357
-##### Enable pg_stat_statements for YSQL
365
+##### Enable pg_stat_statements extension
366
+
367
+The `pg_stat_statements` extension must be installed in the target YSQL database.
368
+
369
+1. Install the extension:
370
+
371
+ ```sql
372
+ CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
373
+ ```
374
+
375
+2. Verify access:
376
+
377
+ ```sql
378
+ SELECT * FROM pg_stat_statements LIMIT 1;
379
+ ```
380
+
381
+:::info
382
+
383
+- The extension tracks statistics for all SQL statements executed
384
+- Statistics can be reset with `SELECT pg_stat_statements_reset()`
385
+- YugabyteDB uses PostgreSQL-compatible extensions
386
359
-Install and enable pg_stat_statements and configure a YSQL DSN.
387
+:::
388
389
390
@@ -364,45 +392,65 @@ Install and enable pg_stat_statements and configure a YSQL DSN.
392
393
| Parameter | Type | Description | Required | Default | Options |
394
|:---------|:-----|:------------|:--------:|:--------|:--------|
367
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | totalTime | |
395
+| Filter By | select | Select the primary sort column. Options include total time, mean time, max time, calls, and rows. Defaults to total time to focus on most resource-intensive queries. | yes | totalTime | |
396
397
#### Returns
398
371
-Aggregated query statistics from pg_stat_statements.
399
+Aggregated query statistics from `pg_stat_statements`. Each row represents a unique query pattern with cumulative metrics across all executions.
400
401
| Column | Type | Unit | Visibility | Description |
402
|:-------|:-----|:-----|:-----------|:------------|
375
-| Query ID | string | | hidden | |
376
-| Query | string | | | |
377
-| Database | string | | | |
378
-| User | string | | | |
379
-| Calls | integer | | | |
380
-| Total Time | duration | milliseconds | | |
381
-| Mean Time | duration | milliseconds | | |
382
-| Min Time | duration | milliseconds | hidden | |
383
-| Max Time | duration | milliseconds | hidden | |
384
-| Rows | integer | | | |
385
-| Stddev Time | duration | milliseconds | hidden | |
403
+| Query ID | string | | hidden | Internal hash identifier for the normalized query pattern. |
404
+| Query | string | | | Normalized SQL query text with literals replaced by parameter placeholders. Truncated to 4096 characters. |
405
+| Database | string | | | Database name where the query was executed. Useful for multi-database workload analysis. |
406
+| User | string | | | YSQL user who executed the query. Useful for identifying workload by user or application. |
407
+| Calls | integer | | | Total number of times this query pattern has been executed. High values indicate frequently run queries. |
408
+| Total Time | duration | milliseconds | | Cumulative execution time across all calls. Primary metric for identifying resource-intensive queries. |
409
+| Mean Time | duration | milliseconds | | Average execution time per call. Compare with total time to distinguish slow queries from frequently called ones. |
410
+| Min Time | duration | milliseconds | hidden | Minimum execution time observed for this query pattern. |
411
+| Max Time | duration | milliseconds | hidden | Maximum execution time observed. Large gaps between min and max may indicate parameter sensitivity or lock contention. |
412
+| Rows | integer | | | Total number of rows retrieved or affected by the query across all executions. |
413
+| Stddev Time | duration | milliseconds | hidden | Standard deviation of execution times. High values indicate inconsistent query performance. |
414
415
### Running Queries
416
389
-Currently running SQL statements from pg_stat_activity. WARNING: Query text may contain unmasked literals (potential PII).
417
+Retrieves currently executing statements from the PostgreSQL-compatible [pg_stat_activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW) view in YSQL.
418
+
419
+This function queries `pg_stat_activity` to show all non-idle backend processes with their current query, state, and timing information. It excludes idle connections to focus on active workload.
420
+
421
+Use cases:
422
+- Identify long-running queries that may need investigation
423
+- Monitor active connections and their current state
424
+- Investigate blocked or waiting queries
425
391
-Reads pg_stat_activity and returns running statements sorted by the selected column.
426
+Query text is truncated at 4096 characters for display purposes.
427
428
429
| Aspect | Description |
430
|:-------|:------------|
431
| Name | `Yugabytedb:running-queries` |
397
-| Performance | Executes SQL queries and may be expensive on busy clusters; use top_queries_limit and sql_timeout. |
398
-| Security | Query text may contain unmasked literals (potential PII). |
399
-| Availability | Available when YSQL is accessible; returns errors if the SQL connection is unavailable. |
432
+| Require Cloud | yes |
433
+| Performance | Queries the `pg_stat_activity` view via YSQL connection:<br/>• Returns only non-idle connections to reduce result size<br/>• Default limit of 500 rows balances completeness with performance<br/>• Use `sql_timeout` to prevent long-running queries |
434
+| Security | Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data embedded in queries<br/>• Access should be restricted to authorized personnel only |
435
+| Availability | Available when:<br/>• The collector has successfully connected to YSQL<br/>• Returns HTTP 503 if the SQL connection cannot be established<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out |
436
437
#### Prerequisites
438
403
-##### Grant access to pg_stat_activity
439
+##### Grant access to all queries (optional)
440
405
-Configure a YSQL DSN and grant access to pg_stat_activity.
441
+By default, users can only see their own queries in `pg_stat_activity`. To view all users' queries, grant the `pg_read_all_stats` role:
442
+
443
+```sql
444
+GRANT pg_read_all_stats TO your_user;
445
+```
446
+
447
+:::info
448
+
449
+- The `yugabyte` superuser can see all queries by default
450
+- Without elevated privileges, only the user's own queries are visible
451
+- Idle connections are filtered out from results
452
+
453
+:::
454
455
456
@@ -410,25 +458,25 @@ Configure a YSQL DSN and grant access to pg_stat_activity.
458
459
| Parameter | Type | Description | Required | Default | Options |
460
|:---------|:-----|:------------|:--------:|:--------|:--------|
413
-| Filter By | select | Select the primary sort column (options are derived from sortable columns in the response). | yes | elapsedMs | |
461
+| Filter By | select | Select the primary sort column. Defaults to elapsed time to focus on longest-running queries. | yes | elapsedMs | |
462
463
#### Returns
464
417
-Snapshot of currently running SQL statements.
465
+Currently running SQL statements from `pg_stat_activity`. Each row represents an active backend process with its current query and execution context.
466
467
| Column | Type | Unit | Visibility | Description |
468
|:-------|:-----|:-----|:-----------|:------------|
421
-| PID | string | | hidden | |
422
-| Query | string | | | |
423
-| Database | string | | | |
424
-| User | string | | | |
425
-| State | string | | | |
426
-| Wait Event Type | string | | hidden | |
427
-| Wait Event | string | | hidden | |
428
-| Application | string | | hidden | |
429
-| Client Address | string | | hidden | |
430
-| Query Start | string | | hidden | |
431
-| Elapsed | duration | milliseconds | | |
469
+| PID | string | | hidden | Backend process ID. Can be used with pg_terminate_backend() to cancel a query. |
470
+| Query | string | | | The SQL statement currently being executed. Truncated to 4096 characters. |
471
+| Database | string | | | Database name the backend is connected to. |
472
+| User | string | | | YSQL user name of the backend process. |
473
+| State | string | | | Current state of the backend (active, idle in transaction, fastpath function call, etc.). |
474
+| Wait Event Type | string | | hidden | Type of event the backend is waiting for (Lock, LWLock, IO, etc.). Null if not waiting. |
475
+| Wait Event | string | | hidden | Specific wait event name. Useful for diagnosing lock contention or I/O bottlenecks. |
476
+| Application | string | | hidden | Application name set by the client connection. Useful for identifying which application is running the query. |
477
+| Client Address | string | | hidden | IP address of the client connection. |
478
+| Query Start | string | | hidden | Timestamp when the current query began execution. |
479
+| Elapsed | duration | milliseconds | | Time elapsed since the query started. High values indicate long-running queries that may need investigation. |
480
481
482