Skip to content

Commit 5f6faa2

Browse files
dnaka91hds
andauthored
update(api,subscriber)!: upgrade tonic to 0.12 (#571)
Update all dependencies on `tonic` and `tonic-build` to v0.12, along with the related `prost`, `prost-types` and `prost-build` crates to v0.13.1. BREAKING CHANGE: This is a breaking change for users of `console-api` and `console-subscriber`, as it changes the public `tonic`, `prost` and `prost-types` dependency to a semver-incompatible version. This breaks compatibility with `tonic` 0.11.x as well as `prost`/`prost-types` 0.12.x. Co-authored-by: Hayden Stainsby <[email protected]>
1 parent b01631a commit 5f6faa2

15 files changed

+171
-177
lines changed

Diff for: Cargo.lock

+107-97
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: console-api/Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ keywords = [
2929
transport = ["tonic/transport"]
3030

3131
[dependencies]
32-
tonic = { version = "0.11", default-features = false, features = [
32+
tonic = { version = "0.12", default-features = false, features = [
3333
"prost",
3434
"codegen",
3535
"transport",
3636
] }
37-
prost = "0.12"
38-
prost-types = "0.12"
37+
prost = "0.13.1"
38+
prost-types = "0.13.1"
3939
tracing-core = "0.1.17"
4040
futures-core = "0.3"
4141

4242
[dev-dependencies]
43-
tonic-build = { version = "0.11", default-features = false, features = [
43+
tonic-build = { version = "0.12", default-features = false, features = [
4444
"prost", "transport"
4545
] }
4646
# explicit dep so we can get the version with fixed whitespace.
47-
prost-build = "0.12.0"
47+
prost-build = "0.13.1"
4848

4949
[package.metadata.docs.rs]
5050
all-features = true

Diff for: console-api/src/common.rs

-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ impl From<Id> for u64 {
236236
}
237237
}
238238

239-
impl Copy for Id {}
240-
241239
impl From<tracing_core::span::Id> for Id {
242240
fn from(id: tracing_core::span::Id) -> Self {
243241
Id { id: id.into_u64() }

Diff for: console-api/src/generated/rs.tokio.console.async_ops.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is @generated by prost-build.
12
/// An `AsyncOp` state update.
23
///
34
/// This includes a list of any new async ops, and updates to the associated statistics

Diff for: console-api/src/generated/rs.tokio.console.common.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
// This file is @generated by prost-build.
12
/// Unique identifier for each task.
23
#[allow(clippy::derive_partial_eq_without_eq)]
3-
#[derive(Clone, PartialEq, ::prost::Message)]
4+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
45
pub struct Id {
56
/// The unique identifier's concrete value.
67
#[prost(uint64, tag = "1")]
@@ -25,15 +26,15 @@ pub struct Location {
2526
}
2627
/// Unique identifier for metadata.
2728
#[allow(clippy::derive_partial_eq_without_eq)]
28-
#[derive(Clone, PartialEq, ::prost::Message)]
29+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
2930
pub struct MetaId {
3031
/// The unique identifier's concrete value.
3132
#[prost(uint64, tag = "1")]
3233
pub id: u64,
3334
}
3435
/// Unique identifier for spans.
3536
#[allow(clippy::derive_partial_eq_without_eq)]
36-
#[derive(Clone, PartialEq, ::prost::Message)]
37+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3738
pub struct SpanId {
3839
/// The unique identifier's concrete value.
3940
#[prost(uint64, tag = "1")]
@@ -273,7 +274,7 @@ pub mod metadata {
273274
/// - tasks that have been spawned
274275
/// - async operations on resources that are performed within the context of a task
275276
#[allow(clippy::derive_partial_eq_without_eq)]
276-
#[derive(Clone, PartialEq, ::prost::Message)]
277+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
277278
pub struct PollStats {
278279
/// The total number of times this object has been polled.
279280
#[prost(uint64, tag = "1")]

Diff for: console-api/src/generated/rs.tokio.console.instrument.rs

+13-26
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1+
// This file is @generated by prost-build.
12
/// InstrumentRequest requests the stream of updates
23
/// to observe the async runtime state over time.
34
///
45
/// TODO: In the future allow for the request to specify
56
/// only the data that the caller cares about (i.e. only
67
/// tasks but no resources)
78
#[allow(clippy::derive_partial_eq_without_eq)]
8-
#[derive(Clone, PartialEq, ::prost::Message)]
9+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
910
pub struct InstrumentRequest {}
1011
/// TaskDetailsRequest requests the stream of updates about
1112
/// the specific task identified in the request.
1213
#[allow(clippy::derive_partial_eq_without_eq)]
13-
#[derive(Clone, PartialEq, ::prost::Message)]
14+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1415
pub struct TaskDetailsRequest {
1516
/// Identifies the task for which details were requested.
1617
#[prost(message, optional, tag = "1")]
1718
pub id: ::core::option::Option<super::common::Id>,
1819
}
1920
/// PauseRequest requests the stream of updates to pause.
2021
#[allow(clippy::derive_partial_eq_without_eq)]
21-
#[derive(Clone, PartialEq, ::prost::Message)]
22+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
2223
pub struct PauseRequest {}
2324
/// ResumeRequest requests the stream of updates to resume after a pause.
2425
#[allow(clippy::derive_partial_eq_without_eq)]
25-
#[derive(Clone, PartialEq, ::prost::Message)]
26+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
2627
pub struct ResumeRequest {}
2728
/// Update carries all information regarding tasks, resources, async operations
2829
/// and resource operations in one message. There are a couple of reasons to combine all
@@ -56,11 +57,11 @@ pub struct Update {
5657
}
5758
/// `PauseResponse` is the value returned after a pause request.
5859
#[allow(clippy::derive_partial_eq_without_eq)]
59-
#[derive(Clone, PartialEq, ::prost::Message)]
60+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6061
pub struct PauseResponse {}
6162
/// `ResumeResponse` is the value returned after a resume request.
6263
#[allow(clippy::derive_partial_eq_without_eq)]
63-
#[derive(Clone, PartialEq, ::prost::Message)]
64+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6465
pub struct ResumeResponse {}
6566
/// Generated client implementations.
6667
pub mod instrument_client {
@@ -314,19 +315,17 @@ pub mod instrument_server {
314315
/// `InstrumentServer<T>` implements `Instrument` as a service.
315316
#[derive(Debug)]
316317
pub struct InstrumentServer<T: Instrument> {
317-
inner: _Inner<T>,
318+
inner: Arc<T>,
318319
accept_compression_encodings: EnabledCompressionEncodings,
319320
send_compression_encodings: EnabledCompressionEncodings,
320321
max_decoding_message_size: Option<usize>,
321322
max_encoding_message_size: Option<usize>,
322323
}
323-
struct _Inner<T>(Arc<T>);
324324
impl<T: Instrument> InstrumentServer<T> {
325325
pub fn new(inner: T) -> Self {
326326
Self::from_arc(Arc::new(inner))
327327
}
328328
pub fn from_arc(inner: Arc<T>) -> Self {
329-
let inner = _Inner(inner);
330329
Self {
331330
inner,
332331
accept_compression_encodings: Default::default(),
@@ -389,7 +388,6 @@ pub mod instrument_server {
389388
Poll::Ready(Ok(()))
390389
}
391390
fn call(&mut self, req: http::Request<B>) -> Self::Future {
392-
let inner = self.inner.clone();
393391
match req.uri().path() {
394392
"/rs.tokio.console.instrument.Instrument/WatchUpdates" => {
395393
#[allow(non_camel_case_types)]
@@ -421,7 +419,6 @@ pub mod instrument_server {
421419
let max_encoding_message_size = self.max_encoding_message_size;
422420
let inner = self.inner.clone();
423421
let fut = async move {
424-
let inner = inner.0;
425422
let method = WatchUpdatesSvc(inner);
426423
let codec = tonic::codec::ProstCodec::default();
427424
let mut grpc = tonic::server::Grpc::new(codec)
@@ -468,7 +465,6 @@ pub mod instrument_server {
468465
let max_encoding_message_size = self.max_encoding_message_size;
469466
let inner = self.inner.clone();
470467
let fut = async move {
471-
let inner = inner.0;
472468
let method = WatchTaskDetailsSvc(inner);
473469
let codec = tonic::codec::ProstCodec::default();
474470
let mut grpc = tonic::server::Grpc::new(codec)
@@ -512,7 +508,6 @@ pub mod instrument_server {
512508
let max_encoding_message_size = self.max_encoding_message_size;
513509
let inner = self.inner.clone();
514510
let fut = async move {
515-
let inner = inner.0;
516511
let method = PauseSvc(inner);
517512
let codec = tonic::codec::ProstCodec::default();
518513
let mut grpc = tonic::server::Grpc::new(codec)
@@ -556,7 +551,6 @@ pub mod instrument_server {
556551
let max_encoding_message_size = self.max_encoding_message_size;
557552
let inner = self.inner.clone();
558553
let fut = async move {
559-
let inner = inner.0;
560554
let method = ResumeSvc(inner);
561555
let codec = tonic::codec::ProstCodec::default();
562556
let mut grpc = tonic::server::Grpc::new(codec)
@@ -578,8 +572,11 @@ pub mod instrument_server {
578572
Ok(
579573
http::Response::builder()
580574
.status(200)
581-
.header("grpc-status", "12")
582-
.header("content-type", "application/grpc")
575+
.header("grpc-status", tonic::Code::Unimplemented as i32)
576+
.header(
577+
http::header::CONTENT_TYPE,
578+
tonic::metadata::GRPC_CONTENT_TYPE,
579+
)
583580
.body(empty_body())
584581
.unwrap(),
585582
)
@@ -600,16 +597,6 @@ pub mod instrument_server {
600597
}
601598
}
602599
}
603-
impl<T: Instrument> Clone for _Inner<T> {
604-
fn clone(&self) -> Self {
605-
Self(Arc::clone(&self.0))
606-
}
607-
}
608-
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
609-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
610-
write!(f, "{:?}", self.0)
611-
}
612-
}
613600
impl<T: Instrument> tonic::server::NamedService for InstrumentServer<T> {
614601
const NAME: &'static str = "rs.tokio.console.instrument.Instrument";
615602
}

Diff for: console-api/src/generated/rs.tokio.console.resources.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is @generated by prost-build.
12
/// A resource state update.
23
///
34
/// Each `ResourceUpdate` contains any resource data that has changed since the last

Diff for: console-api/src/generated/rs.tokio.console.tasks.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is @generated by prost-build.
12
/// A task state update.
23
///
34
/// Each `TaskUpdate` contains any task data that has changed since the last
@@ -168,7 +169,7 @@ pub mod task {
168169
}
169170
/// Task performance statistics.
170171
#[allow(clippy::derive_partial_eq_without_eq)]
171-
#[derive(Clone, PartialEq, ::prost::Message)]
172+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
172173
pub struct Stats {
173174
/// Timestamp of when the task was spawned.
174175
#[prost(message, optional, tag = "1")]

Diff for: console-api/src/generated/rs.tokio.console.trace.rs

+10-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is @generated by prost-build.
12
/// Start watching trace events with the provided filter.
23
#[allow(clippy::derive_partial_eq_without_eq)]
34
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -26,7 +27,7 @@ pub mod trace_event {
2627
}
2728
/// `Enter` signals that a span was entered.
2829
#[allow(clippy::derive_partial_eq_without_eq)]
29-
#[derive(Clone, PartialEq, ::prost::Message)]
30+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3031
pub struct Enter {
3132
/// `span_id` identifies the span that was entered.
3233
#[prost(message, optional, tag = "1")]
@@ -40,7 +41,7 @@ pub mod trace_event {
4041
}
4142
/// `Exit` signals that a span was exited.
4243
#[allow(clippy::derive_partial_eq_without_eq)]
43-
#[derive(Clone, PartialEq, ::prost::Message)]
44+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4445
pub struct Exit {
4546
/// `span_id` identifies the span that was exited.
4647
#[prost(message, optional, tag = "1")]
@@ -54,7 +55,7 @@ pub mod trace_event {
5455
}
5556
/// `Close` signals that a span was closed.
5657
#[allow(clippy::derive_partial_eq_without_eq)]
57-
#[derive(Clone, PartialEq, ::prost::Message)]
58+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5859
pub struct Close {
5960
/// `span_id` identifies the span that was closed.
6061
#[prost(message, optional, tag = "1")]
@@ -223,19 +224,17 @@ pub mod trace_server {
223224
/// Allows observers to stream trace events for a given `WatchRequest` filter.
224225
#[derive(Debug)]
225226
pub struct TraceServer<T: Trace> {
226-
inner: _Inner<T>,
227+
inner: Arc<T>,
227228
accept_compression_encodings: EnabledCompressionEncodings,
228229
send_compression_encodings: EnabledCompressionEncodings,
229230
max_decoding_message_size: Option<usize>,
230231
max_encoding_message_size: Option<usize>,
231232
}
232-
struct _Inner<T>(Arc<T>);
233233
impl<T: Trace> TraceServer<T> {
234234
pub fn new(inner: T) -> Self {
235235
Self::from_arc(Arc::new(inner))
236236
}
237237
pub fn from_arc(inner: Arc<T>) -> Self {
238-
let inner = _Inner(inner);
239238
Self {
240239
inner,
241240
accept_compression_encodings: Default::default(),
@@ -298,7 +297,6 @@ pub mod trace_server {
298297
Poll::Ready(Ok(()))
299298
}
300299
fn call(&mut self, req: http::Request<B>) -> Self::Future {
301-
let inner = self.inner.clone();
302300
match req.uri().path() {
303301
"/rs.tokio.console.trace.Trace/Watch" => {
304302
#[allow(non_camel_case_types)]
@@ -330,7 +328,6 @@ pub mod trace_server {
330328
let max_encoding_message_size = self.max_encoding_message_size;
331329
let inner = self.inner.clone();
332330
let fut = async move {
333-
let inner = inner.0;
334331
let method = WatchSvc(inner);
335332
let codec = tonic::codec::ProstCodec::default();
336333
let mut grpc = tonic::server::Grpc::new(codec)
@@ -352,8 +349,11 @@ pub mod trace_server {
352349
Ok(
353350
http::Response::builder()
354351
.status(200)
355-
.header("grpc-status", "12")
356-
.header("content-type", "application/grpc")
352+
.header("grpc-status", tonic::Code::Unimplemented as i32)
353+
.header(
354+
http::header::CONTENT_TYPE,
355+
tonic::metadata::GRPC_CONTENT_TYPE,
356+
)
357357
.body(empty_body())
358358
.unwrap(),
359359
)
@@ -374,16 +374,6 @@ pub mod trace_server {
374374
}
375375
}
376376
}
377-
impl<T: Trace> Clone for _Inner<T> {
378-
fn clone(&self) -> Self {
379-
Self(Arc::clone(&self.0))
380-
}
381-
}
382-
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
383-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
384-
write!(f, "{:?}", self.0)
385-
}
386-
}
387377
impl<T: Trace> tonic::server::NamedService for TraceServer<T> {
388378
const NAME: &'static str = "rs.tokio.console.trace.Trace";
389379
}

Diff for: console-subscriber/Cargo.toml

+7-6
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,32 @@ tokio = { version = "^1.21", features = ["sync", "time", "macros", "tracing"] }
3636
tokio-stream = { version = "0.1", features = ["net"] }
3737
thread_local = "1.1.3"
3838
console-api = { version = "0.7.0", path = "../console-api", features = ["transport"] }
39-
tonic = { version = "0.11", features = ["transport"] }
39+
tonic = { version = "0.12", features = ["transport"] }
4040
tracing-core = "0.1.24"
4141
tracing = "0.1.26"
4242
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["fmt", "registry"] }
4343
futures-task = { version = "0.3", default-features = false }
4444
hdrhistogram = { version = "7.3.0", default-features = false, features = ["serialization"] }
4545
parking_lot = { version = "0.12", optional = true }
4646
humantime = "2.1.0"
47-
prost = "0.12"
48-
prost-types = "0.12.0"
47+
prost = "0.13.1"
48+
prost-types = "0.13.1"
49+
hyper-util = { version = "0.1.6", features = ["tokio"] }
4950

5051
# Required for recording:
5152
serde = { version = "1", features = ["derive"] }
5253
serde_json = "1"
5354
crossbeam-channel = "0.5"
5455

5556
# Only for the web feature:
56-
tonic-web = { version = "0.11", optional = true }
57+
tonic-web = { version = "0.12", optional = true }
5758

5859
[dev-dependencies]
5960
tokio = { version = "^1.21", features = ["full", "rt-multi-thread"] }
6061
tower = { version = "0.4", default-features = false }
6162
futures = "0.3"
62-
http = "0.2"
63-
tower-http = { version = "0.4", features = ["cors"] }
63+
http = "1.1"
64+
tower-http = { version = "0.5", features = ["cors"] }
6465

6566
[package.metadata.docs.rs]
6667
all-features = true

0 commit comments

Comments
 (0)