Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all outdated dependencies #44 #52

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
hyper = { version = "0.14.28", features = ["full"] }
tokio = { version = "1.36.0", features = ["full"] }
tonic = "0.11.0"
tonic-reflection = "0.11.0"
hyper = { version = "0.14.39", features = ["full"] }
tokio = { version = "1.42.0", features = ["full"] }
tonic = "0.14.0"
tonic-reflection = "0.14.0"
prost = "0.12.3"
prost-types = "0.12.3"
tower = "0.4.13"
hyper-util = { version = "0.1.3", features = ["tokio"] }
http-body-util = "0.1.0"
anyhow = "1.0.82"
once_cell = "1.19.0"
tonic-tracing-opentelemetry = "0.18.1"
opentelemetry = { version = "0.22.0", features = ["trace"] }
opentelemetry_sdk = { version = "0.22.1", features = ["trace", "rt-tokio"] }
opentelemetry-semantic-conventions = "0.14.0"
opentelemetry-http = "0.11.0"
opentelemetry-otlp = { version = "0.15.0", features = [
tonic-tracing-opentelemetry = "0.20.0"
opentelemetry = { version = "0.28.0", features = ["trace"] }
opentelemetry_sdk = { version = "0.28.0", features = ["trace", "rt-tokio"] }
opentelemetry-semantic-conventions = "0.24.0"
opentelemetry-http = "0.14.0"
opentelemetry-otlp = { version = "0.19.0", features = [
"trace",
# required to make grpc requests
"tls-roots",
"tls",
] }
tracing = "0.1.40"
tracing-opentelemetry = "0.23.0"
tracing-subscriber = "0.3.18"
tracing-subscriber = "0.5.0"
shuttle-runtime = "0.49.0"
shuttle-axum = "0.39.0"
async-trait = "0.1"
shuttle-axum = "0.49.0"
async-trait = "0.1.66"

[build-dependencies]
gh-workflow = "0.5.1"
tonic-build = "0.11.0"
tonic-build = "0.14.0"

[dev-dependencies]
gh-workflow = "0.5.1"
29 changes: 12 additions & 17 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ use once_cell::sync::Lazy;
use opentelemetry::{global, trace::TraceError, trace::TracerProvider, KeyValue};
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{propagation::TraceContextPropagator, runtime, Resource};
use tonic::{metadata::MetadataMap, transport::Server as TonicServer, Response, Status};
use tonic_tracing_opentelemetry::middleware::server;
use tower::make::Shared;
use tonic::{metadata::MetadataMap, response::Response, Status, server::Server};
use tonic_tracing_opentelemetry::layer::OtelGrpcLayer;

use news::news_service_server::NewsService;
use news::news_service_server::NewsServiceServer;
Expand Down Expand Up @@ -210,7 +209,6 @@ fn init_tracer() -> Result<()> {
let subscriber = tracing_subscriber::registry().with(trace_layer);

tracing::subscriber::set_global_default(subscriber)?;

global::set_tracer_provider(provider);

Ok(())
Expand All @@ -229,25 +227,22 @@ async fn shuttle_main() -> Result<impl Service, shuttle_runtime::Error> {

#[async_trait::async_trait]
impl Service for MyNewsService {
async fn bind(mut self, addr: std::net::SocketAddr) -> Result<(), shuttle_runtime::Error> {
let service = tonic_reflection::server::Builder::configure()
async fn bind(&mut self, addr: std::net::SocketAddr) -> Result<(), shuttle_runtime::Error> {
let reflection_service = tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(news::FILE_DESCRIPTOR_SET)
.build()
.unwrap();
.map_err(|e| shuttle_runtime::Error::Custom(anyhow::anyhow!(e)))?;

println!("NewsService server listening on {}", addr);

let tonic_service = TonicServer::builder()
.layer(server::OtelGrpcLayer::default())
.add_service(NewsServiceServer::new(self))
.add_service(service)
.into_service();
let make_svc = Shared::new(tonic_service);
let otel_layer = OtelGrpcLayer::new();
let server = Server::builder()
.layer(otel_layer)
.add_service(NewsServiceServer::new(self.clone()))
.add_service(reflection_service)
.serve(addr);

let server = hyper::Server::bind(&addr).serve(make_svc);
server
.await
.map_err(|e| shuttle_runtime::Error::Custom(anyhow::anyhow!(e)))?;
server.await.map_err(|e| shuttle_runtime::Error::Custom(anyhow::anyhow!(e)))?;

Ok(())
}
Expand Down
Loading