diff options
author | Vincent Ambo <mail@tazj.in> | 2023-03-03T19·53+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-03-13T20·30+0000 |
commit | d9371c2f6f1293b44defcff95cad91c37dea65d1 (patch) | |
tree | e6333a35f70ef3e049ee41fcc97da934ab52f91d | |
parent | 19106cdaf09db818b56f9887c92fcf68ac2ec361 (diff) |
fix(tvix/eval): don't print full stack in observer r/5973
Print only the top 6 values of the stack, not the entire stack. There's very few operations that deal with more values anyways, so the rest are not likely to be useful. This gets us one step closer to tracing VERY large executions without blowing up. Change-Id: I97472321b0321b25d534d9f53b3aadfacc2318fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/8201 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
-rw-r--r-- | tvix/eval/src/observer.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/eval/src/observer.rs b/tvix/eval/src/observer.rs index 970a644a3d43..29e4fb2d9c06 100644 --- a/tvix/eval/src/observer.rs +++ b/tvix/eval/src/observer.rs @@ -166,7 +166,14 @@ impl<W: Write> TracingObserver<W> { fn write_stack(&mut self, stack: &[Value]) { let _ = write!(&mut self.writer, "[ "); - for val in stack { + // Print out a maximum of 6 values from the top of the stack, + // before abbreviating it to `...`. + for (i, val) in stack.iter().rev().enumerate() { + if i == 6 { + let _ = write!(&mut self.writer, "..."); + break; + } + self.write_value(&val); } |