aboutsummaryrefslogtreecommitdiff
path: root/weed/weed.go
diff options
context:
space:
mode:
authorNikita Korolev <66738864+doc-sheet@users.noreply.github.com>2024-03-22 17:10:57 +0300
committerGitHub <noreply@github.com>2024-03-22 07:10:57 -0700
commit953f5713490343f3cb4d36eb17bae9e8716068b4 (patch)
tree034529f51f2e38f7f1d0ef2d89ebdd4754c955a7 /weed/weed.go
parent61f4e40ad9e8abe1c78026b47cd8fce4eb4bd6ea (diff)
downloadseaweedfs-953f5713490343f3cb4d36eb17bae9e8716068b4.tar.xz
seaweedfs-953f5713490343f3cb4d36eb17bae9e8716068b4.zip
add basic support for sentry error reporting (#5410)
Diffstat (limited to 'weed/weed.go')
-rw-r--r--weed/weed.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/weed/weed.go b/weed/weed.go
index 773d86274..a821cd72f 100644
--- a/weed/weed.go
+++ b/weed/weed.go
@@ -9,6 +9,7 @@ import (
"strings"
"sync"
"text/template"
+ "time"
"unicode"
"unicode/utf8"
@@ -16,6 +17,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/util"
flag "github.com/seaweedfs/seaweedfs/weed/util/fla9"
+ "github.com/getsentry/sentry-go"
"github.com/seaweedfs/seaweedfs/weed/command"
"github.com/seaweedfs/seaweedfs/weed/glog"
)
@@ -49,6 +51,19 @@ func main() {
glog.MaxFileCount = 5
flag.Usage = usage
+ err := sentry.Init(sentry.ClientOptions{
+ SampleRate: 0.1,
+ EnableTracing: true,
+ TracesSampleRate: 0.1,
+ ProfilesSampleRate: 0.1,
+ })
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "sentry.Init: %v", err)
+ }
+ // Flush buffered events before the program terminates.
+ // Set the timeout to the maximum duration the program can afford to wait.
+ defer sentry.Flush(2 * time.Second)
+
if command.AutocompleteMain(commands) {
return
}