Skip to content

Commit 550c37e

Browse files
Add Sentry error reporting
1 parent 10d8564 commit 550c37e

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

cmd/depot/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package main
22

33
import (
4+
"log"
45
"os"
56

67
"github.com/depot/cli/internal/build"
78
"github.com/depot/cli/pkg/cmd/root"
9+
"github.com/getsentry/sentry-go"
810
)
911

1012
func main() {
@@ -13,6 +15,15 @@ func main() {
1315
}
1416

1517
func runMain() int {
18+
if os.Getenv("DEPOT_ERROR_TELEMETRY") != "0" {
19+
err := sentry.Init(sentry.ClientOptions{
20+
Dsn: "https://[email protected]/6271909",
21+
})
22+
if err != nil {
23+
log.Fatalf("sentry.Init: %s", err)
24+
}
25+
}
26+
1627
buildVersion := build.Version
1728
buildDate := build.Date
1829

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/docker/distribution v2.8.0+incompatible
1212
github.com/docker/docker v20.10.7+incompatible
1313
github.com/docker/go-units v0.4.0
14+
github.com/getsentry/sentry-go v0.13.0
1415
github.com/moby/buildkit v0.10.0-rc2.0.20220308185020-fdecd0ae108b
1516
github.com/morikuni/aec v1.0.0
1617
github.com/pkg/errors v0.9.1

0 commit comments

Comments
 (0)