chore: cleanup

This commit is contained in:
Daniel Lundin 2024-11-29 22:21:22 +01:00
parent 2da3a239cd
commit b931dac9f5
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
2 changed files with 15 additions and 9 deletions

View file

@ -7,6 +7,7 @@ use dropshot::{
use schemars::JsonSchema;
use serde::Serialize;
use slog::Drain;
use tracing::Instrument;
use tracing_slog::TracingSlogDrain;
use std::net::SocketAddr;
@ -49,7 +50,15 @@ async fn api_version(
version: env!("CARGO_PKG_VERSION").to_string(),
};
tracing::info!("Someone made a request to /version");
tracing::info_span!("Hello, span!");
async move {
tracing::info!("Someone made a request to /version");
tokio::time::sleep(std::time::Duration::from_millis(200)).await;
}
.instrument(tracing::info_span!("Let's do the thing...."))
.await;
Ok(HttpResponseOk(ver))
}

View file

@ -68,14 +68,11 @@ fn init_tracer_provider() -> Result<TracerProvider> {
.map_err(|e| anyhow!("Error creating OTLP span exporter: {:?}", e))?;
let tracer_provider = opentelemetry_sdk::trace::TracerProvider::builder()
.with_config(
opentelemetry_sdk::trace::Config::default()
.with_sampler(Sampler::ParentBased(Box::new(Sampler::TraceIdRatioBased(
1.0,
))))
.with_id_generator(RandomIdGenerator::default())
.with_resource(RESOURCE.clone()),
)
.with_sampler(Sampler::ParentBased(Box::new(Sampler::TraceIdRatioBased(
1.0,
))))
.with_resource(RESOURCE.clone())
.with_id_generator(RandomIdGenerator::default())
.with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio)
.build();