generated from Patagia/template-nix
chore: cleanup
This commit is contained in:
parent
2da3a239cd
commit
b931dac9f5
2 changed files with 15 additions and 9 deletions
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue