diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-03-27 12:44:37 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-03-27 13:42:28 +0300 |
commit | 672f548a6f0f5e033f33086cf5c159c969864d39 (patch) | |
tree | 0b5e4dd7a40eb2666f7d7cb91f346842efe1340f | |
parent | 2b4b9eb13008f12efd3d624440125b38729a6ff8 (diff) |
Ignore NotFound errors in Sentryzj-sentry-ignore-not-found
Going through the errors reported to Sentry, NotFound errors pop up here
and there. There are errors that are useful to the client, but not for
the server to send them to sentry.
-rw-r--r-- | changelogs/unreleased/zj-sentry-ignore-not-found.yml | 5 | ||||
-rw-r--r-- | internal/middleware/sentryhandler/sentryhandler.go | 2 | ||||
-rw-r--r-- | internal/middleware/sentryhandler/sentryhandler_test.go | 12 |
3 files changed, 12 insertions, 7 deletions
diff --git a/changelogs/unreleased/zj-sentry-ignore-not-found.yml b/changelogs/unreleased/zj-sentry-ignore-not-found.yml new file mode 100644 index 000000000..c7c31811d --- /dev/null +++ b/changelogs/unreleased/zj-sentry-ignore-not-found.yml @@ -0,0 +1,5 @@ +--- +title: Ignore NotFound errors in Sentry +merge_request: 1156 +author: +type: changed diff --git a/internal/middleware/sentryhandler/sentryhandler.go b/internal/middleware/sentryhandler/sentryhandler.go index 47991a82a..4cdb79af1 100644 --- a/internal/middleware/sentryhandler/sentryhandler.go +++ b/internal/middleware/sentryhandler/sentryhandler.go @@ -16,6 +16,8 @@ import ( var ignoredCodes = []codes.Code{ // OK means there was no error codes.OK, + // NotFound means the (pool) repository was not present + codes.NotFound, // Canceled and DeadlineExceeded indicate clients that disappeared or lost interest codes.Canceled, codes.DeadlineExceeded, diff --git a/internal/middleware/sentryhandler/sentryhandler_test.go b/internal/middleware/sentryhandler/sentryhandler_test.go index 88888acb9..2e5b1670f 100644 --- a/internal/middleware/sentryhandler/sentryhandler_test.go +++ b/internal/middleware/sentryhandler/sentryhandler_test.go @@ -32,13 +32,11 @@ func Test_generateRavenPacket(t *testing.T) { wantCulprit: "SSHService::SSHUploadPack", }, { - name: "GRPC error", - method: "/gitaly.RepoService/RepoExists", - sinceStart: 500 * time.Millisecond, - err: status.Errorf(codes.NotFound, "Something failed"), - wantCode: codes.NotFound, - wantMessage: "rpc error: code = NotFound desc = Something failed", - wantCulprit: "RepoService::RepoExists", + name: "GRPC error", + method: "/gitaly.RepoService/RepoExists", + sinceStart: 500 * time.Millisecond, + err: status.Errorf(codes.NotFound, "Something failed"), + wantNil: true, }, { name: "nil", |