TL;DR
A modern code-injection framework for Python + useful utilities.
This is like Pyrasite but without the bugs and Kubernetes-aware.
This powers many Robusta features. You should probably use Robusta instead of using this directly.
Overview
This repo contains source code for the docker container that powers the following Robusta features:
- Inject code into Python apps
- Attach a VSCode debugger to any Python application running on Kubernetes - this works by injecting debugpy
- Profile cpu and memory usage of Python apps - this works by wrapping PySpy (for CPU) and by injecting the
tracemalloc
library into the target process (for memory) - List processes in any pod (not just Python)
Essentially, it is two things:
- A Pyrasite replacement that fixes deadlocks and other issues.
- A Docker container containing that Pyrasite replacement, which is used by Robusta to troubleshoot and debug containers
Adding new python injection payloads
- Add a new payload in src/debug_toolkit/payloads
- Make sure ALL of your code is inside the
entrypoint
function, even imports. Errors are not handled or reported for code outside of the entrypoint.
- Make sure ALL of your code is inside the
- Add a wrapper command in src/debug_toolkit/main.py
Releasing a new version
- Bump the version in pyproject.toml
- Run the following, replacing "v4" with the tag of the new release.
skaffold build --tag v4
That is all. We're not pushing versions to pypi right now.