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

[ANE-1027] Reduce broker trace file size #146

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.3.2

Features:
- Simplify trace output to reduce trace file size

## v0.3.1

Features:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "broker"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "The bridge between FOSSA and internal DevOps services"
readme = "README.md"
Expand Down
1 change: 0 additions & 1 deletion src/api/remote/git/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ fn parse_ls_remote(output: String) -> Vec<Reference> {
.collect()
}

#[tracing::instrument]
fn line_to_git_ref(line: &str) -> Option<Reference> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing A LOT of traces. The function above (parse_ls_remote) calls this function for every single reference in the repo, and that can be a lot (tensorflow has 44,567 for example). I don't think we need a span created for each of these.

let mut parsed = line.split_whitespace();
let commit = parsed.next()?;
Expand Down
3 changes: 2 additions & 1 deletion src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ impl Config {
.with(
tracing_subscriber::fmt::layer()
.json()
.with_span_events(FmtSpan::FULL)
.flatten_event(true)
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, these are the span events we really care about. From the docs:

FmtSpan::NEW: An event will be synthesized when spans are created.
FmtSpan::ENTER: An event will be synthesized when spans are entered.
FmtSpan::EXIT: An event will be synthesized when spans are exited.
FmtSpan::CLOSE: An event will be synthesized when a span closes.

From my analysis, I noticed that ENTER is emitted way more often than it is actually called. For example, I know that the main function in broker::cmd::run is only called once. During one sample execution, a NEW event was understandably emitted only once, but ENTER was emitted 426 times. I suspect this is because a thread is constantly exiting and re-entering spans as it context-switches between different processes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is because a thread is constantly exiting and re-entering spans as it context-switches between different processes.

Correct!

IMO, these are the span events we really care about.

Good insight, I agree completely. Really, the "new" and "close" events are all we need for latency measures.

.with_writer(sink),
);

Expand Down
Loading