Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
ezyang committed Apr 22, 2024
1 parent 03c81d5 commit 571103c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
))?;

let mut stack_trie = StackTrieNode::default();
let mut unknown_stack_trie = StackTrieNode::default();

let mut stats = Stats::default();
let _mod_count: FxHashMap<String, i32> = FxHashMap::default();
Expand Down Expand Up @@ -203,6 +204,10 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
}
}

if let Some(stack) = e.stack {
unknown_stack_trie.insert(stack, "*".to_string());
}

if let Some(m) = e.compilation_metrics {
let compile_id_dir: PathBuf = e
.compile_id
Expand Down Expand Up @@ -276,6 +281,8 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
.map(|(x, y)| (x.map_or("(unknown)".to_string(), |e| e.to_string()), y))
.collect(),
stack_trie_html: stack_trie.to_string(),
unknown_stack_trie_html: unknown_stack_trie.to_string(),
has_unknown_stack_trie: !unknown_stack_trie.is_empty(),
num_breaks: breaks.failures.len(),
};
output.push((
Expand Down
11 changes: 11 additions & 0 deletions src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ Build products below:
{{ endfor }}
</ul>
</div>
{{ if has_unknown_stack_trie }}
<div>
<h2>Unknown stacks</h2>
<p>
Sometimes, logs are made without a compile id. This makes it difficult to correlate related
logs. This stack trie shows all places where log entries occurred without compile context; to
fix, look an appropriate place in the stack where compile id should have been specified.
</p>
{unknown_stack_trie_html | format_unescaped}
</div>
{{ endif }}
</body>
</html>
"#;
Expand Down
7 changes: 7 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl StackTrieNode {
cur.terminal.push(compile_id);
}

pub fn is_empty(&self) -> bool {
return self.children.is_empty() && self.terminal.is_empty();
}

pub fn fmt_inner(&self, f: &mut Formatter, indent: usize) -> fmt::Result {
for (frame, node) in self.children.iter() {
let star = node.terminal.join("");
Expand Down Expand Up @@ -267,6 +271,7 @@ pub struct Envelope {
pub compile_id: Option<CompileId>,
#[serde(default)]
pub has_payload: Option<String>,
pub stack: Option<StackSummary>,
// externally tagged union, one field per log type we recognize
pub dynamo_start: Option<DynamoStartMetadata>,
pub str: Option<(String, u32)>,
Expand Down Expand Up @@ -301,5 +306,7 @@ pub struct IndexContext {
pub css: &'static str,
pub directory: Vec<(String, Vec<PathBuf>)>,
pub stack_trie_html: String,
pub unknown_stack_trie_html: String,
pub has_unknown_stack_trie: bool,
pub num_breaks: usize,
}

0 comments on commit 571103c

Please sign in to comment.