From dc867802d4c4ef7a8e401fca79da43b48bd82832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A7=D0=B8=D1=80=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BB=D0=B5?= =?UTF-8?q?=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= Date: Thu, 2 Apr 2026 14:09:33 +0300 Subject: [PATCH] MSP-7466 add requestId --- middleware/throttling.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/middleware/throttling.go b/middleware/throttling.go index 8abd3f8..a2e80a8 100644 --- a/middleware/throttling.go +++ b/middleware/throttling.go @@ -5,10 +5,12 @@ import ( "fmt" "net/http" - "github.com/pkg/errors" "isp-gate-service/domain" "isp-gate-service/httperrors" "isp-gate-service/request" + + "github.com/pkg/errors" + "github.com/txix-open/isp-kit/requestid" ) type Throttler interface { @@ -28,10 +30,12 @@ func Throttling(throttler Throttler) Middleware { return errors.WithMessage(err, "throttling: allow rate limit") } if !result.Allow { + requestId := requestid.FromContext(ctx.Context()) return httperrors.New( http.StatusTooManyRequests, fmt.Sprintf("rate limit has been reached, try after %dms", result.RetryAfter.Milliseconds()), - errors.Errorf("throttling: rate limit has been reached for application '%d'", authData.ApplicationId), + errors.Errorf("throttling: rate limit has been reached for application '%d', requestId '%s'", + authData.ApplicationId, requestId), ) }