From e131125558d513f587da3f2f7bf6cea02ec356bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveirinha?= Date: Thu, 25 Aug 2022 11:05:01 +0100 Subject: [PATCH] TUN-6699: Add metric for packet too big dropped --- quic/datagram.go | 3 +-- quic/datagramv2.go | 2 +- quic/metrics.go | 8 ++++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/quic/datagram.go b/quic/datagram.go index 8527d948..334754d4 100644 --- a/quic/datagram.go +++ b/quic/datagram.go @@ -46,8 +46,7 @@ func (dm *DatagramMuxer) mtu() int { func (dm *DatagramMuxer) SendToSession(session *packet.Session) error { if len(session.Payload) > dm.mtu() { - // TODO: TUN-5302 return ICMP packet too big message - // drop packet for now, eventually reply with ICMP for PMTUD + packetTooBigDropped.Inc() return fmt.Errorf("origin UDP payload has %d bytes, which exceeds transport MTU %d", len(session.Payload), dm.mtu()) } payloadWithMetadata, err := suffixSessionID(session.ID, session.Payload) diff --git a/quic/datagramv2.go b/quic/datagramv2.go index 03e60b1e..7e2fce89 100644 --- a/quic/datagramv2.go +++ b/quic/datagramv2.go @@ -58,7 +58,7 @@ func NewDatagramMuxerV2( // demultiplex the payload from multiple datagram sessions func (dm *DatagramMuxerV2) SendToSession(session *packet.Session) error { if len(session.Payload) > dm.mtu() { - // TODO: TUN-5302 return ICMP packet too big message + packetTooBigDropped.Inc() return fmt.Errorf("origin UDP payload has %d bytes, which exceeds transport MTU %d", len(session.Payload), dm.mtu()) } msgWithID, err := suffixSessionID(session.ID, session.Payload) diff --git a/quic/metrics.go b/quic/metrics.go index 480ad371..631cbbb6 100644 --- a/quic/metrics.go +++ b/quic/metrics.go @@ -144,6 +144,13 @@ var ( } registerClient = sync.Once{} registerServer = sync.Once{} + + packetTooBigDropped = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: namespace, + Subsystem: perspectiveString(logging.PerspectiveClient), + Name: "packet_too_big_dropped", + Help: "Count of packets received from origin that are too big to send to the edge and are dropped as a result", + }) ) // MetricsCollector abstracts the difference between client and server metrics from connTracer @@ -264,6 +271,7 @@ func newClientCollector(index uint8) MetricsCollector { clientMetrics.minRTT, clientMetrics.latestRTT, clientMetrics.smoothedRTT, + packetTooBigDropped, ) }) return &clientCollector{