Documentation ¶
Index ¶
- func Hub(hub *sentry.Hub) zapcore.Field
- func StreamServerInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- type Config
- type Core
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hub ¶ added in v0.13.0
Hub attaches a Sentry hub to the logger such that if the logger ever logs an error, request context can be sent to Sentry.
func StreamServerInterceptor ¶ added in v0.18.2
func StreamServerInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamServerInterceptor returns a new streaming server interceptor with the sentry hub placed in the context
func UnaryServerInterceptor ¶ added in v0.18.2
func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
UnaryServerInterceptor returns a new unary server interceptor with the sentry hub placed in the context
Types ¶
type Config ¶
Config defines the necessary configuration for instantiating a Sentry Reporter
func (Config) InitializeSentry ¶ added in v0.12.6
InitializeSentry Initializes the Sentry client. This function should be called as soon as possible after the application configuration is loaded so that sentry is setup.
func (*Config) RegisterFlags ¶
RegisterFlags registers Sentry flags with pflags
type Core ¶
type Core struct { zapcore.LevelEnabler // contains filtered or unexported fields }
Core Implements a zapcore.Core that sends logged errors to Sentry
func (*Core) Check ¶
func (c *Core) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
Check must be called before calling Write. This determines whether or not logs are sent to Sentry
type Middleware ¶ added in v0.13.0
type Middleware struct {
// contains filtered or unexported fields
}
Middleware contains a Sentry handler
func NewMiddleware ¶ added in v0.13.0
func NewMiddleware() Middleware
NewMiddleware creates a new Sentry middleware object
func (Middleware) HTTP ¶ added in v0.13.0
func (m Middleware) HTTP(next http.Handler) http.Handler
This middleware is a wrapper around the sentry-go library's middleware that attaches a the Sentry hub that from the request context to the logger. That way, if the logger ever writes an error log, instead of just sending the log message and fields provided to the logger to Sentry, Sentry is able to capture the entire request context i.e. the request path, headers present, etc. If this middleware is attached after the tracing middleware, the corresponding Trace ID will be added to the Sentry scope.