MCPcopy Create free account
hub / github.com/hashintel/hash / init_global

Method init_global

libs/@local/telemetry/src/lib.rs:227–245  ·  view source on GitHub ↗

Initialize the telemetry setup. # Errors - [`InitTracingError`], if initializing the [`tracing_subscriber::Registry`] fails.

(self)

Source from the content-addressed store, hash-verified

225 ///
226 /// - [`InitTracingError`], if initializing the [`tracing_subscriber::Registry`] fails.
227 pub fn init_global(self) -> Result<impl Drop, Report<InitTracingError>> {
228 let (registry, guard) = self.build()?;
229
230 registry.try_init().change_context(InitTracingError)?;
231
232 // We have to wait until logging is initialized before we can print the warning.
233 if std::env::var("RUST_LOG").is_ok() {
234 if std::env::var("HASH_GRAPH_LOG_LEVEL").is_ok() {
235 warn!(
236 "`HASH_GRAPH_LOG_LEVEL` and `RUST_LOG` are set, `HASH_GRAPH_LOG_LEVEL` has \
237 been used to determine the logging level."
238 );
239 } else {
240 warn!("`RUST_LOG` is set, please use `HASH_GRAPH_LOG_LEVEL` instead");
241 }
242 }
243
244 Ok(guard)
245 }
246}
247
248struct TelemetryGuard<F> {

Callers 2

scenariosFunction · 0.80
init_tracingFunction · 0.80

Calls 4

OkInterface · 0.85
is_okMethod · 0.80
buildMethod · 0.45
change_contextMethod · 0.45

Tested by

no test coverage detected