@@ -250,6 +250,68 @@ pub struct StreamReadSocketErrored {
250
250
errno : Option < i32 > ,
251
251
}
252
252
253
+ /// Tracks stream connect where dcQUIC owns the TCP connect().
254
+ #[ event( "stream:tcp_connect" ) ]
255
+ #[ subject( endpoint) ]
256
+ pub struct StreamTcpConnect {
257
+ #[ bool_counter( "error" ) ]
258
+ error : bool ,
259
+
260
+ // This includes the error latencies.
261
+ //
262
+ // FIXME: Support Option<Duration> in metrics to make it much easier to record timers
263
+ // optionally.
264
+ #[ timer( "tcp_latency" ) ]
265
+ latency : core:: time:: Duration ,
266
+ }
267
+
268
+ /// Tracks stream connect where dcQUIC owns the TCP connect().
269
+ #[ event( "stream:connect" ) ]
270
+ #[ subject( endpoint) ]
271
+ pub struct StreamConnect {
272
+ #[ bool_counter( "error" ) ]
273
+ error : bool ,
274
+
275
+ #[ nominal_counter( "tcp" ) ]
276
+ tcp_success : MaybeBoolCounter ,
277
+
278
+ #[ nominal_counter( "handshake" ) ]
279
+ handshake_success : MaybeBoolCounter ,
280
+ }
281
+
282
+ /// Used for cases where we are racing multiple futures and exit if any of them fail, and so
283
+ /// recording success is not just a boolean value.
284
+ enum MaybeBoolCounter {
285
+ Success ,
286
+ Failure ,
287
+ Aborted ,
288
+ }
289
+
290
+ /// Tracks stream connect errors.
291
+ ///
292
+ /// Currently only emitted in cases where dcQUIC owns the TCP connect too.
293
+ #[ event( "stream:connect_error" ) ]
294
+ #[ subject( endpoint) ]
295
+ pub struct StreamConnectError {
296
+ #[ nominal_counter( "reason" ) ]
297
+ reason : StreamTcpConnectErrorReason ,
298
+ }
299
+
300
+ /// Note that there's no guarantee of a particular reason if multiple reasons ~simultaneously
301
+ /// terminate the connection.
302
+ pub enum StreamTcpConnectErrorReason {
303
+ /// TCP connect failed.
304
+ TcpConnect ,
305
+
306
+ /// Handshake failed to produce credentials.
307
+ Handshake ,
308
+
309
+ /// When the connect future is dropped prior to returning any result.
310
+ ///
311
+ /// Usually indicates a timeout in the application.
312
+ Aborted ,
313
+ }
314
+
253
315
// NOTE - This event MUST come last, since connection-level aggregation depends on it
254
316
#[ event( "connection:closed" ) ]
255
317
// #[checkpoint("latency")]
0 commit comments