Commit Graph

6290 Commits

Author SHA1 Message Date
snyk-bot 4a8586a570
fix: webui-requirements.txt to reduce vulnerabilities
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-H11-10293728
2025-06-09 16:36:47 +00:00
Nicolas Hennion ed400246fd
Merge pull request #3107 from nicolargo/renovate/pysnmp-lextudio-6.x
fix(deps): update dependency pysnmp-lextudio to <6.3.1
2025-06-09 13:10:57 +02:00
Nicolas Hennion efa636b7a7
Merge pull request #3195 from nicolargo/snyk-fix-b29587102aaf5d35b3590a9d7407596b
[Snyk] Security upgrade h11 from 0.14.0 to 0.16.0
2025-06-08 09:44:46 +02:00
Nicolas Hennion a3556a4004
Merge pull request #3184 from nicolargo/snyk-fix-7fbd5db6108cdc150d044d238786b513
[Snyk] Fix for 8 vulnerabilities
2025-06-08 09:44:23 +02:00
nicolargo 4dd312229f Commit issue following #3186 - glances.js not found 2025-06-08 09:40:46 +02:00
snyk-bot 36e0b46903
fix: dev-requirements.txt to reduce vulnerabilities
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-H11-10293728
2025-06-08 07:34:24 +00:00
Nicolas Hennion b31aa7234e
Merge pull request #3192 from fr4nc0is/FIX-3186
Update plugin containers display and order #3186
2025-06-08 09:31:38 +02:00
Nicolas Hennion f854ea31d8
Merge pull request #3191 from ia74/patch-1
Change "Pinned thread" to "Pinned task" and "Upin" to "Unpin"
2025-06-08 09:30:41 +02:00
Nicolas Hennion 1f8e63ec3d
Merge pull request #3190 from ariel-anieli/issue-3181
glances: amps: Removal of iterator helpers, refactor
2025-06-08 09:30:07 +02:00
fr4nc0is 0e288cdc97 Update plugin containers display and order #3186 2025-06-03 09:18:14 +02:00
ia74 6ed7bee526
Change "Pinned thread" to "Pinned task" and "Upin" to "Unpin" 2025-06-02 16:23:22 -05:00
Ariel Otilibili 5a661a295c
glances: Refactor _build_amps_list
Used a list comprehension. Moreover None and empty list are considered
as false values in Python.

Part-of: #2801
Link: https://docs.python.org/3/library/stdtypes.html#truth-value-testing
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-06-02 14:20:22 +02:00
Ariel Otilibili 9e29d8aa45
glances: amps: remove iterator helpers
No more needed in Python 3.

Moreover in update(), the keys are not used: the call to items() is
replaced with values().

Related to #3181
2025-06-02 14:20:13 +02:00
nicolargo a6de55bfca Add test for JSON export 2025-06-01 17:37:21 +02:00
nicolargo fe5edd6e60 Add Star history to Readme file 2025-05-31 15:31:18 +02:00
nicolargo 71c1c34ddd Add Star history to Readme file 2025-05-31 15:28:17 +02:00
Nicolas Hennion eff75ebeed
Merge pull request #3189 from nicolargo/renovate/alpine-3.x
chore(deps): update alpine docker tag to v3.22
2025-05-31 14:44:31 +02:00
Nicolas Hennion 07daacd35f
Merge pull request #3187 from ariel-anieli/issue-3181-processes-client-snmp
glances: removal of iterators helpers in `processes.py` & `stats_client_snmp.py`
2025-05-31 14:44:01 +02:00
Nicolas Hennion 7440f6df9b
Merge pull request #3188 from ariel-anieli/issue-2801-glances-curses
outputs: containers: Refactor
2025-05-31 14:43:45 +02:00
Ariel Otilibili d6802b77d7
plugins: containers: Refactor update()
Commit 445d20dc ("plugins: containers: Refactor") changed update() so
that, stats are added if any of is_key_in_container_and_not_hidden()
or is_key_absent_in_container() is true.

This could be replaced by the negation of is_key_in_container_and_hidden()

Part-of: #2801
Suggested-by: Jasmin Blackshaw <105jassen@gmail.com>
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-31 13:46:44 +02:00
renovate[bot] 3462a48081
chore(deps): update alpine docker tag to v3.22 2025-05-30 22:02:58 +00:00
Ariel Otilibili c5acae327b
outputs: glances_curses: Refactor
In catch_other_actions_maybe_return_to_browser(), replaced if-statements
by a dict. If no key is found, a null function is executed.

Part-of: #2801
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-30 14:12:11 +02:00
Ariel Otilibili 73663ef5c7
glances: remove iterator helpers
No more needed in Python 3. Following commit 72e1511d ("globals: Fix a
race condition in namedtuple_to_dict"), the dynamic view on the keys is
as well transformed into a list.

Related to #3181
2025-05-29 13:59:09 +02:00
Ariel Otilibili 003ba392c0
glances: Refactor
Instead of a loop, used a generator for the search.

Part-of: #2801
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-29 13:59:09 +02:00
Ariel Otilibili b28d793d72
glances: remove iterator helpers
No more needed in Python 3.

Related to #3181
2025-05-29 13:39:51 +02:00
nicolargo 1c6485fda6 Update Glances dev version 2025-05-28 10:01:16 +02:00
nicolargo 649562ca37 Update Glances dev version 2025-05-28 09:54:07 +02:00
nicolargo 17e43c1271 Update Glances dev version 2025-05-28 09:39:25 +02:00
Nicolas Hennion c1a772d7f1
Merge pull request #3185 from ariel-anieli/issue-3097-dict-changed-size-runtime-error
globals: Fix a race condition in `namedtuple_to_dict`
2025-05-27 17:32:55 +02:00
Ariel Otilibili 72e1511dc4
globals: Fix a race condition in namedtuple_to_dict
namedtuple_to_dict() loops over a dynamic view of the dict of processes;
other threads might be editing the same dict.

For instance in webserver mode, when a race condition happens, the
following error shows up in the console:

>   File "C:\Users\ryabtsev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\glances\processes.py", line 628, in update_list
>     return list_of_namedtuple_to_list_of_dict(processlist)
>   File "C:\Users\ryabtsev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\glances\globals.py", line 495, in list_of_namedtuple_to_list_of_dict
>     return [namedtuple_to_dict(d) for d in data]
>             ^^^^^^^^^^^^^^^^^^^^^
>   File "/app/glances/globals.py", line 490, in namedtuple_to_dict
>     return {k: (v._asdict() if hasattr(v, '_asdict') else v) for k, v in data.items()}
>                                                                          ^^^^^^^^^^^^
> RuntimeError: dictionary changed size during iteration

Instead of a dict view, namedtuple_to_dict() will use a list of tuples.

Performances are unchanged: on average, for 100 runs, namedtuple_to_dict()
completes in 0.2ms

GH issue: #3097
Link: https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-27 14:55:41 +02:00
snyk-bot 3278027281
fix: optional-requirements.txt to reduce vulnerabilities
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-2321964
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-2321966
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-2321970
- https://snyk.io/vuln/SNYK-PYTHON-PYARROW-6052811
- https://snyk.io/vuln/SNYK-PYTHON-SETUPTOOLS-3180412
- https://snyk.io/vuln/SNYK-PYTHON-SETUPTOOLS-7448482
- https://snyk.io/vuln/SNYK-PYTHON-SETUPTOOLS-9964606
- https://snyk.io/vuln/SNYK-PYTHON-URLLIB3-7267250
2025-05-27 08:51:43 +00:00
nicolargo ad5e7f8479 Merge branch 'issue3182-InfluxDB3' into develop 2025-05-27 10:46:54 +02:00
nicolargo 3f124d3596 Add support for InfluxDB 3 Core #3182 2025-05-27 10:46:39 +02:00
Nicolas Hennion 24eb6cf21a
Merge pull request #3183 from ariel-anieli/issue-2801-refactor
podman: docker: Remove iterator helpers
2025-05-26 19:24:48 +02:00
Ariel Otilibili 52bd26f03e
podman: remove iterator helpers
No more needed in Python 3.

Related to #3181
2025-05-26 17:34:58 +02:00
Ariel Otilibili 75afbe16c9
docker: remove iterator helpers
No more needed in Python 3.

Related to #3181
2025-05-26 17:34:48 +02:00
nicolargo 6af2aa092b Related to iteritems, itervalues, and iterkeys are not more needed in Python 3 #3181 2025-05-26 15:12:42 +02:00
nicolargo 95d38a1392 Related to iteritems, itervalues, and iterkeys are not more needed in Python 3 #3181 2025-05-26 15:12:03 +02:00
nicolargo dde335696a Add a new field in the process list to identifie Zombie process #3178 2025-05-25 18:52:25 +02:00
Nicolas Hennion ef83c404ff
Merge pull request #3180 from ariel-anieli/issue-2801-refactor
plugins: containers; Refactor
2025-05-25 17:30:57 +02:00
Ariel Otilibili 445d20dcad
plugins: containers: Refactor
1. update()
Two branches share the same logic for updating stats. Moreover, intermediate
values where used in nested loops: for filtering keys, and for extending stats.

This could be done at once with chain.from_iterable().

Therefore four helpers are introduced:
- add_engine_into_container
- is_key_in_container_and_not_hidden
- is_key_absent_in_container
- get_containers_from_updated_watcher

A profiling shows the stats build time is the same after the refactor,

$ sudo make run-webserver 2>&1 | grep primitive
         31631 function calls (31566 primitive calls) in 0.028 seconds
         23537 function calls (23487 primitive calls) in 0.025 seconds
         23559 function calls (23509 primitive calls) in 0.014 seconds
         23549 function calls (23499 primitive calls) in 0.024 seconds
         23549 function calls (23499 primitive calls) in 0.026 seconds
         23559 function calls (23509 primitive calls) in 0.016 seconds
         23559 function calls (23509 primitive calls) in 0.022 seconds
         23544 function calls (23494 primitive calls) in 0.015 seconds
         23549 function calls (23499 primitive calls) in 0.023 seconds
         23544 function calls (23494 primitive calls) in 0.018 seconds

[snapshot of top three calls]
         31881 function calls (31816 primitive calls) in 0.029 seconds

   Ordered by: cumulative time
   List reduced from 536 to 3 due to restriction <3>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        3    0.000    0.000    0.029    0.010 __init__.py:250(<genexpr>)
        2    0.000    0.000    0.029    0.015 __init__.py:242(get_containers_from_updated_watcher)
        1    0.000    0.000    0.029    0.029 docker.py:248(update)

And before,

$ sudo make run-webserver 2>&1 | grep primitive
         31620 function calls (31555 primitive calls) in 0.021 seconds
         23526 function calls (23476 primitive calls) in 0.019 seconds
         23533 function calls (23483 primitive calls) in 0.024 seconds
         23538 function calls (23488 primitive calls) in 0.015 seconds
         23528 function calls (23478 primitive calls) in 0.023 seconds
         23528 function calls (23478 primitive calls) in 0.022 seconds
         23533 function calls (23483 primitive calls) in 0.016 seconds
         23538 function calls (23488 primitive calls) in 0.025 seconds
         23538 function calls (23488 primitive calls) in 0.029 seconds
         23538 function calls (23488 primitive calls) in 0.013 seconds

[snapshot of top three calls]
         31865 function calls (31800 primitive calls) in 0.024 seconds

   Ordered by: cumulative time
   List reduced from 531 to 3 due to restriction <3>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.024    0.024 docker.py:248(update)
       13    0.000    0.000    0.022    0.002 decorators.py:38(inner)
       13    0.000    0.000    0.022    0.002 client.py:244(_get)

2. msg_curse()
The conditions are directly used in any().

3. exit()
Minimum supported version is Python 3.9; loops use iterators by default.

itervalues() was introduced for compatility with Python 2. Commit 76ea71f2
("Remove Python 2 in docs and README files") removed Python 2 support.

Part-of: #2801
Link: https://docs.python.org/3/library/itertools.html#itertools.chain.from_iterable
Link: https://docs.python.org/3/library/profile.html#profile.Profile
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-24 19:56:59 +02:00
Ariel Otilibili e732ba37be
plugins: containers: Refactor build_container_data
All the if-statements do the same actions:
- check the key is not disabled
- and add the corresponding callback to the building steps.

There could be done with a list comprehension on a dict.

Part-of: #2801
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-23 18:17:33 +02:00
Nicolas Hennion e118d7d171
Merge pull request #3179 from ariel-anieli/issue-3098-display-containers
Fix the sorting of containers
2025-05-23 11:33:36 +02:00
Ariel Otilibili b414bafc94
containers: Fix sorting
sort_keys() uses sort_by_these_keys() on the stats. So doing, one of the
retrieved values might be absent; and sort_keys() will fall back to the
default sorting method, which is the alphabetical order.

This is the case for dead or exited containers.

Instead of a key lookup, the get method of dict could be used.

GH issue: #3098
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-22 17:40:42 +02:00
Ariel Otilibili 8e23bd661f
containers: processes: Refactor
Refactored sort_docker_stats() and sort_stats().

Useful for an upcoming commit.

Part-of: #2801
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2025-05-22 17:40:42 +02:00
nicolargo c8d70fb343 Merge branch 'issue3171' into develop 2025-05-02 15:02:33 +02:00
nicolargo 21f0fd0eb4 Refactor code to limit the complexity of update_views method in plugins #3171 2025-05-02 15:01:29 +02:00
nicolargo 5f31106ac1 Merge branch 'issue3169' into develop 2025-05-02 11:17:04 +02:00
nicolargo 6e466c7d14 Code refactoring - Rename plugin class to <Plugin name>Plugin instead of PluginModel #3169 2025-05-02 09:41:32 +02:00
renovate[bot] 1be8d528ed
fix(deps): update dependency pysnmp-lextudio to <6.3.1 2025-04-30 12:09:19 +00:00