python / python/cpython

Collect timestamps on most exceptions for optional display on tracebacks.

Open
#132,502 3 comments 0 reactions 1 assignee View on GitHub

@gpshead is already working on this.

Since Apr 14, 2025.

interpreter-core type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Proposal:

Why? to make debugging what happened in async servers with lots of exception groups and exceptions easier. Event timestamps reported on everything when emitting exception groups containing tracebacks often with their own nested causes would allow some semblance of order to be more readily understood and correlated with other parts of the distributed system.

Semi related to the rationale behind https://peps.python.org/pep-0785/ to make events in exception groups easier - when you've got an error report involving exception groups, potentially nested from async sources, reading that to understand what happened when is hard. But with timestamps on the exceptions rendered with the tracebacks you can better understand the ordering of events.

I've got a working implementation over in a PR 129337. It's time to file the tracking issue and polish things up for discussion.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-129337

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.