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

chore: update Tonic and Prost dependencies #364

Merged
merged 10 commits into from Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .cargo/config
@@ -1,2 +1,5 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
rustflags = ["--cfg", "tokio_unstable"]

[alias]
xtask = "run --manifest-path ./xtask/Cargo.toml --"
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Expand Up @@ -75,6 +75,11 @@ jobs:
override: true
- uses: Swatinem/rust-cache@v1

- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run cargo test (API)
uses: actions-rs/cargo@v1
with:
Expand Down
47 changes: 23 additions & 24 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Expand Up @@ -2,6 +2,7 @@
members = [
"tokio-console",
"console-subscriber",
"console-api"
"console-api",
"xtask"
]
resolver = "2"
12 changes: 7 additions & 5 deletions console-api/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "console-api"
version = "0.3.0"
version = "0.4.0"
license = "MIT"
edition = "2021"
rust-version = "1.58.0"
Expand Down Expand Up @@ -29,19 +29,21 @@ keywords = [
transport = ["tonic-build/transport", "tonic/transport"]

[dependencies]
tonic = { version = "0.7", default-features = false, features = [
tonic = { version = "0.8", default-features = false, features = [
"prost",
"codegen",
"transport",
] }
prost = "0.10"
prost-types = "0.10"
prost = "0.11"
prost-types = "0.11"
tracing-core = "0.1.17"

[dev-dependencies]
tonic-build = { version = "0.7", default-features = false, features = [
tonic-build = { version = "0.8", default-features = false, features = [
"prost", "transport"
] }
# explicit dep so we can get the version with fixed whitespace.
prost-build = "0.11.1"

[package.metadata.docs.rs]
all-features = true
Expand Down
Empty file.
27 changes: 27 additions & 0 deletions console-api/src/generated/rs.tokio.console.common.rs
Expand Up @@ -165,6 +165,18 @@ pub mod metadata {
/// Indicates metadata is associated with an event.
Event = 1,
}
impl Kind {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Kind::Span => "SPAN",
Kind::Event => "EVENT",
}
}
}
/// Describes the level of verbosity of a span or event.
///
/// Corresponds to `Level` in the `tracing` crate.
Expand All @@ -191,6 +203,21 @@ pub mod metadata {
/// Designates very low priority, often extremely verbose, information.
Trace = 4,
}
impl Level {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Level::Error => "ERROR",
Level::Warn => "WARN",
Level::Info => "INFO",
Level::Debug => "DEBUG",
Level::Trace => "TRACE",
}
}
}
}
/// Contains stats about objects that can be polled. Currently these can be:
/// - tasks that have been spawned
Expand Down
40 changes: 29 additions & 11 deletions console-api/src/generated/rs.tokio.console.instrument.rs
Expand Up @@ -30,7 +30,7 @@ pub struct ResumeRequest {
/// - we can use one single timestamp for all the data
/// - we can have all the new_metadata in one place
/// - things such as async ops and resource ops do not make sense
/// on their own as they have relations to tasks and resources
/// on their own as they have relations to tasks and resources
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Update {
/// The system time when this update was recorded.
Expand Down Expand Up @@ -64,6 +64,7 @@ pub struct ResumeResponse {
pub mod instrument_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// `InstrumentServer<T>` implements `Instrument` as a service.
#[derive(Debug, Clone)]
pub struct InstrumentClient<T> {
Expand All @@ -84,19 +85,24 @@ pub mod instrument_client {
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Default + Body<Data = Bytes> + Send + 'static,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InstrumentClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
Expand All @@ -109,19 +115,19 @@ pub mod instrument_client {
{
InstrumentClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with `gzip`.
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses with `gzip`.
/// Enable decompressing responses.
#[must_use]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Produces a stream of updates representing the behavior of the instrumented async runtime.
Expand Down Expand Up @@ -258,8 +264,8 @@ pub mod instrument_server {
#[derive(Debug)]
pub struct InstrumentServer<T: Instrument> {
inner: _Inner<T>,
accept_compression_encodings: (),
send_compression_encodings: (),
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Instrument> InstrumentServer<T> {
Expand All @@ -283,6 +289,18 @@ pub mod instrument_server {
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for InstrumentServer<T>
where
Expand Down Expand Up @@ -491,7 +509,7 @@ pub mod instrument_server {
write!(f, "{:?}", self.0)
}
}
impl<T: Instrument> tonic::transport::NamedService for InstrumentServer<T> {
impl<T: Instrument> tonic::server::NamedService for InstrumentServer<T> {
const NAME: &'static str = "rs.tokio.console.instrument.Instrument";
}
}
11 changes: 11 additions & 0 deletions console-api/src/generated/rs.tokio.console.resources.rs
Expand Up @@ -80,6 +80,17 @@ pub mod resource {
/// `TIMER` signals that this is a timer resource, e.g. waiting for a sleep to finish.
Timer = 0,
}
impl Known {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Known::Timer => "TIMER",
}
}
}
/// Every resource is either a known kind or an other (unknown) kind.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
Expand Down
16 changes: 14 additions & 2 deletions console-api/src/generated/rs.tokio.console.tasks.rs
Expand Up @@ -47,7 +47,7 @@ pub struct TaskDetails {
///
/// This is either:
/// - the raw binary representation of a HdrHistogram.rs `Histogram`
/// serialized to binary in the V2 format (legacy)
/// serialized to binary in the V2 format (legacy)
/// - a binary histogram plus details on outliers (current)
#[prost(oneof="task_details::PollTimesHistogram", tags="3, 4")]
pub poll_times_histogram: ::core::option::Option<task_details::PollTimesHistogram>,
Expand All @@ -58,7 +58,7 @@ pub mod task_details {
///
/// This is either:
/// - the raw binary representation of a HdrHistogram.rs `Histogram`
/// serialized to binary in the V2 format (legacy)
/// serialized to binary in the V2 format (legacy)
/// - a binary histogram plus details on outliers (current)
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum PollTimesHistogram {
Expand Down Expand Up @@ -125,6 +125,18 @@ pub mod task {
/// (such as `tokio::task::spawn_blocking`).
Blocking = 1,
}
impl Kind {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Kind::Spawn => "SPAWN",
Kind::Blocking => "BLOCKING",
}
}
}
}
/// Task performance statistics.
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down