mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 01:23:36 +08:00
add basic support for sentry error reporting (#5410)
This commit is contained in:
15
weed/weed.go
15
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user