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