Commit Graph
7296 Commits
Author SHA1 Message Date
Nicolas Hennion 2da4ccb656 Merge pull request #3675 from ntdatt812/fix/sum-stats-list-index
fix(processlist): index io_counters instead of testing membership in it
2026-08-26 09:20:16 +02:00
Nicolas Hennion 6726803187 Merge branch 'develop' into fix/sum-stats-list-index 2026-08-26 09:19:50 +02:00
Nicolas Hennion a334b47010 Merge pull request #3674 from ntdatt812/fix/filter-key-split-maxsplit
fix(filter): keep the whole regex when it contains a colon
2026-08-26 09:05:18 +02:00
Nicolas Hennion 46fb62ce28 Merge pull request #3673 from ntdatt812/fix/windows-nice-labels-3672
fix(processlist): show Windows priority classes as labels in the NI column (#3672)
2026-08-26 08:43:02 +02:00
Nguyen Thanh Dat bf74f43cd3 fix(processlist): index io_counters instead of testing membership in it
`_sum_stats(key, sub_key)` guarded the accumulation with `sub_key in p[key]`.
That is a mapping test, and `sub_key` is only a mapping key for `memory_info`.
For `io_counters` it is an index — the value is the list

  [read_bytes, write_bytes, read_bytes_old, write_bytes_old, io_tag]

so `0 in p['io_counters']` asked whether the counters *contain the number zero*.
A process doing real IO was skipped, and one whose counters happened to hold the
literal 0/1/2/3 was summed instead:

  [[5000, 700, 2000, 300, 1],            _sum_stats('io_counters', 0) -> 0
   [3000, 400, 1000, 200, 1]]            (expected 8000)

  [[5000, 700, 0, 300, 1]]               _sum_stats('io_counters', 0) -> 5000
                                          (summed only because 0 is in the list)

So the R/s and W/s totals on the process-list summary row — rendered whenever a
process filter is active — were not merely zero but arbitrary. The VIRT and RES
totals beside them were correct, because `memory_info` really is a mapping.

Branch on the container type, and bounds-check the index so a short list is
skipped rather than raising.
2026-08-24 16:19:04 +07:00
Nguyen Thanh Dat 6f1b8db44c fix(filter): keep the whole regex when it contains a colon
`GlancesFilter.filter` split the input on every colon and kept only the second
field, so everything after the second colon was discarded:

  cmdline:C:/Program Files/.*   ->  key=cmdline  regex=C
  name:foo:bar                  ->  key=name     regex=foo

The truncation is silent. The leading fragment is usually still a valid regex —
`C` compiles — so the compile guard never fires, the filter matches nothing, and
the process list comes back empty with no error and only a debug log line.

On Windows that is every absolute path, since each one has a drive colon. It
also truncates URLs, IPv6 literals and any `foo:bar` process name.

`split(':', 1)` rather than the repo's `split_esc`: that helper escapes on
backslash and strips the escape characters from its result, which would mangle a
Windows path regex. The separator here needs no escaping — the key never
contains a colon.
2026-08-24 16:16:10 +07:00
Nguyen Thanh Dat 1b092b8822 fix(processlist): show Windows priority classes as labels in the NI column
psutil reports the Win32 priority *class* for `nice` on Windows, not a nice
value. Those numbers are neither ordered nor small — 32 is normal while 32768 is
*above* normal — so the NI column showed a five-digit number that is meaningless
as a nice value and does not fit its 3-character width.

Render the six classes as the short labels Windows itself uses, in the TUI and
the WebUI alike:

  256 RT   128 Hi   32768 AN   32 No   16384 BN   64 Lo

Only the rendering changes. The API keeps the raw value, so sorting and any
consumer of `/api/*/processlist` are untouched, and `get_nice_alert()` still
receives the number: the `nice_*` limits in glances.conf are POSIX nice values,
and matching a label against them would silence them. An unmapped class falls
through to its number rather than disappearing, so a class Windows adds later
stays visible.

ProgramlistPlugin inherits `_get_process_curses_nice`, so the program view is
covered by the same change.

Closes #3672.
2026-08-24 09:08:44 +07:00
nicolargo fca88aaa0b Correct sensors unit test 2026-08-22 13:56:13 +02:00
nicolargo 635d3a04fa Correct issue with unit test following PR #3671 2026-08-22 13:32:34 +02:00
nicolargo bec0df282c Merge branch 'ntdatt812-fix/3669-container-network-all-interfaces' into develop 2026-08-22 13:13:36 +02:00
nicolargo 207b38965f Remove line in the NEWS.md file because the patch will be applied in the 4.5.7 version. 2026-08-22 13:13:14 +02:00
nicolargo a81f7372a3 Merge branch 'fix/3669-container-network-all-interfaces' of https://github.com/ntdatt812/glances into ntdatt812-fix/3669-container-network-all-interfaces 2026-08-22 13:10:58 +02:00
Nicolas Hennion 962b82513d Merge pull request #3671 from justadityaraj/fix/issue-3582-containers-vms-init-value
fix(plugins): init containers, vms and smart stats as a list
2026-08-22 13:05:23 +02:00
Nicolas Hennion 5475f41f5e Merge pull request #3667 from nightcityblade/fix/issue-3659
feat(fs): allow free-space display in config
2026-08-22 13:05:04 +02:00
Nicolas Hennion ffbd3ebec4 Merge pull request #3665 from VXNCXNX/fix/init-value-comparison
fix: compare stats to the init value, not to the bound method
2026-08-22 13:02:45 +02:00
Aditya Raj Singh 946c34f687 fix(plugins): init containers, vms and smart stats as a list
These three plugins expose a list of stats but inherited the base class's
stats_init_value default of {}. get_init_value() is what update() returns when
it has nothing to report, and what reset() installs, so /api/4/containers
answered {} instead of [] whenever no container engine library was importable -
the empty-dict-for-empty-list the issue reports.

containers and vms simply never passed stats_init_value. smart declared
stats_init_value=[] as its own parameter default and then dropped it on the way
to super().__init__(), so it read as correct while behaving the same way; a grep
for the keyword finds it, only running it does not.

Every other list plugin already passes stats_init_value=[]. tests/test_restful.py
carries a workaround for this exact symptom, added in 4c92e1b as "allow empty
dicts for list plugins" - it was read as test flakiness rather than a bug.

Fixes #3582
2026-08-22 01:27:51 +05:30
Nguyen Thanh Dat b11fd3947c test(containers): add the class docstrings the sibling plugin tests carry
Matches the convention in tests/test_plugin_sensors.py and clears the
docstring findings Codacy raised on the PR.
2026-08-19 11:16:28 +07:00
Nguyen Thanh Dat 061402b012 fix(containers): aggregate network stats over all container interfaces
_get_network_stats() read the container network counters from a single
hardcoded interface. The Docker stats endpoint returns one entry per
container interface, so a container attached to several networks gets
eth0, eth1... and everything past eth0 was silently dropped, making the
reported RX/TX rates too low.

Sum rx_bytes/tx_bytes across all the interfaces instead. Loopback is
excluded, since Docker-API-compatible runtimes have been observed to
report it and its traffic would inflate the totals. Interfaces with
missing counters are skipped rather than aborting the whole method, so
one malformed interface no longer discards the valid ones. None is still
returned when nothing usable remains, keeping --network host containers
unchanged.

The output contract is untouched: same keys, same types, same units.

Fixes #3669
2026-08-19 10:35:48 +07:00
nightcityblade c288b002ee test(fs): cover free-space config in web mode 2026-08-16 23:10:45 +08:00
nightcityblade 5c78c4b0db feat(fs): allow free-space display in config 2026-08-15 23:27:40 +08:00
Nicolas Hennion 3bda428bec Merge pull request #3664 from williamqwu/fix/amd-gpu-ids-lookup-path
Fix AMD GPU name resolution when the card is only listed in AMD's `amdgpu.ids`
2026-08-15 16:45:51 +02:00
Nicolas Hennion c485c09c65 Merge pull request #3661 from siaklin99-gif/fix/network-tx-rate-decoration
fix(network): use the TX alert for bytes_sent_rate_per_sec decoration
2026-08-15 16:40:04 +02:00
VXNCXNX e367b97f81 fix: compare stats to the init value, not to the bound method 2026-08-15 11:09:13 +00:00
William Wu 6ff3373e57 fix: amd gpu name fallback 2026-08-13 17:53:05 -05:00
siaklin99-gif 4f0bcab1e4 fix(network): use the TX alert for bytes_sent_rate_per_sec decoration
The decoration for `bytes_sent_rate_per_sec` was assigned `alert_rx`, while
the line directly above correctly assigns `alert_tx` to `bytes_sent`.

This is user-visible because the two front ends read different keys: the
curses UI reads `bytes_sent`, and the Web UI reads `bytes_sent_rate_per_sec`
(plugin-network.vue). So on an interface with asymmetric traffic the two
UIs can show different alert states for the same value in the same poll --
for example a 1 Gbps link at 950 Mbps RX / 10 Mbps TX shows Tx/s undecorated
in the terminal and in the critical colour in the browser.

Fixes #3660
2026-08-10 11:43:59 -07:00
nicolargo fed67b21a8 Add Docker-compose for TUI 2026-08-08 10:06:24 +02:00
nicolargo 85dc6716dd Merge branch 'Dipet-perf/cache-program-aggregation' into develop 2026-08-07 16:13:10 +02:00
nicolargo cab62286b5 Merge branch 'perf/cache-program-aggregation' of https://github.com/Dipet/glances into Dipet-perf/cache-program-aggregation 2026-08-07 16:11:46 +02:00
nicolargo bbb4176eca Merge branch 'Dipet-perf/lazy-process-views' into develop 2026-08-07 16:04:34 +02:00
dipetm b9ccd12cc4 Invalidate on sort instead of changing sort_stats
sort_stats() has five callers; making its fallback branch copy changed behaviour for
all of them to suit one cache. The cache now clears itself where the sort happens, so
the shared helper is left alone and the in-place branch keeps not allocating.
2026-08-07 16:35:36 +03:00
dipetm 6730436408 Keep the deferral inside processlist instead of the base class
The base class carried a lazy_views flag, a _views_source field, a _build_views split
and an introspection check for subclasses that decorate their views - all of it shared
by 37 plugins to serve one. Overriding update_views/get_views in processlist does the
same with no change to model.py, and set_views/reset_views clear the pending flag so a
reset stays reset.
2026-08-07 16:06:39 +03:00
dipetm 7444b3eb44 Drop the shape checks from the lazy branch
_build_views() already dispatches on list, dict and neither, so repeating the condition
one line earlier only duplicated it. Verified against dict stats, None and an empty list.
2026-08-07 15:56:32 +03:00
dipetm 7cfbebb6e5 Read the stats once, drop the early return, stop poisoning the shared singleton
update_views() called get_raw() twice and returned an empty dict from a separate exit;
one read and one exit instead, with the deferred case named in the docstring.

The test fixture built its own ProcesslistPlugin, whose load() writes Mock attributes
into the glances_processes singleton and broke seven tests in test_core.py whenever the
two files ran together. It now takes the shared plugin and restores what it changes.
2026-08-07 15:52:49 +03:00
dipetm 2935831fc2 Tighten the comments and make the re-sort test check the order
The sort test only compared object identity, which said nothing about the result;
it now asserts the programs come back in the new order. Verified by breaking the
invalidation on purpose - the test fails.
2026-08-07 15:30:22 +03:00
dipetm e6f3145ef5 Trim the comments and drop a test that guarded nothing
One rationale in one place instead of three, and the class attribute no longer
describes the per-key build that is gone. test_unknown_key_raises only exercised
dict lookup and passed unchanged on develop.
2026-08-07 15:29:24 +03:00
dipetm 397ec8dec6 Defer the whole view build instead of doing it per key
A dict subclass that built entries on access turned out to be more machinery than the
problem needs: nothing outside the plugin reads .views directly, and every per-item
caller belongs to a plugin that builds eagerly. Remembering the stats and building once,
on the first read, gives the same result with a plain dict.
2026-08-07 15:24:24 +03:00
dipetm 640f5e748d perf: reuse the program aggregation until the process list changes 2026-08-07 14:37:57 +03:00
dipetm 844895f3cb perf: build process views on demand instead of up front 2026-08-07 14:35:35 +03:00
nicolargo d20e31fcfd Make FreeBSD test compliant with conftest (requests is now needed) 2026-08-07 11:09:08 +02:00
nicolargo 2dc8396f59 Improve unit test error for WebUI 2026-08-07 10:54:14 +02:00
nicolargo c3ecc899ba Correct syntax error in Pypi Readme file 2026-08-07 10:33:03 +02:00
nicolargo e700644a62 Merge branch 'namdamdoi68-oss-feature/issue-3485-webui-modernization' into develop 2026-08-07 10:23:10 +02:00
nicolargo e1adbfd98f build(webui): rebuild production WebUI bundles with Webpack 5 - #3620 2026-08-07 10:22:49 +02:00
nicolargo f7b8be27b0 Merge branch 'feature/issue-3485-webui-modernization' of https://github.com/namdamdoi68-oss/glances into namdamdoi68-oss-feature/issue-3485-webui-modernization 2026-08-07 10:08:28 +02:00
nicolargo 2002add3d3 Remove Wireless dep, no more usefull and add set -e 2026-08-07 10:07:40 +02:00
nicolargo 971b110eaa Reduce Docker images files #3653 2026-08-07 09:41:44 +02:00
namdamdoi68-oss 78291ce53e build(webui): rebuild production WebUI bundles with Webpack 5 (#3485)
Signed-off-by: namdamdoi68-oss <namdamdoi68@gmail.com>
2026-08-07 14:03:21 +07:00
Nicolas Hennion 348af34386 Merge pull request #3646 from Dipet/fix/connections-terminated-states
fix: count terminated connection states instead of counting initiated twice
2026-08-06 09:28:31 +02:00
Nicolas Hennion 636f0731af Merge pull request #3648 from Dipet/fix/program-aggregation
fix: keep zero-valued fields when aggregating processes into programs
2026-08-06 09:25:48 +02:00
Nicolas Hennion 9fddb4734c Merge pull request #3650 from C0rn3j/fixes
Remove `pyinstrument` from runtime dependencies
2026-08-06 09:24:16 +02:00