hds_console_api/generated/
rs.tokio.console.tasks.rs

1/// A task state update.
2///
3/// Each `TaskUpdate` contains any task data that has changed since the last
4/// update. This includes:
5/// - any new tasks that were spawned since the last update
6/// - the current stats for any task whose stats changed since the last update
7#[allow(clippy::derive_partial_eq_without_eq)]
8#[derive(Clone, PartialEq, ::prost::Message)]
9pub struct TaskUpdate {
10    /// A list of new tasks that were spawned since the last `TaskUpdate` was
11    /// sent.
12    ///
13    /// If this is empty, no new tasks were spawned.
14    #[prost(message, repeated, tag = "1")]
15    pub new_tasks: ::prost::alloc::vec::Vec<Task>,
16    /// Any task stats that have changed since the last update.
17    ///
18    /// This is a map of task IDs (64-bit unsigned integers) to task stats. If a
19    /// task's ID is not included in this map, then its stats have *not* changed
20    /// since the last `TaskUpdate` in which they were present. If a task's ID
21    /// *is* included in this map, the corresponding value represents a complete
22    /// snapshot of that task's stats at in the current time window.
23    #[prost(map = "uint64, message", tag = "3")]
24    pub stats_update: ::std::collections::HashMap<u64, Stats>,
25    /// A count of how many task events (e.g. polls, spawns, etc) were not
26    /// recorded because the application's event buffer was at capacity.
27    ///
28    /// If everything is working normally, this should be 0. If it is greater
29    /// than 0, that may indicate that some data is missing from this update, and
30    /// it may be necessary to increase the number of events buffered by the
31    /// application to ensure that data loss is avoided.
32    ///
33    /// If the application's instrumentation ensures reliable delivery of events,
34    /// this will always be 0.
35    #[prost(uint64, tag = "4")]
36    pub dropped_events: u64,
37    /// Another field.
38    #[prost(uint64, tag = "5")]
39    pub another_field: u64,
40}
41/// A task details update
42#[allow(clippy::derive_partial_eq_without_eq)]
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct TaskDetails {
45    /// The task's ID which the details belong to.
46    #[prost(message, optional, tag = "1")]
47    pub task_id: ::core::option::Option<super::common::Id>,
48    /// The timestamp for when the update to the task took place.
49    #[prost(message, optional, tag = "2")]
50    pub now: ::core::option::Option<::prost_types::Timestamp>,
51    /// A histogram of task scheduled durations.
52    ///
53    /// The scheduled duration is the time a task spends between being
54    /// woken and when it is next polled.
55    #[prost(message, optional, tag = "5")]
56    pub scheduled_times_histogram: ::core::option::Option<DurationHistogram>,
57    /// A histogram of task poll durations.
58    ///
59    /// This is either:
60    /// - the raw binary representation of a HdrHistogram.rs `Histogram`
61    ///    serialized to binary in the V2 format (legacy)
62    /// - a binary histogram plus details on outliers (current)
63    #[prost(oneof = "task_details::PollTimesHistogram", tags = "3, 4")]
64    pub poll_times_histogram: ::core::option::Option<task_details::PollTimesHistogram>,
65}
66/// Nested message and enum types in `TaskDetails`.
67pub mod task_details {
68    /// A histogram of task poll durations.
69    ///
70    /// This is either:
71    /// - the raw binary representation of a HdrHistogram.rs `Histogram`
72    ///    serialized to binary in the V2 format (legacy)
73    /// - a binary histogram plus details on outliers (current)
74    #[allow(clippy::derive_partial_eq_without_eq)]
75    #[derive(Clone, PartialEq, ::prost::Oneof)]
76    pub enum PollTimesHistogram {
77        /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format
78        #[prost(bytes, tag = "3")]
79        LegacyHistogram(::prost::alloc::vec::Vec<u8>),
80        /// A histogram plus additional data.
81        #[prost(message, tag = "4")]
82        Histogram(super::DurationHistogram),
83    }
84}
85/// Data recorded when a new task is spawned.
86#[allow(clippy::derive_partial_eq_without_eq)]
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct Task {
89    /// The task's ID.
90    ///
91    /// This uniquely identifies this task across all *currently live* tasks.
92    /// When the task's stats change, or when the task completes, it will be
93    /// identified by this ID; if the client requires additional information
94    /// included in the `Task` message, it should store that data and access it
95    /// by ID.
96    #[prost(message, optional, tag = "1")]
97    pub id: ::core::option::Option<super::common::Id>,
98    /// The numeric ID of the task's `Metadata`.
99    ///
100    /// This identifies the `Metadata` that describes the `tracing` span
101    /// corresponding to this task. The metadata for this ID will have been sent
102    /// in a prior `RegisterMetadata` message.
103    #[prost(message, optional, tag = "2")]
104    pub metadata: ::core::option::Option<super::common::MetaId>,
105    /// The category of task this task belongs to.
106    #[prost(enumeration = "task::Kind", tag = "3")]
107    pub kind: i32,
108    /// A list of `Field` objects attached to this task.
109    #[prost(message, repeated, tag = "4")]
110    pub fields: ::prost::alloc::vec::Vec<super::common::Field>,
111    /// An ordered list of span IDs corresponding to the `tracing` span context
112    /// in which this task was spawned.
113    ///
114    /// The first span ID in this list is the immediate parent, followed by that
115    /// span's parent, and so on. The final ID is the root span of the current
116    /// trace.
117    ///
118    /// If this is empty, there were *no* active spans when the task was spawned.
119    ///
120    /// These IDs may correspond to `tracing` spans which are *not* tasks, if
121    /// additional trace data is being collected.
122    #[prost(message, repeated, tag = "5")]
123    pub parents: ::prost::alloc::vec::Vec<super::common::SpanId>,
124    /// The location in code where the task was spawned.
125    #[prost(message, optional, tag = "6")]
126    pub location: ::core::option::Option<super::common::Location>,
127}
128/// Nested message and enum types in `Task`.
129pub mod task {
130    /// The category of task this task belongs to.
131    #[derive(
132        Clone,
133        Copy,
134        Debug,
135        PartialEq,
136        Eq,
137        Hash,
138        PartialOrd,
139        Ord,
140        ::prost::Enumeration
141    )]
142    #[repr(i32)]
143    pub enum Kind {
144        /// A task spawned using a runtime's standard asynchronous task spawning
145        /// operation (such as `tokio::task::spawn`).
146        Spawn = 0,
147        /// A task spawned via a runtime's blocking task spawning operation
148        /// (such as `tokio::task::spawn_blocking`).
149        Blocking = 1,
150    }
151    impl Kind {
152        /// String value of the enum field names used in the ProtoBuf definition.
153        ///
154        /// The values are not transformed in any way and thus are considered stable
155        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
156        pub fn as_str_name(&self) -> &'static str {
157            match self {
158                Kind::Spawn => "SPAWN",
159                Kind::Blocking => "BLOCKING",
160            }
161        }
162        /// Creates an enum from field names used in the ProtoBuf definition.
163        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
164            match value {
165                "SPAWN" => Some(Self::Spawn),
166                "BLOCKING" => Some(Self::Blocking),
167                _ => None,
168            }
169        }
170    }
171}
172/// Task performance statistics.
173#[allow(clippy::derive_partial_eq_without_eq)]
174#[derive(Clone, PartialEq, ::prost::Message)]
175pub struct Stats {
176    /// Timestamp of when the task was spawned.
177    #[prost(message, optional, tag = "1")]
178    pub created_at: ::core::option::Option<::prost_types::Timestamp>,
179    /// Timestamp of when the task was dropped.
180    #[prost(message, optional, tag = "2")]
181    pub dropped_at: ::core::option::Option<::prost_types::Timestamp>,
182    /// The total number of times this task has been woken over its lifetime.
183    #[prost(uint64, tag = "3")]
184    pub wakes: u64,
185    /// The total number of times this task's waker has been cloned.
186    #[prost(uint64, tag = "4")]
187    pub waker_clones: u64,
188    /// The total number of times this task's waker has been dropped.
189    #[prost(uint64, tag = "5")]
190    pub waker_drops: u64,
191    /// The timestamp of the most recent time this task has been woken.
192    ///
193    /// If this is `None`, the task has not yet been woken.
194    #[prost(message, optional, tag = "6")]
195    pub last_wake: ::core::option::Option<::prost_types::Timestamp>,
196    /// Contains task poll statistics.
197    #[prost(message, optional, tag = "7")]
198    pub poll_stats: ::core::option::Option<super::common::PollStats>,
199    /// The total number of times this task has woken itself.
200    #[prost(uint64, tag = "8")]
201    pub self_wakes: u64,
202    /// The total duration this task was scheduled prior to being polled, summed
203    /// across all poll cycles.
204    ///
205    /// Note that this includes only polls that have started, and does not
206    /// reflect any scheduled state where the task hasn't yet been polled.
207    /// Subtracting both `busy_time` (from the task's `PollStats`) and
208    /// `scheduled_time` from the total lifetime of the task results in the
209    /// amount of time it spent unable to progress because it was waiting on
210    /// some resource.
211    #[prost(message, optional, tag = "9")]
212    pub scheduled_time: ::core::option::Option<::prost_types::Duration>,
213}
214#[allow(clippy::derive_partial_eq_without_eq)]
215#[derive(Clone, PartialEq, ::prost::Message)]
216pub struct DurationHistogram {
217    /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format
218    #[prost(bytes = "vec", tag = "1")]
219    pub raw_histogram: ::prost::alloc::vec::Vec<u8>,
220    /// The histogram's maximum value.
221    #[prost(uint64, tag = "2")]
222    pub max_value: u64,
223    /// The number of outliers which have exceeded the histogram's maximum value.
224    #[prost(uint64, tag = "3")]
225    pub high_outliers: u64,
226    /// The highest recorded outlier. This is only present if `high_outliers` is
227    /// greater than zero.
228    #[prost(uint64, optional, tag = "4")]
229    pub highest_outlier: ::core::option::Option<u64>,
230}