Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: tokenserver/appengine/frontend/main.go

Issue 2945013002: grpc: Interceptor to catch panics and convert them to Internal errors. (Closed)
Patch Set: oops Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« grpc/grpcmon/server.go ('K') | « grpc/grpcutil/paniccatcher.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tokenserver/appengine/frontend/main.go
diff --git a/tokenserver/appengine/frontend/main.go b/tokenserver/appengine/frontend/main.go
index 2b7078794f0c987f22ece67fc660bbc87bf59de7..48697b5ad74b39b46d6931b13ac74a1bfbd30f23 100644
--- a/tokenserver/appengine/frontend/main.go
+++ b/tokenserver/appengine/frontend/main.go
@@ -18,6 +18,7 @@ import (
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/grpc/discovery"
"github.com/luci/luci-go/grpc/grpcmon"
+ "github.com/luci/luci-go/grpc/grpcutil"
"github.com/luci/luci-go/grpc/prpc"
"github.com/luci/luci-go/server/auth"
"github.com/luci/luci-go/server/router"
@@ -55,9 +56,10 @@ func init() {
http.Redirect(c.Writer, c.Request, "/rpcexplorer/", http.StatusFound)
})
- // Install all RPC servers.
+ // Install all RPC servers. Catch panics, report metrics to tsmon (including
+ // panics themselves, as Internal errors).
api := prpc.Server{
- UnaryServerInterceptor: grpcmon.NewUnaryServerInterceptor(nil),
+ UnaryServerInterceptor: grpcmon.NewUnaryServerInterceptor(grpcutil.NewUnaryServerPanicCatcher(nil)),
}
admin.RegisterCertificateAuthoritiesServer(&api, &admin.DecoratedCertificateAuthorities{
Service: certauthorities.NewServer(),
« grpc/grpcmon/server.go ('K') | « grpc/grpcutil/paniccatcher.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698