style: prefer is_ok()

Co-authored-by: Edd Robinson <me@edd.io>
pull/24376/head
Dom 2020-12-11 11:57:49 +00:00
parent 2d29b985b4
commit 21110dc233
1 changed files with 12 additions and 13 deletions

View File

@ -249,21 +249,20 @@ fn setup_logging(num_verbose: u64) -> Option<opentelemetry_jaeger::Uninstall> {
// - OTEL_EXPORTER_JAEGER_AGENT_HOST: hostname/address of the collector
// - OTEL_EXPORTER_JAEGER_AGENT_PORT: listening port of the collector
//
let (opentelemetry, drop_handle) = match std::env::var("OTEL_EXPORTER_JAEGER_AGENT_HOST") {
Ok(_) => {
// Initialise the jaeger event emitter
let (tracer, drop_handle) = opentelemetry_jaeger::new_pipeline()
.with_service_name("iox")
.from_env()
.install()
.unwrap();
let (opentelemetry, drop_handle) = if std::env::var("OTEL_EXPORTER_JAEGER_AGENT_HOST").is_ok() {
// Initialise the jaeger event emitter
let (tracer, drop_handle) = opentelemetry_jaeger::new_pipeline()
.with_service_name("iox")
.from_env()
.install()
.unwrap();
// Initialise the opentelemetry tracing layer, giving it the jaeger emitter
let opentelemetry = tracing_opentelemetry::layer().with_tracer(tracer);
// Initialise the opentelemetry tracing layer, giving it the jaeger emitter
let opentelemetry = tracing_opentelemetry::layer().with_tracer(tracer);
(Some(opentelemetry), Some(drop_handle))
}
Err(_) => (None, None),
(Some(opentelemetry), Some(drop_handle))
} else {
(None, None)
};
// Configure the logger to write to stderr