Skip to content

Commit

Permalink
feat: add webhook source error logging (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip committed Feb 9, 2023
1 parent 017d8ba commit 042d9b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gateway/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func (bt *batchWebhookTransformerT) batchTransformLoop() {
if batchResponse.statusCode != 0 {
statusCode = batchResponse.statusCode
}
pkgLogger.Errorf("webhook %s source transformation failed with error: %w and status code: %s", breq.sourceType, batchResponse.batchError, statusCode)
countWebhookErrors(breq.sourceType, statusCode, len(breq.batchRequest))
for _, req := range breq.batchRequest {
req.done <- transformerResponse{StatusCode: statusCode, Err: batchResponse.batchError.Error()}
Expand All @@ -391,11 +392,13 @@ func (bt *batchWebhookTransformerT) batchTransformLoop() {
errMessage = bt.webhook.enqueueInGateway(webRequest, outputPayload)
}
if errMessage != "" {
pkgLogger.Errorf("webhook %s source transformation failed: %s", breq.sourceType, errMessage)
countWebhookErrors(breq.sourceType, response.GetErrorStatusCode(errMessage), 1)
webRequest.done <- bt.markResponseFail(errMessage)
continue
}
} else if resp.StatusCode != http.StatusOK {
pkgLogger.Errorf("webhook %s source transformation failed with error: %s and status code: %s", breq.sourceType, resp.Err, resp.StatusCode)
countWebhookErrors(breq.sourceType, resp.StatusCode, 1)
}

Expand Down

0 comments on commit 042d9b3

Please sign in to comment.