Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
For users who build tokio-console by installing it with `cargo`, it is
common to use the `--locked` flag to indicate that the dependency
versions from the lock file should be used. So it's worth having those
dependencies up to date.

This change checks in the result of running `cargo update` without
changing the manifest (`Cargo.toml`) files.

The patch (pre-1.0 minor) version change to `tonic-build` included a
deprecation (rename) and some clippy lint allow directives in the
generated Rust files.

The update to `tracing` in the lockfile from 0.1.37 to 0.1.40 includes
the changes from tokio-rs/tracing#2562. This change causes an
instrumented future to be entered one final time when the future is
dropped, so that any code run in the drop implementation will be in the
scope of the span. This causes the number of polls recorded for a task
to be incremented by 1 right before it is dropped.

Due to this change, some of the `console-subscriber` tests needed to be
updated. This behaviour was already present for many application using
the `console-subscriber`, but not yet in the tests because we hadn't
updated the lockfile for a while.
  • Loading branch information
hds committed Oct 22, 2024
1 parent ae17230 commit ad76840
Show file tree
Hide file tree
Showing 12 changed files with 645 additions and 705 deletions.
1,107 changes: 525 additions & 582 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions console-api/src/generated/rs.tokio.console.async_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
///
/// 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.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncOpUpdate {
/// A list of new async operations that were created since the last `AsyncOpUpdate`
Expand Down Expand Up @@ -33,7 +32,6 @@ pub struct AsyncOpUpdate {
/// An async operation is an operation that is associated with a resource
/// This could, for example, be a read or write on a TCP stream, or a receive operation on
/// a channel.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncOp {
/// The async op's ID.
Expand Down Expand Up @@ -68,7 +66,6 @@ pub struct AsyncOp {
pub resource_id: ::core::option::Option<super::common::Id>,
}
/// Statistics associated with a given async operation.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Stats {
/// Timestamp of when the async op has been created.
Expand Down
27 changes: 7 additions & 20 deletions console-api/src/generated/rs.tokio.console.common.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// This file is @generated by prost-build.
/// Unique identifier for each task.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Id {
/// The unique identifier's concrete value.
#[prost(uint64, tag = "1")]
pub id: u64,
}
/// A Rust source code location.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Location {
/// The file path
Expand All @@ -25,23 +23,20 @@ pub struct Location {
pub column: ::core::option::Option<u32>,
}
/// Unique identifier for metadata.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MetaId {
/// The unique identifier's concrete value.
#[prost(uint64, tag = "1")]
pub id: u64,
}
/// Unique identifier for spans.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SpanId {
/// The unique identifier's concrete value.
#[prost(uint64, tag = "1")]
pub id: u64,
}
/// A message representing a key-value pair of data associated with a `Span`
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Field {
/// Metadata for the task span that the field came from.
Expand All @@ -63,7 +58,6 @@ pub mod field {
///
/// This is either represented as a string, or as an index into a `Metadata`'s
/// array of field name strings.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Name {
/// The string representation of the name.
Expand All @@ -75,7 +69,6 @@ pub mod field {
NameIdx(u64),
}
/// The value of the key-value pair.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
/// A value serialized to a string using `fmt::Debug`.
Expand All @@ -98,7 +91,6 @@ pub mod field {
/// Represents a period of time in which a program was executing in a particular context.
///
/// Corresponds to `Span` in the `tracing` crate.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Span {
/// An Id that uniquely identifies it in relation to other spans.
Expand All @@ -117,7 +109,6 @@ pub struct Span {
pub at: ::core::option::Option<::prost_types::Timestamp>,
}
/// Any new metadata that was registered since the last update.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterMetadata {
/// The new metadata that was registered since the last update.
Expand All @@ -127,7 +118,6 @@ pub struct RegisterMetadata {
/// Nested message and enum types in `RegisterMetadata`.
pub mod register_metadata {
/// One metadata element registered since the last update.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NewMetadata {
/// Unique identifier for `metadata`.
Expand All @@ -139,7 +129,6 @@ pub mod register_metadata {
}
}
/// Metadata associated with a span or event.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Metadata {
/// The name of the span or event.
Expand Down Expand Up @@ -194,8 +183,8 @@ pub mod metadata {
/// (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",
Self::Span => "SPAN",
Self::Event => "EVENT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -250,11 +239,11 @@ pub mod metadata {
/// (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",
Self::Error => "ERROR",
Self::Warn => "WARN",
Self::Info => "INFO",
Self::Debug => "DEBUG",
Self::Trace => "TRACE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -273,7 +262,6 @@ pub mod metadata {
/// Contains stats about objects that can be polled. Currently these can be:
/// - tasks that have been spawned
/// - async operations on resources that are performed within the context of a task
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PollStats {
/// The total number of times this object has been polled.
Expand Down Expand Up @@ -322,7 +310,6 @@ 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.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attribute {
/// The key-value pair for the attribute
Expand Down
87 changes: 46 additions & 41 deletions console-api/src/generated/rs.tokio.console.instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@
/// 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)
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct InstrumentRequest {}
/// TaskDetailsRequest requests the stream of updates about
/// the specific task identified in the request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TaskDetailsRequest {
/// Identifies the task for which details were requested.
#[prost(message, optional, tag = "1")]
pub id: ::core::option::Option<super::common::Id>,
}
/// PauseRequest requests the stream of updates to pause.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PauseRequest {}
/// ResumeRequest requests the stream of updates to resume after a pause.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ResumeRequest {}
/// Update carries all information regarding tasks, resources, async operations
Expand All @@ -33,7 +29,6 @@ pub struct ResumeRequest {}
/// - 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
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Update {
/// The system time when this update was recorded.
Expand All @@ -56,16 +51,20 @@ pub struct Update {
pub new_metadata: ::core::option::Option<super::common::RegisterMetadata>,
}
/// `PauseResponse` is the value returned after a pause request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PauseResponse {}
/// `ResumeResponse` is the value returned after a resume request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ResumeResponse {}
/// Generated client implementations.
pub mod instrument_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// `InstrumentServer<T>` implements `Instrument` as a service.
Expand All @@ -88,8 +87,8 @@ pub mod instrument_client {
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Expand All @@ -114,7 +113,7 @@ pub mod instrument_client {
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
InstrumentClient::new(InterceptedService::new(inner, interceptor))
}
Expand Down Expand Up @@ -161,8 +160,7 @@ pub mod instrument_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand Down Expand Up @@ -192,8 +190,7 @@ pub mod instrument_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand All @@ -220,8 +217,7 @@ pub mod instrument_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand All @@ -245,8 +241,7 @@ pub mod instrument_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand All @@ -265,16 +260,22 @@ pub mod instrument_client {
}
/// Generated server implementations.
pub mod instrument_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with InstrumentServer.
#[async_trait]
pub trait Instrument: Send + Sync + 'static {
pub trait Instrument: std::marker::Send + std::marker::Sync + 'static {
/// Server streaming response type for the WatchUpdates method.
type WatchUpdatesStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::Update, tonic::Status>,
>
+ Send
+ std::marker::Send
+ 'static;
/// Produces a stream of updates representing the behavior of the instrumented async runtime.
async fn watch_updates(
Expand All @@ -291,7 +292,7 @@ pub mod instrument_server {
tonic::Status,
>,
>
+ Send
+ std::marker::Send
+ 'static;
/// Produces a stream of updates describing the activity of a specific task.
async fn watch_task_details(
Expand All @@ -314,14 +315,14 @@ pub mod instrument_server {
}
/// `InstrumentServer<T>` implements `Instrument` as a service.
#[derive(Debug)]
pub struct InstrumentServer<T: Instrument> {
pub struct InstrumentServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T: Instrument> InstrumentServer<T> {
impl<T> InstrumentServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
Expand Down Expand Up @@ -375,8 +376,8 @@ pub mod instrument_server {
impl<T, B> tonic::codegen::Service<http::Request<B>> for InstrumentServer<T>
where
T: Instrument,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
Expand Down Expand Up @@ -569,23 +570,25 @@ pub mod instrument_server {
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T: Instrument> Clone for InstrumentServer<T> {
impl<T> Clone for InstrumentServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
Expand All @@ -597,7 +600,9 @@ pub mod instrument_server {
}
}
}
impl<T: Instrument> tonic::server::NamedService for InstrumentServer<T> {
const NAME: &'static str = "rs.tokio.console.instrument.Instrument";
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "rs.tokio.console.instrument.Instrument";
impl<T> tonic::server::NamedService for InstrumentServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
Loading

0 comments on commit ad76840

Please sign in to comment.