Support legacy datadog agent (#2670)

dd-agent v5 can issue some requests with trailing slashes.
(e.g.
526559be73/ddagent.py (L303))
Trim trailing slashes for request on /datadog/ paths to accomodate for
that.

Co-authored-by: Pierre Rossi <pierre.rossi@schibsted.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
This commit is contained in:
elProxy 2022-06-07 14:06:18 +02:00 committed by Aliaksandr Valialkin
parent 0b4f767c53
commit 0c5e199469
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -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()