Skip to content
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

Merged
merged 10 commits into from
Jul 12, 2024
Merged

Conversation

eparker-tulip
Copy link
Contributor

Adds Sentry support via the following environmental variables:

OTR_SENTRY_ENABLED
OTR_SENTRY_DSN
OTR_SENTRY_MODE
OTR_SENTRY_RELEASE
OTR_SENTRY_ENVIRONMENT

Copy link
Contributor

@alex-goodisman alex-goodisman left a 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
Copy link
Contributor

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

Copy link
Contributor Author

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()
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this panic?

Copy link
Contributor Author

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
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ws

@eparker-tulip eparker-tulip merged commit 08304c0 into master Jul 12, 2024
8 checks passed
@eparker-tulip eparker-tulip deleted the eparker.oplogtoredis-sentry-integration branch July 12, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants