-
I have (anonymized) span data that looks like this:
These functions ( Is there a way to do this? I'm using Thanks in advance for any help! ❤️ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Unfortunately, there isn't really a way to do this automatically that doesn't introduce undesirable overhead --- something like storing all span fields in a hashmap so that we can skip formatting duplicates would have an unacceptable performance cost. When I have a nested call stack of functions that are all instrumented, I've occasionally factored out a private version of the shared code that isn't instrumented, to avoid duplicate spans. For example, this: #[instrument]
pub fn do_thing_with_stuff(thing: Thing, stuff: Stuff) {
do_thing(thing)
// ...
}
#[instrument]
pub fn do_thing(thing: Thing) {
// ...
} might become this: #[instrument]
pub fn do_thing_with_stuff(thing: Thing, stuff: Stuff) {
do_thing_inner(thing)
// ...
}
#[instrument]
pub fn do_thing(thing: Thing) {
do_thing_inner(thing)
}
fn do_thing_inner(thing: Thing) {
// ...
} to avoid formatting |
Beta Was this translation helpful? Give feedback.
Unfortunately, there isn't really a way to do this automatically that doesn't introduce undesirable overhead --- something like storing all span fields in a hashmap so that we can skip formatting duplicates would have an unacceptable performance cost. When I have a nested call stack of functions that are all instrumented, I've occasionally factored out a private version of the shared code that isn't instrumented, to avoid duplicate spans.
For example, this:
might become this: