-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentry Integration #81
Sentry Integration #81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming it still starts in the test environment. Green to go
lib/log/main.go
Outdated
@@ -17,6 +24,10 @@ var Log *zap.SugaredLogger | |||
// safe, but has a clunkier API). See: https://godoc.org/go.uber.org/zap#hdr-Choosing_a_Logger | |||
var RawLog *zap.Logger | |||
|
|||
type Client = sentry.Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I feel like this alias is more confusing, since there's already so many things called Client, and sentry.Client
is more descriptive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point -- this was copied from the tulip/sentry library, but I agree, I'll remove the alias
} | ||
|
||
func sentryInit(log *zap.Logger) *zap.Logger { | ||
errConfig := config.ParseEnv() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surely this is already called somewhere else in the code... is it idempotent? Should we be initing the config here and passing it through?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is idempotent, but I did consider passing it through. It's just that it would touch a lot more code to do so -- not sure the best solution here
lib/log/main.go
Outdated
if errSentry != nil { | ||
// this is called before log is initialized | ||
fmt.Fprintf(os.Stderr, "Failed to initialize Sentry: %s\n", errSentry) | ||
return log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, since it would only reach this is if SentryEnabled==true
lib/log/main.go
Outdated
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ws
Adds Sentry support via the following environmental variables:
OTR_SENTRY_ENABLED
OTR_SENTRY_DSN
OTR_SENTRY_MODE
OTR_SENTRY_RELEASE
OTR_SENTRY_ENVIRONMENT