docs(go.d/sql): fix functions section in metadata.yaml (#21671)
Ilya Mashchenko committed
Jan 29, 2026 at 21:27 UTC
e89be28348b29d0b08eabf23c43b18814010c5a9
1 file changed
+5
-64
src/go/plugin/go.d/collector/sql/metadata.yaml
+5
-64
@@ -708,14 +708,11 @@ modules:
708
functions:
709
description: |
710
This collector supports user-defined SQL functions that expose query results as
711
- interactive table views in Netdata's **Top** tab.
711
+ interactive table views in Netdata's **Top** tab. Functions are configured per job
712
+ in the `functions` section of the job configuration. Since functions are entirely
713
+ user-defined, no predefined functions are listed here.
714
713
- Unlike metrics which create time-series charts, functions provide on-demand,
714
- tabular data views that users can filter, sort, and search.
715
-
716
- **How Functions Appear in the UI**:
717
-
718
- Functions are organized hierarchically in the **Top** tab:
715
+ In the Top tab, functions appear in a hierarchical menu:
716
717
```
718
Databases
@@ -725,63 +722,7 @@ modules:
722
└── <function_name_2>
723
```
724
728
- Each job creates its own group, and each function within that job appears as a
729
- selectable item. The function's `name` field (or auto-derived name from `id`)
730
- is displayed in the UI.
731
-
732
- > **Note:** Function IDs cannot contain colons (`:`) as they are used internally
733
- > as delimiters. Use hyphens (`-`) or underscores (`_`) instead.
734
-
735
- **Use Cases**:
736
-
737
- - **Slow query analysis**: Query `pg_stat_statements` or `performance_schema` to show queries by execution time.
738
- - **Active connections**: List current sessions from `pg_stat_activity` or `information_schema.processlist`.
739
- - **Lock monitoring**: Display blocking locks from `pg_locks` or `sys.dm_tran_locks`.
740
- - **Table statistics**: Show per-table row counts, bloat, or index usage.
741
-
742
- **Configuration**:
743
-
744
- Functions are defined in the `functions` list in your job configuration:
745
-
746
- ```yaml
747
- functions:
748
- - id: slow-queries # Required: unique identifier
749
- name: Slow Queries # Optional: display name (derived from id if not set)
750
- description: Top queries # Optional: help text
751
- query: | # Required: SQL to execute
752
- SELECT query, calls, total_time
753
- FROM pg_stat_statements
754
- ORDER BY total_time DESC
755
- timeout: 10 # Optional: query timeout (seconds)
756
- limit: 100 # Optional: max rows (default: 100)
757
- default_sort: total_time # Optional: initial sort column
758
- default_sort_desc: true # Optional: descending sort (default: true)
759
- columns: # Optional: column overrides
760
- total_time:
761
- type: duration
762
- units: milliseconds
763
- ```
764
-
765
- **Column Types**:
766
-
767
- Column types are auto-detected from database metadata but can be overridden:
768
-
769
- | Type | Description | Example columns |
770
- |-------------|------------------------------------------|----------------------------|
771
- | `string` | Text values | query, schema, username |
772
- | `integer` | Whole numbers | calls, rows, connections |
773
- | `float` | Decimal numbers | ratio, percentage |
774
- | `boolean` | True/false values | is_active, enabled |
775
- | `duration` | Time intervals (specify units) | execution_time, wait_time |
776
- | `timestamp` | Date/time values | start_time, last_seen |
777
-
778
- **Function-Only Mode**:
779
-
780
- Jobs can be configured to only provide functions by setting `function_only: true`.
781
- In this mode:
782
- - No charts are created (metrics configuration is not required)
783
- - The job only provides interactive table views via the Top tab
784
- - Useful for ad-hoc analysis without ongoing metric collection
725
+ Each job creates its own group containing all functions defined for that job.
726
list: []
727
metrics:
728
folding: