Skip to content

Commit

Permalink
opentelemetry: add more comments to example (#2140)
Browse files Browse the repository at this point in the history
This patch adds a bit more context around why we are creating a smaller
scope for the spans, and also what happens when we call
`global::shutdown_tracer_provider()` (that comment was copied from
the`rust-opentelemetry` repo).

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
bryangarza and hawkw authored Jun 6, 2022
1 parent 10da627 commit 388fff8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/examples/opentelemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {

warn!("About to exit!");
trace!("status: {}", work_result);
}
} // Once this scope is closed, all spans inside are closed as well

// Shut down the current tracer provider. This will invoke the shutdown
// method on all span processors. span processors should export remaining
// spans before return.
global::shutdown_tracer_provider();

Ok(())
Expand Down

0 comments on commit 388fff8

Please # to comment.