Makes use of strace
Project description
ttrace - strace as a tree
Uses strace
to trace a program call and displays what's going on in a human
friendly manner.
$ ttrace docker run -it --rm ubuntu echo hello world hello world 3477985 - [execve, docker run -it --rm ubuntu echo hello world] ├── 3477986 - [clone3] ├── 3477987 - [clone3] │ └── 3477989 - [clone3] │ ├── 3477992 - [clone3] │ │ └── 'hello world\r\n' │ └── 3478002 - [clone, /usr/libexec/docker/cli-plugins/docker-compose docker-cli-plugin-metad] │ ├── 3478003 - [clone3] │ ├── 3478004 - [clone3] │ │ ├── 3478006 - [clone3] │ │ │ ├── 3478009 - [clone3] │ │ │ └── '{\n \"SchemaVersion\": \"0.1.0\",\n \"Vendor\": \"Docker Inc.\",\n \"Version\": \"v2.17.2\",\n \"ShortDescription\": \"Docker Compose\"\n}\n' │ │ └── 3478010 - [clone3] │ ├── 3478005 - [clone3] │ ├── 3478007 - [clone3] │ └── 3478008 - [clone3] │ └── 3478011 - [clone3] ├── 3477988 - [clone3] │ ├── 3478012 - [clone3] │ └── '' ├── 3477990 - [clone3] ├── 3477991 - [clone3] └── 3477993 - [clone, /usr/libexec/docker/cli-plugins/docker-buildx docker-cli-plugin-metada] ├── 3477994 - [clone] ├── 3477995 - [clone] │ └── 3477997 - [clone] ├── 3477996 - [clone] ├── 3477998 - [clone] │ └── 3477999 - [clone] │ └── 3478000 - [clone] │ └── 3478001 - [clone] └── '{\n \"SchemaVersion\": \"0.1.0\",\n \"Vendor\": \"Docker Inc.\",\n \"Version\": \"v0.10.4\",\n \"ShortDescription\": \"Docker Buildx\"\n}\n'
Installation and Usage
Install ttrace
via pip:
[<python executable> -m] pip install [-U] ttrace
A new executable is then provided which can be used instead of strace
:
ttrace [<ARGS>] <CMD>
Note that you would'nt provide strace
arguments since ttrace
provides them
automatically.
Alternatively you can clone and use the current development tree, see below.
Intended interface
The following commands and outputs reflect the current development plan:
ttrace <CMD|LOGFILE>
Prints annotated, pre-formatted and filtered output next to the process' original
stdout
and stderr
.
ttrace --attach <PID|NAME>
Attaches to the given process and displays all but stdout
and stderr
of the
process of course.
<CMD> | ttrace [<OTHER-ARGS>]
Same as with attach
but using pipe semantics (limited due to the mixing of
stderr
and strace
output.
ttrace --grep <PATTERN> <CMD>
Applies pattern to the original strace
output and only outputs the matching
content.
ttrace --tree <CMD>
Populates and displays a tree while the program is running.
ttrace --hybrid <CMD>
Not sure yet - plan is to have ncurses
based split views for optionally any
of the following elements:
- tree output
- combined
stdout
andstderr
- alternatively split
stdout
andstderr
- strace console
- console with only warning character (whatever that means)
ttrace --timing <CMD>
ToDo for v1.0
- trace process termination
- output growing process tree
- report / visualize abnormal process termination
- report / visualize file access
- optionally turn PIDs into PID counters for comparability
- optionally print timestamp, pid, line number
- no color
- logging
Other ideas
- compare trace files on abstract level
- trace changes environment
- trace docker image usage
- highlight failed processes
Development & Contribution
pip3 install -U poetry pre-commit
git clone --recurse-submodules https://projects.om-office.de/frans/ttrace.git
cd ttrace
pre-commit install
# if you need a specific version of Python inside your dev environment
poetry env use ~/.pyenv/versions/3.10.4/bin/python3
poetry install
License
See License.md
Read
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.