-
Notifications
You must be signed in to change notification settings - Fork 218
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
Telemetry should send the failure message #78
Conversation
} | ||
if runErr != nil { | ||
evt.Failed = true | ||
evt.FailedMsg = runErr.Error() |
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 might be a good idea to only track a distinct error type so that we can redact errors for analytics. Otherwise I worry that we might return an error with sensitive info somewhere else in the code and accidentally log it.
Maybe something like this?
type RedactedError interface {
Redact() string
}
func (m *telemetryMiddleware) postRun(cmd *cobra.Command, args []string, runErr error) {
// ...
if runErr != nil {
evt.Failed = true
if redactErr, ok := runErr.(RedactedError); ok {
evt.FailedMsg = redactErr.Redact()
}
}
}
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.
I like the idea, but I'm also worried this means we will not capture a bunch of errors as a result. I'm trying to think if there's an in-between.
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.
Another option is to do redacted format strings.
// Not sure on the naming or if it should go in a new package.
type SafeError struct {
format string
args []any
}
func (e *SafeError) Redacted() string {
// This is ugly. You could probably do something fancier by substituting
// the args with something else of the same type. Or use a template string
// instead of fmt.
return format
}
func (e *SafeError) Error() string {
return fmt.Sprintf(e.format, e.args...)
}
Abandoning in favor of Lucille's Sentry implementation. |
## Summary This replaces #78 This PR does the following: 1. logs error to sentry. Sentry has built in support for removing sensitive data. 2. link the telemetry event to the sentry error event id TODO: update github action environment variables ## How was it tested? go build devbox plan (on an invalid project config)
Summary
Telemetry should send the failure message whenever there's an error. That will allow us to understand what the errors are and how to fix them.
How was it tested?
Development version of segment.