Skip to content

Conversation

tzanko-matev
Copy link
Contributor

No description provided.

design-docs/capture-output-implementation-plan.md: 

Signed-off-by: Tzanko Matev <[email protected]>
codetracer-python-recorder/src/ffi.rs: 
codetracer-python-recorder/src/runtime/frame_inspector.rs: 
codetracer-python-recorder/src/runtime/mod.rs: 
codetracer-python-recorder/src/runtime/thread_snapshots.rs: 
codetracer-python-recorder/src/runtime/trace_writer_host.rs: 
codetracer-python-recorder/src/session.rs: 
design-docs/capture-output-implementation-plan.status.md: 

Signed-off-by: Tzanko Matev <[email protected]>
@tzanko-matev tzanko-matev changed the base branch from main to errors-and-logging October 3, 2025 15:18
Copy link

github-actions bot commented Oct 3, 2025

Coverage Summary

Rust (lines)
76.9% covered (3,705 / 4,818 | 1,113 missed)

File Lines Miss Cover
codetracer-python-recorder/crates/recorder-errors/src/lib.rs 157 7 95.5%
codetracer-python-recorder/src/code_object.rs 117 16 86.3%
codetracer-python-recorder/src/ffi.rs 191 19 90.1%
codetracer-python-recorder/src/lib.rs 15 15 0.0%
codetracer-python-recorder/src/logging.rs 478 80 83.3%
codetracer-python-recorder/src/monitoring/tracer.rs 794 221 72.2%
codetracer-python-recorder/src/policy.rs 240 48 80.0%
codetracer-python-recorder/src/runtime/activation.rs 117 9 92.3%
codetracer-python-recorder/src/runtime/frame_inspector.rs 148 63 57.4%
codetracer-python-recorder/src/runtime/io_capture/mod.rs 275 96 65.1%
codetracer-python-recorder/src/runtime/io_capture/unix.rs 273 86 68.5%
codetracer-python-recorder/src/runtime/logging.rs 15 4 73.3%
codetracer-python-recorder/src/runtime/mod.rs 1,214 186 84.7%
codetracer-python-recorder/src/runtime/output_paths.rs 98 16 83.7%
codetracer-python-recorder/src/runtime/thread_snapshots.rs 39 7 82.1%
codetracer-python-recorder/src/runtime/trace_writer_host.rs 72 27 62.5%
codetracer-python-recorder/src/runtime/value_capture.rs 102 66 35.3%
codetracer-python-recorder/src/runtime/value_encoder.rs 88 6 93.2%
codetracer-python-recorder/src/session.rs 118 118 0.0%
codetracer-python-recorder/src/session/bootstrap.rs 183 14 92.3%
Showing top 20 entries by missed lines (of 21 total).

Python (statements)
61.5% covered (112 / 182 | 70 missed)

File Stmts Miss Cover
codetracer-python-recorder/codetracer_python_recorder/__init__.py 7 0 100.0%
codetracer-python-recorder/codetracer_python_recorder/__main__.py 59 59 0.0%
codetracer-python-recorder/codetracer_python_recorder/api.py 5 0 100.0%
codetracer-python-recorder/codetracer_python_recorder/auto_start.py 22 9 59.1%
codetracer-python-recorder/codetracer_python_recorder/formats.py 13 1 92.3%
codetracer-python-recorder/codetracer_python_recorder/session.py 76 1 98.7%

Generated automatically via generate_coverage_comment.py.

@alehander92
Copy link
Member

alehander92 commented Oct 3, 2025

very impressive: but a radical approach: can't we somehow monkey patch the internal place/code that produces the writes? maybe this approach covers more fully/cleanly some cases, but it still seems a bit heavier

on the other hand: not critical, maybe for the future, but to check the current approach: what about file/other kind of events(in the future: network and others?) wouldn't we need something different for them, or would a similar approach be possible

@tzanko-matev
Copy link
Contributor Author

tzanko-matev commented Oct 3, 2025

I don't think that we can monkeypatch. We would need to detect all calls to C functions which deal with IO. But what if they are not from the standard library? For example our Rust module can produce logging statements which such an approach cannot handle.

Here we just redirect the in, out and error streams and we capture everything that we see.

It is possible to be even more ambitious on Linux using BPF. We can hook to the read and write syscalls. This means that we can map IO to which thread caused it. I am working on a prototype POC to test this approach as well.

@alehander92
Copy link
Member

ok, i have to try to understand it in more detail: will try to see/or ask next week; bpf sounds interesting, maybe it can help with the general case of IO events, but still not sure if we can match them to the actual step in the general case(and here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants