From 8c2ed45ed989976f0a478c442850fa1d6ee0698f Mon Sep 17 00:00:00 2001 From: noah Date: Sun, 4 Sep 2022 15:41:45 -0500 Subject: [PATCH] commit protobuf files --- .../generated/rs.tokio.console.async_ops.rs | 30 +-- .../src/generated/rs.tokio.console.common.rs | 102 +++---- .../generated/rs.tokio.console.instrument.rs | 254 +++++++++++------- .../generated/rs.tokio.console.resources.rs | 64 +++-- .../src/generated/rs.tokio.console.tasks.rs | 60 ++--- .../src/generated/rs.tokio.console.trace.rs | 136 ++++++---- 6 files changed, 360 insertions(+), 286 deletions(-) diff --git a/console-api/src/generated/rs.tokio.console.async_ops.rs b/console-api/src/generated/rs.tokio.console.async_ops.rs index f1cc4863b..fb2613540 100644 --- a/console-api/src/generated/rs.tokio.console.async_ops.rs +++ b/console-api/src/generated/rs.tokio.console.async_ops.rs @@ -1,4 +1,4 @@ -/// An `AsyncOp` state update. +/// An `AsyncOp` state update. /// /// This includes a list of any new async ops, and updates to the associated statistics /// for any async ops that have changed since the last update. @@ -8,10 +8,10 @@ pub struct AsyncOpUpdate { /// was sent. Note that the fact that an async operation has been created /// does not mean that is has been polled or is being polled. This information /// is reflected in the `Stats` of the operation. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub new_async_ops: ::prost::alloc::vec::Vec, /// Any async op stats that have changed since the last update. - #[prost(map = "uint64, message", tag = "2")] + #[prost(map="uint64, message", tag="2")] pub stats_update: ::std::collections::HashMap, /// A count of how many async op events (e.g. polls, creation, etc) were not /// recorded because the application's event buffer was at capacity. @@ -23,7 +23,7 @@ pub struct AsyncOpUpdate { /// /// If the application's instrumentation ensures reliable delivery of events, /// this will always be 0. - #[prost(uint64, tag = "3")] + #[prost(uint64, tag="3")] pub dropped_events: u64, } /// An async operation. @@ -31,24 +31,24 @@ pub struct AsyncOpUpdate { /// An async operation is an operation that is associated with a resource /// This could, for example, be a a read or write on a TCP stream, or a receive operation on /// a channel. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct AsyncOp { /// The async op's ID. /// /// This uniquely identifies this op across all *currently live* /// ones. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub id: ::core::option::Option, /// The numeric ID of the op's `Metadata`. /// /// This identifies the `Metadata` that describes the `tracing` span /// corresponding to this async op. The metadata for this ID will have been sent /// in a prior `RegisterMetadata` message. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub metadata: ::core::option::Option, /// The source of this async operation. Most commonly this should be the name /// of the method where the instantiation of this op has happened. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub source: ::prost::alloc::string::String, /// The ID of the parent async op. /// @@ -58,28 +58,28 @@ pub struct AsyncOp { /// /// This field can be empty; if it is empty, this async op is not a child of another /// async op. - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub parent_async_op_id: ::core::option::Option, /// The resources's ID. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub resource_id: ::core::option::Option, } /// Statistics associated with a given async operation. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the async op has been created. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, /// Timestamp of when the async op was dropped. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub dropped_at: ::core::option::Option<::prost_types::Timestamp>, /// The Id of the task that is awaiting on this op. - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub task_id: ::core::option::Option, /// Contains the operation poll stats. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub poll_stats: ::core::option::Option, /// State attributes of the async op. - #[prost(message, repeated, tag = "6")] + #[prost(message, repeated, tag="6")] pub attributes: ::prost::alloc::vec::Vec, } diff --git a/console-api/src/generated/rs.tokio.console.common.rs b/console-api/src/generated/rs.tokio.console.common.rs index b926891bb..d651148e3 100644 --- a/console-api/src/generated/rs.tokio.console.common.rs +++ b/console-api/src/generated/rs.tokio.console.common.rs @@ -1,157 +1,157 @@ /// Unique identifier for each task. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Id { /// The unique identifier's concrete value. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub id: u64, } /// A Rust source code location. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Location { /// The file path - #[prost(string, optional, tag = "1")] + #[prost(string, optional, tag="1")] pub file: ::core::option::Option<::prost::alloc::string::String>, /// The Rust module path - #[prost(string, optional, tag = "2")] + #[prost(string, optional, tag="2")] pub module_path: ::core::option::Option<::prost::alloc::string::String>, /// The line number in the source code file. - #[prost(uint32, optional, tag = "3")] + #[prost(uint32, optional, tag="3")] pub line: ::core::option::Option, /// The character in `line`. - #[prost(uint32, optional, tag = "4")] + #[prost(uint32, optional, tag="4")] pub column: ::core::option::Option, } /// Unique identifier for metadata. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct MetaId { /// The unique identifier's concrete value. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub id: u64, } /// Unique identifier for spans. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct SpanId { /// The unique identifier's concrete value. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub id: u64, } /// A message representing a key-value pair of data associated with a `Span` -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Field { /// Metadata for the task span that the field came from. - #[prost(message, optional, tag = "8")] + #[prost(message, optional, tag="8")] pub metadata_id: ::core::option::Option, /// The key of the key-value pair. /// - /// This is either represented as a string, or as an index into a `Metadata`'s + /// This is either represented as a string, or as an index into a `Metadata`'s /// array of field name strings. - #[prost(oneof = "field::Name", tags = "1, 2")] + #[prost(oneof="field::Name", tags="1, 2")] pub name: ::core::option::Option, /// The value of the key-value pair. - #[prost(oneof = "field::Value", tags = "3, 4, 5, 6, 7")] + #[prost(oneof="field::Value", tags="3, 4, 5, 6, 7")] pub value: ::core::option::Option, } /// Nested message and enum types in `Field`. pub mod field { /// The key of the key-value pair. /// - /// This is either represented as a string, or as an index into a `Metadata`'s + /// This is either represented as a string, or as an index into a `Metadata`'s /// array of field name strings. #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Name { /// The string representation of the name. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] StrName(::prost::alloc::string::String), /// An index position into the `Metadata.field_names` of the metadata /// for the task span that the field came from. - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] NameIdx(u64), } /// The value of the key-value pair. - #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Value { /// A value serialized to a string using `fmt::Debug`. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] DebugVal(::prost::alloc::string::String), /// A string value. - #[prost(string, tag = "4")] + #[prost(string, tag="4")] StrVal(::prost::alloc::string::String), /// An unsigned integer value. - #[prost(uint64, tag = "5")] + #[prost(uint64, tag="5")] U64Val(u64), /// A signed integer value. - #[prost(sint64, tag = "6")] + #[prost(sint64, tag="6")] I64Val(i64), /// A boolean value. - #[prost(bool, tag = "7")] + #[prost(bool, tag="7")] BoolVal(bool), } } /// Represents a period of time in which a program was executing in a particular context. /// /// Corresponds to `Span` in the `tracing` crate. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Span { /// An Id that uniquely identifies it in relation to other spans. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub id: ::core::option::Option, /// Identifier for metadata describing static characteristics of all spans originating /// from that callsite, such as its name, source code location, verbosity level, and /// the names of its fields. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub metadata_id: ::core::option::Option, /// User-defined key-value pairs of arbitrary data that describe the context the span represents, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub fields: ::prost::alloc::vec::Vec, /// Timestamp for the span. - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// Any new metadata that was registered since the last update. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterMetadata { /// The new metadata that was registered since the last update. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub metadata: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `RegisterMetadata`. pub mod register_metadata { /// One metadata element registered since the last update. - #[derive(Clone, Eq, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct NewMetadata { /// Unique identifier for `metadata`. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub id: ::core::option::Option, /// The metadata payload. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub metadata: ::core::option::Option, } } /// Metadata associated with a span or event. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Metadata { /// The name of the span or event. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, /// Describes the part of the system where the span or event that this /// metadata describes occurred. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub target: ::prost::alloc::string::String, /// The path to the Rust module where the span occurred. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub module_path: ::prost::alloc::string::String, /// The Rust source location associated with the span or event. - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub location: ::core::option::Option, /// Indicates whether metadata is associated with a span or with an event. - #[prost(enumeration = "metadata::Kind", tag = "5")] + #[prost(enumeration="metadata::Kind", tag="5")] pub kind: i32, /// Describes the level of verbosity of a span or event. - #[prost(enumeration = "metadata::Level", tag = "6")] + #[prost(enumeration="metadata::Level", tag="6")] pub level: i32, /// The names of the key-value fields attached to the /// span or event this metadata is associated with. - #[prost(string, repeated, tag = "7")] + #[prost(string, repeated, tag="7")] pub field_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Nested message and enum types in `Metadata`. @@ -225,7 +225,7 @@ pub mod metadata { #[derive(Clone, PartialEq, ::prost::Message)] pub struct PollStats { /// The total number of times this object has been polled. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub polls: u64, /// The timestamp of the first time this object was polled. /// @@ -233,7 +233,7 @@ pub struct PollStats { /// /// Subtracting this timestamp from `created_at` can be used to calculate the /// time to first poll for this object, a measurement of executor latency. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub first_poll: ::core::option::Option<::prost_types::Timestamp>, /// The timestamp of the most recent time this objects's poll method was invoked. /// @@ -242,7 +242,7 @@ pub struct PollStats { /// If the object has only been polled a single time, then this value may be /// equal to the `first_poll` timestamp. /// - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub last_poll_started: ::core::option::Option<::prost_types::Timestamp>, /// The timestamp of the most recent time this objects's poll method finished execution. /// @@ -250,14 +250,14 @@ pub struct PollStats { /// /// If the object does not exist anymore, then this is the time the final invocation of /// its poll method has completed. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub last_poll_ended: ::core::option::Option<::prost_types::Timestamp>, /// The total duration this object was being *actively polled*, summed across /// all polls. Note that this includes only polls that have completed and is /// not reflecting any inprogress polls. Subtracting `busy_time` from the /// total lifetime of the polled object results in the amount of time it /// has spent *waiting* to be polled. - #[prost(message, optional, tag = "6")] + #[prost(message, optional, tag="6")] pub busy_time: ::core::option::Option<::prost_types::Duration>, } /// State attributes of an entity. These are dependent on the type of the entity. @@ -267,13 +267,13 @@ pub struct PollStats { /// indicating how many permits they are trying to acquire vs how many are acquired. /// These values may change over time. Therefore, they live in the runtime stats rather /// than the static data describing the entity. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Attribute { /// The key-value pair for the attribute - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub field: ::core::option::Option, /// Some values carry a unit of measurement. For example, a duration /// carries an associated unit of time, such as "ms" for milliseconds. - #[prost(string, optional, tag = "2")] + #[prost(string, optional, tag="2")] pub unit: ::core::option::Option<::prost::alloc::string::String>, } diff --git a/console-api/src/generated/rs.tokio.console.instrument.rs b/console-api/src/generated/rs.tokio.console.instrument.rs index d8042291a..e39c9331c 100644 --- a/console-api/src/generated/rs.tokio.console.instrument.rs +++ b/console-api/src/generated/rs.tokio.console.instrument.rs @@ -4,22 +4,25 @@ /// TODO: In the future allow for the request to specify /// only the data that the caller cares about (i.e. only /// tasks but no resources) -#[derive(Clone, Eq, PartialEq, ::prost::Message)] -pub struct InstrumentRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InstrumentRequest { +} /// TaskDetailsRequest requests the stream of updates about /// the specific task identified in the request. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct TaskDetailsRequest { /// Identifies the task for which details were requested. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub id: ::core::option::Option, } /// PauseRequest requests the stream of updates to pause. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] -pub struct PauseRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PauseRequest { +} /// ResumeRequest requests the stream of updates to resume after a pause. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] -pub struct ResumeRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResumeRequest { +} /// Update carries all information regarding tasks, resources, async operations /// and resource operations in one message. There are a couple of reasons to combine all /// of these into a single message: @@ -34,32 +37,34 @@ pub struct Update { /// /// This is the timestamp any durations in the included `Stats` were /// calculated relative to. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub now: ::core::option::Option<::prost_types::Timestamp>, /// Task state update. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub task_update: ::core::option::Option, /// Resource state update. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub resource_update: ::core::option::Option, /// Async operations state update - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub async_op_update: ::core::option::Option, /// Any new span metadata that was registered since the last update. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub new_metadata: ::core::option::Option, } /// `PauseResponse` is the value returned after a pause request. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] -pub struct PauseResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PauseResponse { +} /// `ResumeResponse` is the value returned after a resume request. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] -pub struct ResumeResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResumeResponse { +} /// Generated client implementations. pub mod instrument_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::http::Uri; use tonic::codegen::*; + use tonic::codegen::http::Uri; /// `InstrumentServer` implements `Instrument` as a service. #[derive(Debug, Clone)] pub struct InstrumentClient { @@ -104,8 +109,9 @@ pub mod instrument_client { >::ResponseBody, >, >, - >>::Error: - Into + Send + Sync, + , + >>::Error: Into + Send + Sync, { InstrumentClient::new(InterceptedService::new(inner, interceptor)) } @@ -128,55 +134,64 @@ pub mod instrument_client { pub async fn watch_updates( &mut self, request: impl tonic::IntoRequest, - ) -> Result>, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + ) -> Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/WatchUpdates", ); - self.inner - .server_streaming(request.into_request(), path, codec) - .await + self.inner.server_streaming(request.into_request(), path, codec).await } /// Produces a stream of updates describing the activity of a specific task. pub async fn watch_task_details( &mut self, request: impl tonic::IntoRequest, ) -> Result< - tonic::Response>, - tonic::Status, - > { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/WatchTaskDetails", ); - self.inner - .server_streaming(request.into_request(), path, codec) - .await + self.inner.server_streaming(request.into_request(), path, codec).await } /// Registers that the console observer wants to pause the stream. pub async fn pause( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/Pause", @@ -188,12 +203,15 @@ pub mod instrument_client { &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/Resume", @@ -210,7 +228,9 @@ pub mod instrument_server { #[async_trait] pub trait Instrument: Send + Sync + 'static { ///Server streaming response type for the WatchUpdates method. - type WatchUpdatesStream: futures_core::Stream> + type WatchUpdatesStream: futures_core::Stream< + Item = Result, + > + Send + 'static; /// Produces a stream of updates representing the behavior of the instrumented async runtime. @@ -219,7 +239,9 @@ pub mod instrument_server { request: tonic::Request, ) -> Result, tonic::Status>; ///Server streaming response type for the WatchTaskDetails method. - type WatchTaskDetailsStream: futures_core::Stream> + type WatchTaskDetailsStream: futures_core::Stream< + Item = Result, + > + Send + 'static; /// Produces a stream of updates describing the activity of a specific task. @@ -258,7 +280,10 @@ pub mod instrument_server { send_compression_encodings: Default::default(), } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -286,7 +311,10 @@ pub mod instrument_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -295,20 +323,24 @@ pub mod instrument_server { "/rs.tokio.console.instrument.Instrument/WatchUpdates" => { #[allow(non_camel_case_types)] struct WatchUpdatesSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for WatchUpdatesSvc - { + impl< + T: Instrument, + > tonic::server::ServerStreamingService + for WatchUpdatesSvc { type Response = super::Update; type ResponseStream = T::WatchUpdatesStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { (*inner).watch_updates(request).await }; + let fut = async move { + (*inner).watch_updates(request).await + }; Box::pin(fut) } } @@ -319,10 +351,11 @@ pub mod instrument_server { let inner = inner.0; let method = WatchUpdatesSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.server_streaming(method, req).await; Ok(res) }; @@ -331,20 +364,24 @@ pub mod instrument_server { "/rs.tokio.console.instrument.Instrument/WatchTaskDetails" => { #[allow(non_camel_case_types)] struct WatchTaskDetailsSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for WatchTaskDetailsSvc - { + impl< + T: Instrument, + > tonic::server::ServerStreamingService + for WatchTaskDetailsSvc { type Response = super::super::tasks::TaskDetails; type ResponseStream = T::WatchTaskDetailsStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { (*inner).watch_task_details(request).await }; + let fut = async move { + (*inner).watch_task_details(request).await + }; Box::pin(fut) } } @@ -355,10 +392,11 @@ pub mod instrument_server { let inner = inner.0; let method = WatchTaskDetailsSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.server_streaming(method, req).await; Ok(res) }; @@ -367,9 +405,13 @@ pub mod instrument_server { "/rs.tokio.console.instrument.Instrument/Pause" => { #[allow(non_camel_case_types)] struct PauseSvc(pub Arc); - impl tonic::server::UnaryService for PauseSvc { + impl tonic::server::UnaryService + for PauseSvc { type Response = super::PauseResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, @@ -386,10 +428,11 @@ pub mod instrument_server { let inner = inner.0; let method = PauseSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -398,9 +441,13 @@ pub mod instrument_server { "/rs.tokio.console.instrument.Instrument/Resume" => { #[allow(non_camel_case_types)] struct ResumeSvc(pub Arc); - impl tonic::server::UnaryService for ResumeSvc { + impl tonic::server::UnaryService + for ResumeSvc { type Response = super::ResumeResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, @@ -417,23 +464,28 @@ pub mod instrument_server { let inner = inner.0; let method = ResumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } - _ => Box::pin(async move { - Ok(http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap()) - }), + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } } } } diff --git a/console-api/src/generated/rs.tokio.console.resources.rs b/console-api/src/generated/rs.tokio.console.resources.rs index edc58cf86..714391461 100644 --- a/console-api/src/generated/rs.tokio.console.resources.rs +++ b/console-api/src/generated/rs.tokio.console.resources.rs @@ -5,17 +5,17 @@ /// - any new resources that were created since the last update /// - the current stats for any resource whose stats changed since the last update /// - any new poll ops that have been invoked on a resource -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct ResourceUpdate { /// A list of new resources that were created since the last `ResourceUpdate` was /// sent. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub new_resources: ::prost::alloc::vec::Vec, /// Any resource stats that have changed since the last update. - #[prost(map = "uint64, message", tag = "2")] + #[prost(map="uint64, message", tag="2")] pub stats_update: ::std::collections::HashMap, /// A list of all new poll ops that have been invoked on resources since the last update. - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub new_poll_ops: ::prost::alloc::vec::Vec, /// A count of how many resource events (e.g. polls, creation, etc) were not /// recorded because the application's event buffer was at capacity. @@ -27,56 +27,54 @@ pub struct ResourceUpdate { /// /// If the application's instrumentation ensures reliable delivery of events, /// this will always be 0. - #[prost(uint64, tag = "4")] + #[prost(uint64, tag="4")] pub dropped_events: u64, } /// Static data recorded when a new resource is created. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Resource { /// The resources's ID. /// /// This uniquely identifies this resource across all *currently live* /// resources. This is also the primary way any operations on a resource /// are associated with it - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub id: ::core::option::Option, /// The numeric ID of the resources's `Metadata`. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub metadata: ::core::option::Option, /// The resources's concrete rust type. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub concrete_type: ::prost::alloc::string::String, /// The kind of resource (e.g timer, mutex) - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub kind: ::core::option::Option, /// The location in code where the resource was created. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub location: ::core::option::Option, /// The ID of the parent resource. - #[prost(message, optional, tag = "6")] + #[prost(message, optional, tag="6")] pub parent_resource_id: ::core::option::Option, /// Is the resource an internal component of another resource? /// - /// For example, a `tokio::time::Interval` resource might contain a + /// For example, a `tokio::time::Interval` resource might contain a /// `tokio::time::Sleep` resource internally. - #[prost(bool, tag = "7")] + #[prost(bool, tag="7")] pub is_internal: bool, } /// Nested message and enum types in `Resource`. pub mod resource { /// The kind of resource (e.g. timer, mutex). - #[derive(Clone, Eq, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Kind { /// Every resource is either a known kind or an other (unknown) kind. - #[prost(oneof = "kind::Kind", tags = "1, 2")] + #[prost(oneof="kind::Kind", tags="1, 2")] pub kind: ::core::option::Option, } /// Nested message and enum types in `Kind`. pub mod kind { /// `Known` collects the kinds of resources that are known in this version of the API. - #[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Known { /// `TIMER` signals that this is a timer resource, e.g. waiting for a sleep to finish. @@ -94,58 +92,58 @@ pub mod resource { } } /// Every resource is either a known kind or an other (unknown) kind. - #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Kind { /// `known` signals that this kind of resource is known to the console API. - #[prost(enumeration = "Known", tag = "1")] + #[prost(enumeration="Known", tag="1")] Known(i32), /// `other` signals that this kind of resource is unknown to the console API. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] Other(::prost::alloc::string::String), } } } /// Task runtime stats of a resource. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the resource was created. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, /// Timestamp of when the resource was dropped. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub dropped_at: ::core::option::Option<::prost_types::Timestamp>, /// State attributes of the resource. These are dependent on the type of the resource. /// For example, a timer resource will have a duration while a semaphore resource may /// have permits as an attribute. These values may change over time as the state of /// the resource changes. Therefore, they live in the runtime stats rather than the /// static data describing the resource. - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub attributes: ::prost::alloc::vec::Vec, } /// A `PollOp` describes each poll operation that completes within the async /// application. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct PollOp { /// The numeric ID of the op's `Metadata`. /// /// This identifies the `Metadata` that describes the `tracing` span /// corresponding to this op. The metadata for this ID will have been sent /// in a prior `RegisterMetadata` message. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub metadata: ::core::option::Option, /// The resources's ID. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub resource_id: ::core::option::Option, /// the name of this op (e.g. poll_elapsed, new_timeout, reset, etc.) - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub name: ::prost::alloc::string::String, /// Identifies the task context that this poll op has been called from. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub task_id: ::core::option::Option, /// Identifies the async op ID that this poll op is part of. - #[prost(message, optional, tag = "6")] + #[prost(message, optional, tag="6")] pub async_op_id: ::core::option::Option, /// Whether this poll op has returned with ready or pending. - #[prost(bool, tag = "7")] + #[prost(bool, tag="7")] pub is_ready: bool, } diff --git a/console-api/src/generated/rs.tokio.console.tasks.rs b/console-api/src/generated/rs.tokio.console.tasks.rs index 62a0854d8..6ff543bc9 100644 --- a/console-api/src/generated/rs.tokio.console.tasks.rs +++ b/console-api/src/generated/rs.tokio.console.tasks.rs @@ -10,7 +10,7 @@ pub struct TaskUpdate { /// sent. /// /// If this is empty, no new tasks were spawned. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub new_tasks: ::prost::alloc::vec::Vec, /// Any task stats that have changed since the last update. /// @@ -19,7 +19,7 @@ pub struct TaskUpdate { /// since the last `TaskUpdate` in which they were present. If a task's ID /// *is* included in this map, the corresponding value represents a complete /// snapshot of that task's stats at in the current time window. - #[prost(map = "uint64, message", tag = "3")] + #[prost(map="uint64, message", tag="3")] pub stats_update: ::std::collections::HashMap, /// A count of how many task events (e.g. polls, spawns, etc) were not /// recorded because the application's event buffer was at capacity. @@ -31,17 +31,17 @@ pub struct TaskUpdate { /// /// If the application's instrumentation ensures reliable delivery of events, /// this will always be 0. - #[prost(uint64, tag = "4")] + #[prost(uint64, tag="4")] pub dropped_events: u64, } /// A task details update -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct TaskDetails { /// The task's ID which the details belong to. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub task_id: ::core::option::Option, /// The timestamp for when the update to the task took place. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub now: ::core::option::Option<::prost_types::Timestamp>, /// A histogram of task poll durations. /// @@ -49,7 +49,7 @@ pub struct TaskDetails { /// - the raw binary representation of a HdrHistogram.rs `Histogram` /// serialized to binary in the V2 format (legacy) /// - a binary histogram plus details on outliers (current) - #[prost(oneof = "task_details::PollTimesHistogram", tags = "3, 4")] + #[prost(oneof="task_details::PollTimesHistogram", tags="3, 4")] pub poll_times_histogram: ::core::option::Option, } /// Nested message and enum types in `TaskDetails`. @@ -60,18 +60,18 @@ pub mod task_details { /// - the raw binary representation of a HdrHistogram.rs `Histogram` /// serialized to binary in the V2 format (legacy) /// - a binary histogram plus details on outliers (current) - #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum PollTimesHistogram { /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format - #[prost(bytes, tag = "3")] + #[prost(bytes, tag="3")] LegacyHistogram(::prost::alloc::vec::Vec), /// A histogram plus additional data. - #[prost(message, tag = "4")] + #[prost(message, tag="4")] Histogram(super::DurationHistogram), } } /// Data recorded when a new task is spawned. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Task { /// The task's ID. /// @@ -80,20 +80,20 @@ pub struct Task { /// identified by this ID; if the client requires additional information /// included in the `Task` message, it should store that data and access it /// by ID. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub id: ::core::option::Option, /// The numeric ID of the task's `Metadata`. /// /// This identifies the `Metadata` that describes the `tracing` span /// corresponding to this task. The metadata for this ID will have been sent /// in a prior `RegisterMetadata` message. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub metadata: ::core::option::Option, /// The category of task this task belongs to. - #[prost(enumeration = "task::Kind", tag = "3")] + #[prost(enumeration="task::Kind", tag="3")] pub kind: i32, /// A list of `Field` objects attached to this task. - #[prost(message, repeated, tag = "4")] + #[prost(message, repeated, tag="4")] pub fields: ::prost::alloc::vec::Vec, /// An ordered list of span IDs corresponding to the `tracing` span context /// in which this task was spawned. @@ -106,10 +106,10 @@ pub struct Task { /// /// These IDs may correspond to `tracing` spans which are *not* tasks, if /// additional trace data is being collected. - #[prost(message, repeated, tag = "5")] + #[prost(message, repeated, tag="5")] pub parents: ::prost::alloc::vec::Vec, /// The location in code where the task was spawned. - #[prost(message, optional, tag = "6")] + #[prost(message, optional, tag="6")] pub location: ::core::option::Option, } /// Nested message and enum types in `Task`. @@ -142,45 +142,45 @@ pub mod task { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the task was spawned. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, /// Timestamp of when the task was dropped. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub dropped_at: ::core::option::Option<::prost_types::Timestamp>, /// The total number of times this task has been woken over its lifetime. - #[prost(uint64, tag = "3")] + #[prost(uint64, tag="3")] pub wakes: u64, /// The total number of times this task's waker has been cloned. - #[prost(uint64, tag = "4")] + #[prost(uint64, tag="4")] pub waker_clones: u64, /// The total number of times this task's waker has been dropped. - #[prost(uint64, tag = "5")] + #[prost(uint64, tag="5")] pub waker_drops: u64, /// The timestamp of the most recent time this task has been woken. /// /// If this is `None`, the task has not yet been woken. - #[prost(message, optional, tag = "6")] + #[prost(message, optional, tag="6")] pub last_wake: ::core::option::Option<::prost_types::Timestamp>, /// Contains task poll statistics. - #[prost(message, optional, tag = "7")] + #[prost(message, optional, tag="7")] pub poll_stats: ::core::option::Option, /// The total number of times this task has woken itself. - #[prost(uint64, tag = "8")] + #[prost(uint64, tag="8")] pub self_wakes: u64, } -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct DurationHistogram { /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format - #[prost(bytes = "vec", tag = "1")] + #[prost(bytes="vec", tag="1")] pub raw_histogram: ::prost::alloc::vec::Vec, /// The histogram's maximum value. - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub max_value: u64, /// The number of outliers which have exceeded the histogram's maximum value. - #[prost(uint64, tag = "3")] + #[prost(uint64, tag="3")] pub high_outliers: u64, /// The highest recorded outlier. This is only present if `high_outliers` is /// greater than zero. - #[prost(uint64, optional, tag = "4")] + #[prost(uint64, optional, tag="4")] pub highest_outlier: ::core::option::Option, } diff --git a/console-api/src/generated/rs.tokio.console.trace.rs b/console-api/src/generated/rs.tokio.console.trace.rs index 9776b870a..13c2843a5 100644 --- a/console-api/src/generated/rs.tokio.console.trace.rs +++ b/console-api/src/generated/rs.tokio.console.trace.rs @@ -1,90 +1,90 @@ /// Start watching trace events with the provided filter. -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchRequest { /// Specifies which trace events should be streamed. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub filter: ::prost::alloc::string::String, } /// A trace event -#[derive(Clone, Eq, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct TraceEvent { /// A trace event - #[prost(oneof = "trace_event::Event", tags = "1, 2, 3, 4, 5, 6")] + #[prost(oneof="trace_event::Event", tags="1, 2, 3, 4, 5, 6")] pub event: ::core::option::Option, } /// Nested message and enum types in `TraceEvent`. pub mod trace_event { /// `RegisterThreads` signals that a new thread was registered. - #[derive(Clone, Eq, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterThreads { /// `names` maps the registered thread id's to their associated name. - #[prost(map = "uint64, string", tag = "1")] + #[prost(map="uint64, string", tag="1")] pub names: ::std::collections::HashMap, } /// `Enter` signals that a span was entered. - #[derive(Clone, Eq, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Enter { /// `span_id` identifies the span that was entered. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub span_id: ::core::option::Option, /// `thread_id` identifies who entered the span. - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub thread_id: u64, /// `at` identifies when the span was entered. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// `Exit` signals that a span was exited. - #[derive(Clone, Eq, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Exit { /// `span_id` identifies the span that was exited. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub span_id: ::core::option::Option, /// `thread_id` identifies who exited the span. - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub thread_id: u64, /// `at` identifies when the span was exited. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// `Close` signals that a span was closed. - #[derive(Clone, Eq, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Close { /// `span_id` identifies the span that was closed. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub span_id: ::core::option::Option, /// `at` identifies when the span was closed. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// A trace event - #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Event { /// A new thread was registered. - #[prost(message, tag = "1")] + #[prost(message, tag="1")] RegisterThread(RegisterThreads), /// A new span metadata was registered. - #[prost(message, tag = "2")] + #[prost(message, tag="2")] RegisterMetadata(super::super::common::RegisterMetadata), /// A span was created. - #[prost(message, tag = "3")] + #[prost(message, tag="3")] NewSpan(super::super::common::Span), /// A span was entered. - #[prost(message, tag = "4")] + #[prost(message, tag="4")] EnterSpan(Enter), /// A span was exited. - #[prost(message, tag = "5")] + #[prost(message, tag="5")] ExitSpan(Exit), /// A span was closed. - #[prost(message, tag = "6")] + #[prost(message, tag="6")] CloseSpan(Close), } } /// Generated client implementations. pub mod trace_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::http::Uri; use tonic::codegen::*; + use tonic::codegen::http::Uri; /// Allows observers to stream trace events for a given `WatchRequest` filter. #[derive(Debug, Clone)] pub struct TraceClient { @@ -129,8 +129,9 @@ pub mod trace_client { >::ResponseBody, >, >, - >>::Error: - Into + Send + Sync, + , + >>::Error: Into + Send + Sync, { TraceClient::new(InterceptedService::new(inner, interceptor)) } @@ -153,19 +154,24 @@ pub mod trace_client { pub async fn watch( &mut self, request: impl tonic::IntoRequest, - ) -> Result>, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/rs.tokio.console.trace.Trace/Watch"); + ) -> Result< + tonic::Response>, + tonic::Status, + > { self.inner - .server_streaming(request.into_request(), path, codec) + .ready() .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/rs.tokio.console.trace.Trace/Watch", + ); + self.inner.server_streaming(request.into_request(), path, codec).await } } } @@ -177,7 +183,9 @@ pub mod trace_server { #[async_trait] pub trait Trace: Send + Sync + 'static { ///Server streaming response type for the Watch method. - type WatchStream: futures_core::Stream> + type WatchStream: futures_core::Stream< + Item = Result, + > + Send + 'static; /// Produces a stream of trace events for the given filter. @@ -206,7 +214,10 @@ pub mod trace_server { send_compression_encodings: Default::default(), } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -234,7 +245,10 @@ pub mod trace_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -243,11 +257,16 @@ pub mod trace_server { "/rs.tokio.console.trace.Trace/Watch" => { #[allow(non_camel_case_types)] struct WatchSvc(pub Arc); - impl tonic::server::ServerStreamingService for WatchSvc { + impl< + T: Trace, + > tonic::server::ServerStreamingService + for WatchSvc { type Response = super::TraceEvent; type ResponseStream = T::WatchStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, @@ -264,23 +283,28 @@ pub mod trace_server { let inner = inner.0; let method = WatchSvc(inner); let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } - _ => Box::pin(async move { - Ok(http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap()) - }), + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } } } }