Skip to content

Commit 70b75cb

Browse files
authored
Merge pull request cloudflare#43 from shampson/stats
Adds getStats() method to QuicTransportBase.
2 parents 326ae11 + bce4676 commit 70b75cb

File tree

2 files changed

+275
-20
lines changed

2 files changed

+275
-20
lines changed

index.bs

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ The dictionary SHALL have the following attributes:
478478

479479
# `QuicTransportBase` Interface # {#quic-transport-base}
480480

481-
The `QuicTransportBase` is the base interface for {{QuicTransport}}. Most of
481+
The `QuicTransportBase` is the base for {{QuicTransport}}. Most of
482482
the functionality of a `QuicTransport` is in the base class to allow for other
483483
subclasses (such as a p2p variant) to share the same interface.
484484

@@ -496,6 +496,7 @@ defined in [[!QUIC-DATAGRAM]].
496496

497497
<pre class="idl">
498498
interface QuicTransportBase {
499+
Promise&lt;QuicTransportStats&gt; getStats();
499500
};
500501

501502
QuicTransportBase includes UnidirectionalStreamsTransport;
@@ -504,6 +505,67 @@ QuicTransportBase includes DatagramTransport;
504505
QuicTransportBase includes WebTransport;
505506
</pre>
506507

508+
## Methods ## {#quic-transport-base-methods}
509+
510+
: <dfn for="QuicTransportBase" method>getStats()</dfn>
511+
:: Gathers stats for this <code><a>QuicTransportBase</a></code>'s QUIC
512+
connection and reports the result asynchronously.</p>
513+
514+
When close is called, the user agent MUST run the following steps:
515+
1. Let |transport| be the QuicTransportBase on which `getStats` is invoked.
516+
1. If |transport|'s {{[[WebTransportState]]}} is `"new"`, then abort
517+
these steps.
518+
1. Let |p| be a new promise.
519+
1. Return |p| and continue the following steps in background.
520+
1. Gather the stats from the underlying QUIC connection.
521+
1. Once stats have been gathered, resolve |p| with the
522+
{{QuicTransportStats}} object, representing the gathered stats.
523+
524+
## `QuicTransportStats` Dictionary ## {#quic-transport-stats}
525+
526+
The <dfn dictionary>QuicTransportStats</dfn> dictionary includes information
527+
on QUIC connection level stats.
528+
529+
<pre class="idl">
530+
dictionary QuicTransportStats {
531+
DOMHighResTimeStamp timestamp;
532+
unsigned long long bytesSent;
533+
unsigned long long packetsSent;
534+
unsigned long numOutgoingStreamsCreated;
535+
unsigned long numIncomingStreamsCreated;
536+
unsigned long long bytesReceived;
537+
unsigned long long packetsReceived;
538+
DOMHighResTimeStamp minRtt;
539+
unsigned long numReceivedDatagramsDropped;
540+
};
541+
</pre>
542+
543+
The dictionary SHALL have the following attributes:
544+
545+
: <dfn for="QuicTransportStats" dict-member>timestamp</dfn>
546+
:: The `timestamp` for when the stats are gathered, relative to the
547+
UNIX epoch (Jan 1, 1970, UTC).
548+
: <dfn for="QuicTransportStats" dict-member>bytesSent</dfn>
549+
:: The number of bytes sent on the QUIC connection, including retransmissions.
550+
Does not include UDP or any other outer framing.
551+
: <dfn for="QuicTransportStats" dict-member>packetsSent</dfn>
552+
:: The number of packets sent on the QUIC connection, including retransmissions.
553+
: <dfn for="QuicTransportStats" dict-member>numOutgoingStreamsCreated</dfn>
554+
:: The number of outgoing QUIC streams created on the QUIC connection.
555+
: <dfn for="QuicTransportStats" dict-member>numIncomingStreamsCreated</dfn>
556+
:: The number of incoming QUIC streams created on the QUIC connection.
557+
: <dfn for="QuicTransportStats" dict-member>bytesReceived</dfn>
558+
:: The number of total bytes received on the QUIC connection, including
559+
duplicate data for streams. Does not include UDP or any other outer framing.
560+
: <dfn for="QuicTransportStats" dict-member>packetsReceived</dfn>
561+
:: The number of total packets received on the QUIC connection, including
562+
packets that were not processable.
563+
: <dfn for="QuicTransportStats" dict-member>minRtt</dfn>
564+
:: The minimum RTT observed on the entire connection.
565+
: <dfn for="QuicTransportStats" dict-member>numReceivedDatagramsDropped</dfn>
566+
:: The number of datagrams that were dropped, due to too many datagrams buffered
567+
between calls to {{receiveDatagrams()}}.
568+
507569
# `QuicTransport` Interface # {#quic-transport}
508570

509571
The <dfn interface>QuicTransport</dfn> is a subclass of {{QuicTransportBase}}

0 commit comments

Comments
 (0)