trace packets that are sent outside of a connection

This commit is contained in:
Marten Seemann
2020-07-16 08:20:36 +07:00
parent f10894a1ce
commit 0c551c893c
9 changed files with 99 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import (
"net"
"time"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/logging"
"go.opencensus.io/stats"
@@ -65,6 +66,16 @@ func (t *tracer) TracerForConnection(p logging.Perspective, _ logging.Connection
return newConnTracer(t, p)
}
func (t *tracer) SentPacket(_ net.Addr, hdr *logging.Header, _ protocol.ByteCount, _ []logging.Frame) {
stats.RecordWithTags(
context.Background(),
[]tag.Mutator{
tag.Upsert(keyPacketType, packetType(logging.PacketTypeFromHeader(hdr)).String()),
},
sentPackets.M(1),
)
}
func (t *tracer) DroppedPacket(net.Addr, logging.PacketType, logging.ByteCount, logging.PacketDropReason) {
}