From 0c5e1994691900b062a4b0498dcd7cca91fbe022 Mon Sep 17 00:00:00 2001 From: elProxy Date: Tue, 7 Jun 2022 14:06:18 +0200 Subject: [PATCH] Support legacy datadog agent (#2670) dd-agent v5 can issue some requests with trailing slashes. (e.g. https://github.com/DataDog/dd-agent/blob/526559be731b6e47b12d7aa8b6d45cb8d9ac4d68/ddagent.py#L303) Trim trailing slashes for request on /datadog/ paths to accomodate for that. Co-authored-by: Pierre Rossi Co-authored-by: Aliaksandr Valialkin --- app/vminsert/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/vminsert/main.go b/app/vminsert/main.go index db65643586..57e79200b1 100644 --- a/app/vminsert/main.go +++ b/app/vminsert/main.go @@ -189,6 +189,9 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { return true } + if strings.HasPrefix(p.Suffix, "datadog/") { + p.Suffix = strings.TrimSuffix(p.Suffix, "/") + } switch p.Suffix { case "prometheus/", "prometheus", "prometheus/api/v1/write": prometheusWriteRequests.Inc()