-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Indicate dev environment in Sentry events #5051
Conversation
x/init.go
Outdated
@@ -103,6 +104,16 @@ func Version() string { | |||
return dgraphVersion | |||
} | |||
|
|||
// DevVersion returns true if the version string contains a git commit hash. | |||
// e.g. |
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.
File is not gofmt
-ed with -s
(from gofmt
)
// e.g. | |
// e.g. |
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.
Reviewed 3 of 3 files at r1.
Reviewable status: 1 of 3 files reviewed, 4 unresolved discussions (waiting on @danielmai, @manishrjain, and @parasssh)
x/init.go, line 110 at r1 (raw file):
_
This error is for validating the regexp pattern. Better to use regexp.MustCompile and then use (* RexExp).MatchString: https://golang.org/pkg/regexp/#Regexp.MatchString. That way, the error doesn't to be ignored/checked.
x/sentry_integration.go, line 40 at r1 (raw file):
env += "-enterprise" } else { env += "-oss"
This looks different than the versions in the PR description. When it's not a dev version, then the env is prefixed with a "-".
DevVersion: true | DevVersion: false | |
---|---|---|
ee: true | dev-enterprise | -enterprise |
ee: false | dev-oss | -oss |
x/sentry_integration.go, line 72 at r1 (raw file):
CaptureSentryException(err) panic(err) }
This is no longer needed?
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.
Dismissed @danielmai from 3 discussions.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @danielmai, @golangcibot, and @manishrjain)
x/init.go, line 108 at r2 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
File is not
gofmt
-ed with-s
(fromgofmt
)// e.g.
Done.
x/sentry_integration.go, line 40 at r1 (raw file):
Previously, danielmai (Daniel Mai) wrote…
This looks different than the versions in the PR description. When it's not a dev version, then the env is prefixed with a "-".
DevVersion: true DevVersion: false ee: true dev-enterprise -enterprise ee: false dev-oss -oss
I noticed that. Fixed.
Now, we have
{prod|dev}{enterprise|oss}
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.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @danielmai, @golangcibot, and @manishrjain)
x/sentry_integration.go, line 40 at r1 (raw file):
Previously, parasssh wrote…
I noticed that. Fixed.
Now, we have
{prod|dev}{enterprise|oss}
I mean
{prod|dev}-{enterprise|oss}
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.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @danielmai, @golangcibot, and @manishrjain)
x/sentry_integration.go, line 72 at r1 (raw file):
Previously, danielmai (Daniel Mai) wrote…
This is no longer needed?
I moved it to x/error.go. Also we dont need to explicitly call CaptureSentryException() because the panic handler does that now.
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.
Reviewed 1 of 3 files at r1, 1 of 2 files at r2, 2 of 2 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @golangcibot and @parasssh)
x/init.go, line 113 at r3 (raw file):
func DevVersion() (matched bool) { pattern := `-g[[:xdigit:]]{7,}` // -g followed by a commit-hash of min. 7 hex digits. return (regexp.MustCompile(pattern).MatchString(dgraphVersion))
Make the MustCompile outside and in a var, so it gets initialized once.
x/init.go
Outdated
@@ -103,6 +104,15 @@ func Version() string { | |||
return dgraphVersion | |||
} | |||
|
|||
var versionRe *regexp.Regexp = regexp.MustCompile(`-g[[:xdigit:]]{7,}`) // -g followed by a commit-hash of min. 7 hex digits. |
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.
line is 125 characters (from lll
)
x/init.go
Outdated
@@ -103,6 +104,16 @@ func Version() string { | |||
return dgraphVersion | |||
} | |||
|
|||
// pattern for dev version = min. 7 hex digits of commit-hash. | |||
var versionRe *regexp.Regexp = regexp.MustCompile(`-g[[:xdigit:]]{7,}`) |
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.
File is not gofmt
-ed with -s
(from gofmt
)
var versionRe *regexp.Regexp = regexp.MustCompile(`-g[[:xdigit:]]{7,}`) | |
var versionRe *regexp.Regexp = regexp.MustCompile(`-g[[:xdigit:]]{7,}`) | |
Description.
Check for git commit hash in the version string to infer dev environment for Sentry. We now have 4 possible sentry enviroments:
GitHub Issue or Jira number.
https://dgraph.atlassian.net/browse/DGRAPH-1164
Other components or 3rd party tools affected (or regression areas).
Affected releases.
20.07
Changelog tags.
Please indicate if this is a breaking change.
Please indicate if this is an enterprise feature.
Please indicate if documentation needs to be updated.
Please indicate if end to end testing is needed.
This change is