Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/server/errorshandler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (handler *Handler) process(body []byte) ResponseMessage {

if handler.RedisClient.IsBlocked(projectId) {
handler.ErrorsBlockedByLimit.Inc()
handler.recordProjectMetrics(projectId, "events-rate-limited")
return ResponseMessage{402, true, "Project has exceeded the events limit"}
}

Expand All @@ -82,6 +83,7 @@ func (handler *Handler) process(body []byte) ResponseMessage {
return ResponseMessage{402, true, "Failed to update rate limit"}
}
if !rateWithinLimit {
handler.recordProjectMetrics(projectId, "events-rate-limited")
return ResponseMessage{402, true, "Rate limit exceeded"}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/server/errorshandler/handler_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (handler *Handler) HandleSentry(ctx *fasthttp.RequestCtx) {

if handler.RedisClient.IsBlocked(projectId) {
handler.ErrorsBlockedByLimit.Inc()
handler.recordProjectMetrics(projectId, "events-rate-limited")
sendAnswerHTTP(ctx, ResponseMessage{402, true, "Project has exceeded the events limit"})
return
}
Expand All @@ -114,6 +115,7 @@ func (handler *Handler) HandleSentry(ctx *fasthttp.RequestCtx) {
}

if !rateWithinLimit {
handler.recordProjectMetrics(projectId, "events-rate-limited")
sendAnswerHTTP(ctx, ResponseMessage{402, true, "Rate limit exceeded"})
return
}
Expand Down Expand Up @@ -141,5 +143,8 @@ func (handler *Handler) HandleSentry(ctx *fasthttp.RequestCtx) {
// increment processed errors counter
handler.ErrorsProcessed.Inc()

// record project metrics
handler.recordProjectMetrics(projectId, "events-accepted")

sendAnswerHTTP(ctx, ResponseMessage{200, false, "OK"})
}
Loading