Skip to content

Commit 09df7ba

Browse files
bryangarzahawkw
andcommitted
opentelemetry: add more comments to example (#2140)
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 <[email protected]>
1 parent cf98b73 commit 09df7ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/examples/opentelemetry.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
3838

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

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

4548
Ok(())

0 commit comments

Comments
 (0)