Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sentry.go « config « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f67169b831bc8e95d8635a6a83cf92624363cb25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package config

import (
	"fmt"

	"github.com/getsentry/raven-go"
	log "github.com/sirupsen/logrus"
	"gitlab.com/gitlab-org/gitaly/internal/middleware/panichandler"
)

// ConfigureSentry configures the sentry DSN
func ConfigureSentry(version string) {
	if Config.Logging.SentryDSN == "" {
		return
	}

	log.Debug("Using sentry logging")
	raven.SetDSN(Config.Logging.SentryDSN)
	if version != "" {
		raven.SetRelease("v" + version)
	}

	panichandler.InstallPanicHandler(func(grpcMethod string, _err interface{}) {
		err, ok := _err.(error)
		if !ok {
			err = fmt.Errorf("%v", _err)
		}

		raven.CaptureError(err, map[string]string{
			"grpcMethod": grpcMethod,
			"panic":      "1",
		})
	})
}