Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEN-186: Allow to send Report via network while keeping the frame stack structure #4693

Open
andylokandy opened this issue Jul 9, 2024 · 3 comments
Assignees
Labels
area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area) category/enhancement New feature or request lang/rust Pull requests that update Rust code

Comments

@andylokandy
Copy link

Related Problem

Context:
databendlabs/databend#15741 (comment)

Proposed Solution

Goal:
Provide a solution to send the error collected by a node to another node, and keep propagate the error in the receiver node, and finally pretty print the error frames as if it's all happen in a single stack frame.

Possible solution:
A frame stack is consist of several information: context type, location, the source error. The only thing in these three that prevent deserialization is the opaque context type. We can advance the formatting procedure, the default debug hook for Report, to serialize the context/attachements into strings/appendix, while keeping the frame structure and the location. At the final fmt procedure, the formatter should be able to recognise this special struct in frame and flatten the frames when rendering.

Alternatives

No response

Additional context

No response

@andylokandy andylokandy added area/libs Relates to first-party libraries/crates/packages (area) area/libs > error-stack Affects the `error-stack` crate (library) category/enhancement New feature or request lang/rust Pull requests that update Rust code labels Jul 9, 2024
@vilkinsons vilkinsons changed the title error-stack: Allow to send Report via network while keeping the frame stack structure GEN-186: Allow to send Report via network while keeping the frame stack structure Jul 12, 2024
@vilkinsons
Copy link
Member

Hi @andylokandy, thanks for opening this. We can see the potential value in keeping the frame structure in place when deserializing, even at the loss of type information. Is this something you'd be interested in having a stab at implementing?

@andylokandy
Copy link
Author

Thanks! I'm learning the codebase of error-stack recently, and I noticed that the main and hard part is the fmt module, which is a little bit challenging but I'll try to figure it out.

@indietyp
Copy link
Member

If you have any questions, I am happy to answer them! I know the fmt module is quite complex, and the code flow isn't ideal (something I hope to change soon™).

We have had attempts at more specialized serde serialization in #1558, but I haven't had any meaningful time to revisit them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area) category/enhancement New feature or request lang/rust Pull requests that update Rust code
Development

No branches or pull requests

4 participants