Work I did as a part of Google Summer of Code in 2023 at PostgreSQL.
Parent repository: https://github.com/pgadmin-org/pgadmin4
Patch file: system_statistics.patch
GUI representation of the system's activity using the 'system_stats' extension.
-
Added tab to toggle between general (existing dashboard) and system statistics.
-
Updated StreamingChart
-
Secondary Y-axis support (Different scale on the right hand side). Set
showSecondAxis=True
to enable this. -
It is currently not formatting the axis values and takes much space in case of larger values (eg. memory_usage, handle_count etc.). So added custom formatter for y-axis values.
suffixes = ['', 'k', 'M', 'B', 'T']
-
Tooltip issue: When the container's size changes, tooltips continues to accumulate without being properly removed. This bug is also present in the current stable version of pgAdmin4 application. Current method that is used to display tooltips involves inserting a new element into the DOM with the class name "uplot-tooltip". So, to resolve this issue, I have added method to remove all the existing tooltip elements before inserting a new one.
-
-
If the System Stats extension does not exist, display the appropriate message
-
System statistics features covered
All the features are split into 4 different tabs with the following grouping:
- Summary
- OS information
Tabular representation of the following OS properties.- Name
- Version
- Host name
- Domain name
- Architecture
- OS up since seconds
- Handle & process count graph
Streaming line chart to show changes in handle and process count over time.- Handle count: Number of object handles that are currently open in the operating system.
- Process count: Number of processes that are currently running on the operating system.
- CPU Information
Tabular representation of the following CPU properties.- Vendor
- Description
- Model name
- No of cores
- Architecture
- Clock speed Hz
- L1 dcache size
- L1 icache size
- L2 cache size
- L3 cache size
- OS information
- CPU
- CPU Usage Information
Streaming line chart to show changes in CPU usage over time. Values are a percentage of time spent by CPUs for all operations. Following modes are covered:- User mode normal
- User mode niced
- Kernal mode
- Idle mode
- Load Avg Information
Streaming line chart to show changes in the average load of the system over 1, 5, 10 and 15 minute intervals over time. - Process CPU usage
Tabular representation of the CPU usage per process with the options to filter and sort.- Process ID
- Process name
- CPU usage value
- CPU Usage Information
- Memory
- Memory Information
Streaming line chart to show changes in the memory usage.
Both Main and Swap memory are covered with following categories.- Total memory available
- Used memory
- Free memory
- Process memory usage
Tabular representation of the memory usage per process with the options to filter and sort.- Process ID
- Process name
- Memory usage in bytes
- Total memory used in bytes
- Memory Information
- Storage
-
Disk Information
Tabular representation of the following properties for all the drive partitions.- File system
- File system type
- Mount point
- Drive letter
- Total space
- Used space
- Free space
- Total inodes
- Used inodes
- Free inodes
Graphical representation of Total space using a Pie chart and Stacked Bar chart for Used and Available space
-
I/O Analysis Information
Streaming line chart to show changes in the total number of operations, bytes transferred, and time spent in milliseconds for reading and writing over time for each disk.
-
- Summary
-
Provided option to configure the refresh rates for the API calls
(File > Preferences > Dashboards > Refresh rates)
-
SQL queries
All the required queries are present in the
pgadmin4\web\pgadmin\dashboard\templates\dashboard\sql\default\system_statistics.sql
-
Backend support
All the backend related code to handle API requests and process the queries is present in the
pgadmin4\web\pgadmin\dashboard\__init__.py
A small demonstration of the work can be found here.