From 388fff8371fef1ec0f75bc495fe1ad4cfa045f7b Mon Sep 17 00:00:00 2001 From: Bryan Garza <1396101+bryangarza@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:53:01 -0700 Subject: [PATCH] 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 --- examples/examples/opentelemetry.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/examples/opentelemetry.rs b/examples/examples/opentelemetry.rs index eb28b32d..af7661d2 100644 --- a/examples/examples/opentelemetry.rs +++ b/examples/examples/opentelemetry.rs @@ -38,8 +38,11 @@ fn main() -> Result<(), Box> { 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(())