aboutsummaryrefslogtreecommitdiff
path: root/request
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-11-29 11:02:43 +0000
committerGravatar GitHub <noreply@github.com> 2016-11-29 11:02:43 +0000
commit8c8b37a30ea400603c9cb381cc9b71c4da93a536 (patch)
treeec6d2b430c89e082f12cde34b97b10db890879e7 /request
parent4cfd19c7c97490dac47cd748166ec3f976e315aa (diff)
downloadcoredns-8c8b37a30ea400603c9cb381cc9b71c4da93a536.tar.gz
coredns-8c8b37a30ea400603c9cb381cc9b71c4da93a536.tar.zst
coredns-8c8b37a30ea400603c9cb381cc9b71c4da93a536.zip
middleware/metrics: export actual size (#448)
The `*_size*` metrics now export the actual packet length, not the advertised one (although that might be nice as well).
Diffstat (limited to 'request')
-rw-r--r--request/request.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/request/request.go b/request/request.go
index b5da38771..00388caca 100644
--- a/request/request.go
+++ b/request/request.go
@@ -106,7 +106,10 @@ func (r *Request) Do() bool {
return false
}
-// Size returns if UDP buffer size advertised in the requests OPT record.
+// Len returns the length in bytes in the request.
+func (r *Request) Len() int { return r.Req.Len() }
+
+// Size returns if buffer size *advertised* in the requests OPT record.
// Or when the request was over TCP, we return the maximum allowed size of 64K.
func (r *Request) Size() int {
if r.size != 0 {