Skip to content

Commit

Permalink
cockpit: Implement PCP metrics channel in the Python bridge
Browse files Browse the repository at this point in the history
The Python bridge still used the separate `cockpit-pcp` bridge for
metrics gathering. For us to remove the full C bridge implementation the
separate PCP bridge also has to be rewritten.

This rewrite is a more or less Python copy of the C implementation using
the Python PCP module. Even though the Python PCP module offers a
"higher level" fetchGroup API but preliminary testing has found this has
some issues with changing multi instance values and instances can not be
omitted with a fetch group (but this can be done in our own code)

Co-Authored-By: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Co-Authored-By: Tomas Matus <tomatus777@gmail.com>
  • Loading branch information
3 people committed Sep 19, 2024
1 parent 74f3569 commit 174d57e
Show file tree
Hide file tree
Showing 9 changed files with 1,371 additions and 11 deletions.
8 changes: 1 addition & 7 deletions pkg/pcp/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"requires": {
"cockpit": "239"
},
"bridges": [
{
"match": { "payload": "metrics1" },
"spawn": [ "${libexecdir}/cockpit-pcp" ]
}
]
}
}
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ module = [
"libvirt_qemu",
"pika",

# run without pcp module types
"pcp",
"cpmapi",

# run without gobject-introspection (used from cockpit-client for Gtk)
"gi.*",

Expand Down Expand Up @@ -158,6 +162,7 @@ ignore_names = [
"do_*",
"pytest_*",
"test[A-Z0-9]*",
"pytestmark",
]
ignore_decorators = [
"@*.getter",
Expand Down Expand Up @@ -200,6 +205,8 @@ wheel_build_env = pkg
# All other environments (names like py311-lint, py36-pytest, etc) are isolated
# from the system and get their packages from PyPI, according to the specific
# test environment being requested. We build the wheel in a common environment.
# These tests will not run the PCP tests as there is no wheel available.
# https://github.com/performancecopilot/pcp/issues/2076
[testenv]
package = wheel
wheel_build_env = venv-pkg
Expand Down
2 changes: 2 additions & 0 deletions src/cockpit/channels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .http import HttpChannel
from .metrics import InternalMetricsChannel
from .packages import PackagesChannel
from .pcp import PcpMetricsChannel
from .stream import SocketStreamChannel, SubprocessStreamChannel
from .trivial import EchoChannel, NullChannel

Expand All @@ -35,6 +36,7 @@
InternalMetricsChannel,
NullChannel,
PackagesChannel,
PcpMetricsChannel,
SubprocessStreamChannel,
SocketStreamChannel,
]
Loading

0 comments on commit 174d57e

Please sign in to comment.