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

Upgrade tonic, prost, otel to latest #782

Merged
merged 5 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ license-file = "LICENSE.txt"
derive_builder = "0.20"
derive_more = { version = "0.99", default-features = false, features = ["constructor", "display", "from", "into"] }
once_cell = "1.16"
tonic = "0.11"
tonic-build = "0.11"
opentelemetry = { version = "0.23", features = ["metrics"] }
prost = "0.12"
prost-types = "0.12"
tonic = "0.12"
tonic-build = "0.12"
opentelemetry = { version = "0.24", features = ["metrics"] }
prost = "0.13"
prost-types = "0.13"

[workspace.lints.rust]
unreachable_pub = "warn"
6 changes: 4 additions & 2 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ derive_builder = { workspace = true }
derive_more = "0.99"
futures = "0.3"
futures-retry = "0.6.0"
http = "0.2"
hyper = { version = "0.14" }
http = "1.1.0"
http-body-util = "0.1"
hyper = { version = "1.4.1" }
hyper-util = "0.1.6"
once_cell = { workspace = true }
opentelemetry = { workspace = true, features = ["metrics"], optional = true }
parking_lot = "0.12"
Expand Down
2 changes: 1 addition & 1 deletion client/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub struct GrpcMetricSvc {
}

impl Service<http::Request<BoxBody>> for GrpcMetricSvc {
type Response = http::Response<tonic::transport::Body>;
type Response = http::Response<BoxBody>;
type Error = tonic::transport::Error;
type Future = BoxFuture<'static, Result<Self::Response, Self::Error>>;

Expand Down
10 changes: 7 additions & 3 deletions client/src/proxy.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use base64::prelude::*;
use http_body_util::Empty;
use hyper::body::Bytes;
use hyper::header;
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
use std::future::Future;
use std::pin::Pin;
use std::task::Context;
Expand Down Expand Up @@ -43,12 +46,13 @@ impl HttpConnectProxyOptions {
let creds = BASE64_STANDARD.encode(format!("{}:{}", user, pass));
req_build = req_build.header(header::PROXY_AUTHORIZATION, format!("Basic {}", creds));
}
let req = req_build.body(hyper::Body::empty())?;
let req = req_build.body(Empty::<Bytes>::new())?;

// We have to create a client with a specific connector because Hyper is
// not letting us change the HTTP/2 authority
let client =
hyper::Client::builder().build(OverrideAddrConnector(self.target_addr.clone()));
// let client = hyper::Client::builder().build(OverrideAddrConnector(self.target_addr.clone()));

let client = Client::builder(TokioExecutor::new()).build_http();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing using the OverrideAddrConnector, we'll need to make that work with the upgrade libs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh missed it, working on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like not as straightforward as before with hyper 1.x.
Took a first stab it. But needs more understanding.


// Send request
let res = client.request(req).await?;
Expand Down
2 changes: 1 addition & 1 deletion client/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ fn req_cloner<T: Clone>(cloneme: &Request<T>) -> Request<T> {
new_req
}

#[derive(Debug)]
#[derive(Clone, Debug)]
pub(super) struct AttachMetricLabels {
pub(super) labels: Vec<MetricKeyValue>,
}
Expand Down
10 changes: 5 additions & 5 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ephemeral-server = ["dep:flate2", "dep:reqwest", "dep:tar", "dep:zip"]
[dependencies]
anyhow = "1.0"
async-trait = "0.1"
console-subscriber = { version = "0.3", optional = true }
console-subscriber = { version = "0.4", optional = true }
crossbeam-channel = "0.5"
crossbeam-queue = "0.3"
crossbeam-utils = "0.8"
Expand All @@ -43,15 +43,15 @@ lru = "0.12"
mockall = "0.12"
once_cell = { workspace = true }
opentelemetry = { workspace = true, features = ["metrics"], optional = true }
opentelemetry_sdk = { version = "0.23", features = ["rt-tokio", "metrics"], optional = true }
opentelemetry-otlp = { version = "0.16", features = ["tokio", "metrics"], optional = true }
opentelemetry-prometheus = { version = "0.16", optional = true }
opentelemetry_sdk = { version = "0.24", features = ["rt-tokio", "metrics"], optional = true }
opentelemetry-otlp = { version = "0.17", features = ["tokio", "metrics"], optional = true }
opentelemetry-prometheus = { version = "0.17", optional = true }
parking_lot = { version = "0.12", features = ["send_guard"] }
pid = "4.0"
pin-project = "1.0"
prometheus = "0.13"
prost = { workspace = true }
prost-types = { version = "0.5", package = "prost-wkt-types" }
prost-types = { version = "0.6", package = "prost-wkt-types" }
rand = "0.8.3"
reqwest = { version = "0.12", features = ["json", "stream", "rustls-tls"], default-features = false, optional = true }
ringbuf = "0.4"
Expand Down
16 changes: 8 additions & 8 deletions core/src/telemetry/otel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::{
use crate::{abstractions::dbg_panic, telemetry::metrics::DEFAULT_S_BUCKETS};
use opentelemetry::{
self,
metrics::{Meter, MeterProvider as MeterProviderT, Unit},
metrics::{Meter, MeterProvider as MeterProviderT},
Key, KeyValue, Value,
};
use opentelemetry_otlp::WithExportConfig;
Expand All @@ -20,10 +20,10 @@ use opentelemetry_sdk::{
data::Temporality,
new_view,
reader::{AggregationSelector, DefaultAggregationSelector, TemporalitySelector},
Aggregation, Instrument, InstrumentKind, MeterProviderBuilder, PeriodicReader,
SdkMeterProvider, View,
Aggregation, AttributeSet, Instrument, InstrumentKind, MeterProviderBuilder,
PeriodicReader, SdkMeterProvider, View,
},
runtime, AttributeSet, Resource,
runtime, Resource,
};
use parking_lot::RwLock;
use std::{collections::HashMap, net::SocketAddr, sync::Arc, time::Duration};
Expand Down Expand Up @@ -117,7 +117,7 @@ macro_rules! impl_memory_gauge {
fn new(params: MetricParameters, meter: &Meter) -> Self {
let gauge = meter
.$gauge_fn(params.name)
.with_unit(Unit::new(params.unit))
.with_unit(params.unit)
.with_description(params.description)
.init();
let map = Arc::new(RwLock::new(HashMap::<AttributeSet, $ty>::new()));
Expand Down Expand Up @@ -251,7 +251,7 @@ impl CoreMeter for CoreOtelMeter {
Arc::new(
self.meter
.u64_counter(params.name)
.with_unit(Unit::new(params.unit))
.with_unit(params.unit)
.with_description(params.description)
.init(),
)
Expand All @@ -261,7 +261,7 @@ impl CoreMeter for CoreOtelMeter {
Arc::new(
self.meter
.u64_histogram(params.name)
.with_unit(Unit::new(params.unit))
.with_unit(params.unit)
.with_description(params.description)
.init(),
)
Expand All @@ -271,7 +271,7 @@ impl CoreMeter for CoreOtelMeter {
Arc::new(
self.meter
.f64_histogram(params.name)
.with_unit(Unit::new(params.unit))
.with_unit(params.unit)
.with_description(params.description)
.init(),
)
Expand Down
5 changes: 3 additions & 2 deletions sdk-core-protos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ categories = ["development-tools"]

[features]
history_builders = ["uuid", "rand"]
serde_serialize = []

[dependencies]
anyhow = "1.0"
base64 = "0.22"
derive_more = { workspace = true }
prost = { workspace = true }
prost-wkt = "0.5"
prost-wkt-types = "0.5"
prost-wkt = "0.6"
prost-wkt-types = "0.6"
rand = { version = "0.8", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ crossbeam-channel = "0.5"
derive_more = { workspace = true }
futures = "0.3"
parking_lot = { version = "0.12", features = ["send_guard"] }
prost-types = { version = "0.5", package = "prost-wkt-types" }
prost-types = { version = "0.6", package = "prost-wkt-types" }
serde = "1.0"
tokio = { version = "1.26", features = ["rt", "rt-multi-thread", "parking_lot", "time", "fs"] }
tokio-util = { version = "0.7" }
Expand Down
4 changes: 2 additions & 2 deletions tests/integ_tests/client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async fn per_call_timeout_respected_one_call() {
struct GenericService {
timeouts_tx: UnboundedSender<String>,
}
impl Service<tonic::codegen::http::Request<tonic::transport::Body>> for GenericService {
impl Service<tonic::codegen::http::Request<BoxBody>> for GenericService {
type Response = tonic::codegen::http::Response<BoxBody>;
type Error = Infallible;
type Future = BoxFuture<'static, Result<Self::Response, Self::Error>>;
Expand All @@ -95,7 +95,7 @@ impl Service<tonic::codegen::http::Request<tonic::transport::Body>> for GenericS
Poll::Ready(Ok(()))
}

fn call(&mut self, req: tonic::codegen::http::Request<tonic::transport::Body>) -> Self::Future {
fn call(&mut self, req: tonic::codegen::http::Request<BoxBody>) -> Self::Future {
self.timeouts_tx
.send(
String::from_utf8_lossy(req.headers().get("grpc-timeout").unwrap().as_bytes())
Expand Down
Loading