organic/src/init_tracing.rs
Tom Alexander 77de97703f
Remove all the old references to "toy language"
This is a relic from the early development days in this repo. When I first started this repo, it was a clean-slate playground to test ideas for solving the road blocks I hit with my previous attempt at an org-mode parser. To keep things simple, I originally only had a very basic set of syntax rules that only vaguely looked similar to org-mode. Once I had things figured out, I kept developing in this repo, morphing it into a full org-mode parser. A couple of references to those early days still remained, and this patch should get rid of the last of them.
2023-08-10 18:52:57 -04:00

35 lines
1.1 KiB
Rust

use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
// use tracing_subscriber::EnvFilter;
pub fn init_telemetry() -> Result<(), Box<dyn std::error::Error>> {
// let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("warn"));
// let stdout = tracing_subscriber::fmt::Layer::new()
// .pretty()
// .with_file(true)
// .with_line_number(true)
// .with_thread_ids(false)
// .with_target(false);
opentelemetry::global::set_text_map_propagator(opentelemetry_jaeger::Propagator::new());
let tracer = opentelemetry_jaeger::new_pipeline()
.with_service_name("organic")
.install_simple()?;
let opentelemetry = tracing_opentelemetry::layer().with_tracer(tracer);
tracing_subscriber::registry()
// .with(env_filter)
.with(opentelemetry)
// .with(stdout)
.try_init()?;
Ok(())
}
pub fn shutdown_telemetry() -> Result<(), Box<dyn std::error::Error>> {
opentelemetry::global::shutdown_tracer_provider();
Ok(())
}