Compare commits

...

2 commits

Author SHA1 Message Date
a4b5f734cb
refactor(cargo): move deps to workspace
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2024-11-30 00:16:59 +01:00
b931dac9f5
chore: cleanup 2024-11-29 23:40:49 +01:00
5 changed files with 37 additions and 40 deletions

22
Cargo.lock generated
View file

@ -1109,22 +1109,6 @@ dependencies = [
"tracing-subscriber",
]
[[package]]
name = "opentelemetry-http"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a8a7f5f6ba7c1b286c2fbca0454eaba116f63bbe69ed250b642d36fbb04d80"
dependencies = [
"async-trait",
"bytes",
"http",
"http-body-util",
"hyper",
"hyper-util",
"opentelemetry",
"tokio",
]
[[package]]
name = "opentelemetry-otlp"
version = "0.27.0"
@ -1135,7 +1119,6 @@ dependencies = [
"futures-core",
"http",
"opentelemetry",
"opentelemetry-http",
"opentelemetry-proto",
"opentelemetry_sdk",
"prost",
@ -1182,16 +1165,15 @@ dependencies = [
[[package]]
name = "opentelemetry_sdk"
version = "0.27.0"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b742c1cae4693792cc564e58d75a2a0ba29421a34a85b50da92efa89ecb2bc"
checksum = "231e9d6ceef9b0b2546ddf52335785ce41252bc7474ee8ba05bfad277be13ab8"
dependencies = [
"async-trait",
"futures-channel",
"futures-executor",
"futures-util",
"glob",
"once_cell",
"opentelemetry",
"percent-encoding",
"rand",

View file

@ -22,13 +22,22 @@ clap = { version = "4.5.21", features = [
] }
dropshot = "0.13.0"
http = "1.1.0"
once_cell = "1.20.2"
opentelemetry = "0.27.0"
opentelemetry-appender-tracing = { version = "0.27.0", features = ["log", "experimental_metadata_attributes"] }
opentelemetry-otlp = { version = "0.27.0", features = ["grpc-tonic", "trace"] }
opentelemetry_sdk = { version = "0.27.1", features = ["metrics", "rt-tokio"] }
opentelemetry-semantic-conventions = "0.27.0"
opentelemetry-stdout = "0.27.0"
schemars = "0.8.21"
serde = "1.0.215"
slog = "2.7.0"
slog-async = "2.8.0"
tokio = { version = "1.41.1", features = ["full"] }
tracing = "0.1.40"
tracing-core = "0.1.33"
tracing-chrome = "0.7.2"
tracing-opentelemetry = "0.28.0"
tracing-slog = { git = "https://github.com/oxidecomputer/tracing-slog", default-features = false }
tracing-subscriber = { version = "0.3.18", default-features = false, features = [
"std",

View file

@ -10,24 +10,24 @@ anyhow.workspace = true
clap.workspace = true
dropshot.workspace = true
http.workspace = true
once_cell.workspace = true
opentelemetry-appender-tracing.workspace = true
opentelemetry-otlp.workspace = true
opentelemetry_sdk.workspace = true
opentelemetry-semantic-conventions.workspace = true
opentelemetry-stdout.workspace = true
opentelemetry.workspace = true
schemars.workspace = true
serde.workspace = true
slog.workspace = true
slog-async.workspace = true
slog.workspace = true
tokio.workspace = true
tracing-chrome.workspace = true
tracing-core.workspace = true
tracing-opentelemetry.workspace = true
tracing-slog.workspace = true
tracing-subscriber.workspace = true
tracing.workspace = true
tracing-slog.workspace = true
tracing-opentelemetry = "0.28.0"
opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.27.0", features = ["http-proto", "hyper-client", "opentelemetry-http", "trace"] }
opentelemetry = "0.27.0"
opentelemetry-semantic-conventions = "0.27.0"
tracing-core = "0.1.33"
opentelemetry-appender-tracing = { version = "0.27.0", features = ["log", "experimental_metadata_attributes"] }
opentelemetry-stdout = "0.27.0"
once_cell = "1.20.2"
[[bin]]
name = "patagia-controller"

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();