Skip to content

Commit 995f37b

Browse files
authored
feat(s2n-quic-dc): add packet-level events (#2832)
1 parent 356c504 commit 995f37b

File tree

22 files changed

+3492
-870
lines changed

22 files changed

+3492
-870
lines changed

dc/s2n-quic-dc/events/connection.rs

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,214 @@ pub enum StreamTcpConnectErrorReason {
341341
Aborted,
342342
}
343343

344+
#[event("stream:packet_transmitted")]
345+
pub struct StreamPacketTransmitted {
346+
/// The total size of the packet
347+
#[measure("packet_len", Bytes)]
348+
packet_len: usize,
349+
350+
/// The size of the application data in the packet
351+
#[measure("payload_len", Bytes)]
352+
#[counter("payload_len.total", Bytes)]
353+
#[measure_counter("payload_len.conn", Bytes)]
354+
payload_len: usize,
355+
356+
/// The packet number of the transmitted packet
357+
packet_number: u64,
358+
359+
/// The offset in the stream of the first byte in the packet
360+
stream_offset: u64,
361+
362+
/// Whether the packet contained the final bytes of the stream
363+
is_fin: bool,
364+
365+
#[bool_counter("retransmission")]
366+
is_retransmission: bool,
367+
}
368+
369+
#[event("stream:probe_transmitted")]
370+
pub struct StreamProbeTransmitted {
371+
/// The total size of the packet
372+
#[measure("packet_len", Bytes)]
373+
packet_len: usize,
374+
375+
/// The packet number of the transmitted packet
376+
packet_number: u64,
377+
}
378+
379+
#[event("stream:packet_received")]
380+
pub struct StreamPacketReceived {
381+
/// The total size of the packet
382+
#[measure("packet_len", Bytes)]
383+
packet_len: usize,
384+
385+
/// The size of the application data in the packet
386+
#[measure("payload_len", Bytes)]
387+
#[counter("payload_len.total", Bytes)]
388+
#[measure_counter("payload_len.conn", Bytes)]
389+
payload_len: usize,
390+
391+
/// The packet number of the received packet
392+
packet_number: u64,
393+
394+
/// The offset in the stream of the first byte in the packet
395+
stream_offset: u64,
396+
397+
/// Whether the packet contained the final bytes of the stream
398+
is_fin: bool,
399+
400+
#[bool_counter("retransmission")]
401+
is_retransmission: bool,
402+
}
403+
404+
/// Indicates that a packet was lost on a stream
405+
#[event("stream:packet_lost")]
406+
pub struct StreamPacketLost {
407+
/// The total size of the packet
408+
#[measure("packet_len", Bytes)]
409+
packet_len: usize,
410+
411+
/// The size of the application data in the packet
412+
#[measure("payload_len", Bytes)]
413+
#[counter("payload_len.total", Bytes)]
414+
#[measure_counter("payload_len.conn", Bytes)]
415+
payload_len: usize,
416+
417+
/// The packet number of the lost packet
418+
packet_number: u64,
419+
420+
/// The offset in the stream of the first byte in the packet
421+
stream_offset: u64,
422+
423+
/// The time the packet was originally sent
424+
time_sent: Timestamp,
425+
426+
/// The amount of time between when the packet was sent and when it was detected as lost
427+
#[measure("lifetime", Duration)]
428+
lifetime: core::time::Duration,
429+
430+
#[bool_counter("retransmission")]
431+
is_retransmission: bool,
432+
}
433+
434+
/// Indicates that a packet was acknowledged on a stream
435+
#[event("stream:packet_acked")]
436+
pub struct StreamPacketAcked {
437+
/// The total size of the packet
438+
#[measure("packet_len", Bytes)]
439+
packet_len: usize,
440+
441+
/// The size of the application data in the packet
442+
#[measure("payload_len", Bytes)]
443+
#[counter("payload_len.total", Bytes)]
444+
#[measure_counter("payload_len.conn", Bytes)]
445+
payload_len: usize,
446+
447+
/// The packet number of the acknowledged packet
448+
packet_number: u64,
449+
450+
/// The offset in the stream of the first byte in the packet
451+
stream_offset: u64,
452+
453+
/// The time the packet was originally sent
454+
time_sent: Timestamp,
455+
456+
/// The amount of time between when the packet was sent and when it was detected as lost
457+
#[measure("lifetime", Duration)]
458+
lifetime: core::time::Duration,
459+
460+
#[bool_counter("retransmission")]
461+
is_retransmission: bool,
462+
}
463+
464+
/// Indicates that a packet was retransmitted on a stream but was not actually lost
465+
#[event("stream:packet_spuriously_retransmitted")]
466+
pub struct StreamPacketSpuriouslyRetransmitted {
467+
/// The total size of the packet
468+
#[measure("packet_len", Bytes)]
469+
packet_len: usize,
470+
471+
/// The size of the application data in the packet
472+
#[measure("payload_len", Bytes)]
473+
#[counter("payload_len.total", Bytes)]
474+
#[measure_counter("payload_len.conn", Bytes)]
475+
payload_len: usize,
476+
477+
/// The packet number of the packet
478+
packet_number: u64,
479+
480+
/// The offset in the stream of the first byte in the packet
481+
stream_offset: u64,
482+
483+
/// Whether the packet contained the final bytes of the stream
484+
is_fin: bool,
485+
486+
#[bool_counter("retransmission")]
487+
is_retransmission: bool,
488+
}
489+
490+
/// Indicates that the stream received additional flow control credits
491+
#[event("stream:max_data_received")]
492+
pub struct StreamMaxDataReceived {
493+
/// The number of bytes of flow control credits received
494+
#[measure("increase", Bytes)]
495+
#[counter("increase.total", Bytes)]
496+
increase: u64,
497+
498+
/// The new offset of the stream
499+
new_max_data: u64,
500+
}
501+
502+
#[event("stream:control_packet_transmitted")]
503+
pub struct StreamControlPacketTransmitted {
504+
/// The total size of the packet
505+
#[measure("packet_len", Bytes)]
506+
packet_len: usize,
507+
508+
/// The size of the control data in the packet
509+
#[measure("control_data_len", Bytes)]
510+
control_data_len: usize,
511+
512+
/// The packet number of the received control packet
513+
packet_number: u64,
514+
}
515+
516+
#[event("stream:control_packet_received")]
517+
pub struct StreamControlPacketReceived {
518+
/// The total size of the packet
519+
#[measure("packet_len", Bytes)]
520+
packet_len: usize,
521+
522+
/// The size of the control data in the packet
523+
#[measure("control_data_len", Bytes)]
524+
control_data_len: usize,
525+
526+
/// The packet number of the received control packet
527+
packet_number: u64,
528+
529+
/// Whether the packet was successfully authenticated
530+
#[bool_counter("authenticated")]
531+
is_authenticated: bool,
532+
}
533+
534+
#[event("stream:receiver_errored")]
535+
pub struct StreamReceiverErrored {
536+
#[builder(crate::stream::recv::Error)]
537+
error: crate::stream::recv::Error,
538+
539+
/// The location where the error originated
540+
source: s2n_quic_core::endpoint::Location,
541+
}
542+
543+
#[event("stream:sender_errored")]
544+
pub struct StreamSenderErrored {
545+
#[builder(crate::stream::send::Error)]
546+
error: crate::stream::send::Error,
547+
548+
/// The location where the error originated
549+
source: s2n_quic_core::endpoint::Location,
550+
}
551+
344552
// NOTE - This event MUST come last, since connection-level aggregation depends on it
345553
#[event("connection:closed")]
346554
// #[checkpoint("latency")]

0 commit comments

Comments
 (0)