Skip to content

Commit

Permalink
Merge pull request #39 from rodneylab/build__update_dependencies
Browse files Browse the repository at this point in the history
build: 🧱 update crates
  • Loading branch information
rodneylab authored Nov 21, 2024
2 parents d7bde7c + 2d976b5 commit f7ccac5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
48 changes: 25 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ axum = "0.7.7"
dotenvy = "0.15.7"
metrics = "0.24"
metrics-exporter-prometheus = "0.16.0"
opentelemetry = "0.26.0"
opentelemetry-otlp = { version = "0.26.0", features = ["grpc-tonic"] }
opentelemetry-semantic-conventions = "0.26.0"
opentelemetry_sdk = { version = "0.26.0", features = ["rt-tokio"] }
opentelemetry = "0.27.0"
opentelemetry-otlp = { version = "0.27.0", features = ["grpc-tonic"] }
opentelemetry-semantic-conventions = "0.27.0"
opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio"] }
serde = { version = "1.0.210", features = ["derive"] }
sqlx = { version = "0.8.2", features = ["runtime-tokio-rustls", "sqlite"] }
tokio = { version = "1.40.1", features = ["full"] }
tower-http = { version = "0.6.2", features = ["compression-br", "compression-gzip", "fs", "timeout"] }
tracing = "0.1.40"
tracing-opentelemetry = "0.27.0"
tracing-opentelemetry = "0.28.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

[dev-dependencies]
Expand Down
34 changes: 16 additions & 18 deletions src/observability/tracing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;

use opentelemetry::{global, trace::TracerProvider, KeyValue};
use opentelemetry_otlp::{ExportConfig, Protocol, WithExportConfig};
use opentelemetry_otlp::{Protocol, WithExportConfig};
use opentelemetry_sdk::{
runtime,
trace::{RandomIdGenerator, Sampler, Tracer},
Expand Down Expand Up @@ -57,21 +57,20 @@ pub fn create_tracing_subscriber_from_env() {
}

fn init_tracer(config: OpenTelemetryConfig) -> Tracer {
let tracer_provider = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
opentelemetry_otlp::new_exporter()
.tonic()
.with_export_config(ExportConfig {
endpoint: format!(
"{}:{}",
config.opentelemetry_agent_host, config.opentelemetry_agent_port
),
timeout: std::time::Duration::from_secs(3),
protocol: Protocol::Grpc,
}),
)
.with_trace_config(
let exporter = opentelemetry_otlp::SpanExporter::builder()
.with_tonic()
.with_endpoint(format!(
"{}:{}",
config.opentelemetry_agent_host, config.opentelemetry_agent_port
))
.with_timeout(std::time::Duration::from_secs(3))
.with_protocol(Protocol::Grpc)
.build()
.expect("should be using a tokio runtime");

let tracer_provider = opentelemetry_sdk::trace::TracerProvider::builder()
.with_batch_exporter(exporter, runtime::Tokio)
.with_config(
opentelemetry_sdk::trace::Config::default()
.with_sampler(Sampler::AlwaysOn)
.with_id_generator(RandomIdGenerator::default())
Expand All @@ -80,8 +79,7 @@ fn init_tracer(config: OpenTelemetryConfig) -> Tracer {
config.tracing_service_name,
)])),
)
.install_batch(runtime::Tokio)
.expect("should be using a tokio runtime");
.build();

global::set_tracer_provider(tracer_provider.clone());
tracer_provider.tracer("axum-graphql")
Expand Down

0 comments on commit f7ccac5

Please sign in to comment.