Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Sentry #15861

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-eagles-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#removed Sentry support.
38 changes: 0 additions & 38 deletions core/cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/Depado/ginprom"
"github.com/Masterminds/semver/v3"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
Expand Down Expand Up @@ -426,10 +425,6 @@ func (n ChainlinkRunner) Run(ctx context.Context, app chainlink.Application) err
app.GetLogger().Debugf("%-6s %-25s --> %s (%d handlers)", httpMethod, absolutePath, handlerName, nuHandlers)
}

if err := sentryInit(config.Sentry()); err != nil {
return errors.Wrap(err, "failed to initialize sentry")
}

ws := config.WebServer()
if ws.HTTPPort() == 0 && ws.TLS().HTTPSPort() == 0 {
return errors.New("You must specify at least one port to listen on")
Expand Down Expand Up @@ -476,39 +471,6 @@ func (n ChainlinkRunner) Run(ctx context.Context, app chainlink.Application) err
return errors.WithStack(g.Wait())
}

func sentryInit(cfg config.Sentry) error {
sentrydsn := cfg.DSN()
if sentrydsn == "" {
// Do not initialize sentry at all if the DSN is missing
return nil
}

var sentryenv string
if env := cfg.Environment(); env != "" {
sentryenv = env
} else if !build.IsProd() {
sentryenv = "dev"
} else {
sentryenv = "prod"
}

var sentryrelease string
if release := cfg.Release(); release != "" {
sentryrelease = release
} else {
sentryrelease = static.Version
}

return sentry.Init(sentry.ClientOptions{
// AttachStacktrace is needed to send stacktrace alongside panics
AttachStacktrace: true,
Dsn: sentrydsn,
Environment: sentryenv,
Release: sentryrelease,
Debug: cfg.Debug(),
})
}

func tryRunServerUntilCancelled(ctx context.Context, lggr logger.Logger, timeout time.Duration, runServer func() error) {
for {
// try calling runServer() and log error if any
Expand Down
1 change: 0 additions & 1 deletion core/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type AppConfig interface {
Password() Password
Prometheus() Prometheus
Pyroscope() Pyroscope
Sentry() Sentry
TelemetryIngress() TelemetryIngress
Threshold() Threshold
WebServer() WebServer
Expand Down
12 changes: 0 additions & 12 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -608,18 +608,6 @@ ServerAddress = 'http://localhost:4040' # Example
# Environment sets the target environment tag in which profiles will be added to.
Environment = 'mainnet' # Default

[Sentry]
# **ADVANCED**
# Debug enables printing of Sentry SDK debug messages.
Debug = false # Default
# DSN is the data source name where events will be sent. Sentry is completely disabled if this is left blank.
DSN = 'sentry-dsn' # Example
# Environment overrides the Sentry environment to the given value. Otherwise autodetects between dev/prod.
Environment = 'my-custom-env' # Example
# Release overrides the Sentry release to the given value. Otherwise uses the compiled-in version number.
Release = 'v1.2.3' # Example


# Insecure config family is only allowed in development builds.
[Insecure]
# **ADVANCED**
Expand Down
8 changes: 0 additions & 8 deletions core/config/sentry_config.go

This file was deleted.

24 changes: 0 additions & 24 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type Core struct {
Keeper Keeper `toml:",omitempty"`
AutoPprof AutoPprof `toml:",omitempty"`
Pyroscope Pyroscope `toml:",omitempty"`
Sentry Sentry `toml:",omitempty"`
Insecure Insecure `toml:",omitempty"`
Tracing Tracing `toml:",omitempty"`
Mercury Mercury `toml:",omitempty"`
Expand Down Expand Up @@ -92,7 +91,6 @@ func (c *Core) SetFrom(f *Core) {

c.AutoPprof.setFrom(&f.AutoPprof)
c.Pyroscope.setFrom(&f.Pyroscope)
c.Sentry.setFrom(&f.Sentry)
c.Insecure.setFrom(&f.Insecure)
c.Tracing.setFrom(&f.Tracing)
c.Telemetry.setFrom(&f.Telemetry)
Expand Down Expand Up @@ -1221,28 +1219,6 @@ func (p *Pyroscope) setFrom(f *Pyroscope) {
}
}

type Sentry struct {
Debug *bool
DSN *string
Environment *string
Release *string
}

func (s *Sentry) setFrom(f *Sentry) {
if v := f.Debug; v != nil {
s.Debug = f.Debug
}
if v := f.DSN; v != nil {
s.DSN = f.DSN
}
if v := f.Environment; v != nil {
s.Environment = f.Environment
}
if v := f.Release; v != nil {
s.Release = f.Release
}
}

type Insecure struct {
DevWebServer *bool
OCRDevelopmentMode *bool
Expand Down
7 changes: 1 addition & 6 deletions core/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ type Logger interface {

// Name returns the fully qualified name of the logger.
Name() string

// Recover reports recovered panics; this is useful because it avoids
// double-reporting to sentry
Recover(panicErr interface{})
}

// newZapConfigProd returns a new production zap.Config.
Expand Down Expand Up @@ -169,7 +165,7 @@ type Config struct {
testDiskLogLvlChan chan zapcore.Level
}

// New returns a new Logger with pretty printing to stdout, prometheus counters, and sentry forwarding.
// New returns a new Logger with pretty printing to stdout and prometheus counters.
// Tests should use TestLogger.
func (c *Config) New() (Logger, func() error) {
if c.diskSpaceAvailableFn == nil {
Expand All @@ -195,7 +191,6 @@ func (c *Config) New() (Logger, func() error) {
log.Fatal(err)
}

l = newSentryLogger(l)
l = newPrometheusLogger(l)
l = l.With("version", verShaNameStatic())
return l, closeLogger
Expand Down
33 changes: 0 additions & 33 deletions core/logger/logger_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion core/logger/null_logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func TestNullLogger(t *testing.T) {
l.Criticalw("msg")
l.Panicw("msg")
l.Fatalw("msg")
l.Recover(nil)
assert.Nil(t, l.Sync())
})
}
4 changes: 0 additions & 4 deletions core/logger/passthrough_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func TestLogger_Passthrough(t *testing.T) {
create func(passthrough Logger) Logger
}{
{"prometheus", newPrometheusLogger},
{"sentry", newSentryLogger},
}

for _, test := range tests {
Expand Down Expand Up @@ -68,8 +67,6 @@ func TestLogger_Passthrough(t *testing.T) {

err := l.Sync()
assert.ErrorIs(t, err, errTest)

l.Recover(errTest)
})
}
}
Expand Down Expand Up @@ -111,7 +108,6 @@ func setupMockLogger(t *testing.T) *MockLogger {

ml.On("Sync").Return(errTest).Once()
ml.On("Name").Return("mockLogger").Once()
ml.On("Recover", errTest).Once()

return ml
}
5 changes: 0 additions & 5 deletions core/logger/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,3 @@ func (s *prometheusLogger) Helper(add int) Logger {
s.fatalCnt,
}
}

func (s *prometheusLogger) Recover(panicErr interface{}) {
s.panicCnt.Inc()
s.h.Recover(panicErr)
}
3 changes: 1 addition & 2 deletions core/logger/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ func TestPrometheusLogger_Counters(t *testing.T) {

l.Panicf("msg")
l.Panicw("msg")
l.Recover(nil)
assertCounterValue(t, panicCounter, 9)
assertCounterValue(t, panicCounter, 8)

l.Fatalf("msg")
l.Fatalw("msg")
Expand Down
Loading
Loading