-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
instrumentation: add telemetry around failures (#207)
This will start collecting errors. We can continue tweaking this, but this will get us to the basics at least. == In scope: - Reporting the Go version - Reporting the OS type - Reproting the architecture (e.g. amd64) == Out of scope: - Discerning the different error types we have. For now, any errors will get sent.
- Loading branch information
Showing
36 changed files
with
5,786 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,13 @@ jobs: | |
with: | ||
go-version: 1.16 | ||
|
||
- name: Prepare instrumentation | ||
run: | | ||
echo -n "$SENTRY_DSN" >> $GITHUB_WORKSPACE/internal/instrumentation/sentry_dsn | ||
shell: bash | ||
env: | ||
SENTRY_DSN : ${{secrets.SENTRY_DSN}} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package instrumentation | ||
|
||
import ( | ||
_ "embed" | ||
"time" | ||
|
||
"github.com/getsentry/sentry-go" | ||
) | ||
|
||
//go:embed sentrydsn.txt | ||
var sentryDSN string | ||
|
||
// ReportException is designed to be called once as the CLI exits. We're | ||
// purposefully initializing a client all the time given this context. | ||
func ReportException(err error) { | ||
if sentryDSN == "" { | ||
return | ||
} | ||
|
||
if err := sentry.Init(sentry.ClientOptions{Dsn: sentryDSN}); err != nil { | ||
return | ||
} | ||
|
||
// Flush buffered events before the program terminates. | ||
sentry.CaptureException(err) | ||
|
||
// Allow up to 2s to flush, otherwise quit. | ||
sentry.Flush(2 * time.Second) | ||
} |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
vendor/github.com/getsentry/sentry-go/.golangci.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.