TUN-2500: Don't send client registration errors to Sentry

This commit is contained in:
Areg Harutyunyan 2019-11-04 15:11:54 +04:00
parent e5335b6c1b
commit 068b148e05
1 changed files with 11 additions and 4 deletions

View File

@ -23,7 +23,6 @@ import (
"github.com/cloudflare/cloudflared/validation" "github.com/cloudflare/cloudflared/validation"
"github.com/cloudflare/cloudflared/websocket" "github.com/cloudflare/cloudflared/websocket"
raven "github.com/getsentry/raven-go"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
@ -165,7 +164,15 @@ func ServeTunnelLoop(ctx context.Context,
// Ensure the above goroutine will terminate if we return without connecting // Ensure the above goroutine will terminate if we return without connecting
defer connectedFuse.Fuse(false) defer connectedFuse.Fuse(false)
for { for {
err, recoverable := ServeTunnel(ctx, config, connectionLogger, addr, connectionID, connectedFuse, &backoff, u) err, recoverable := ServeTunnel(
ctx,
config,
connectionLogger,
addr, connectionID,
connectedFuse,
&backoff,
u,
)
if recoverable { if recoverable {
if duration, ok := backoff.GetBackoffDuration(ctx); ok { if duration, ok := backoff.GetBackoffDuration(ctx); ok {
connectionLogger.Infof("Retrying in %s seconds", duration) connectionLogger.Infof("Retrying in %s seconds", duration)
@ -260,6 +267,8 @@ func ServeTunnel(
err = errGroup.Wait() err = errGroup.Wait()
if err != nil { if err != nil {
_ = newClientRegisterTunnelError(err, config.Metrics.regFail)
switch castedErr := err.(type) { switch castedErr := err.(type) {
case dupConnRegisterTunnelError: case dupConnRegisterTunnelError:
logger.Info("Already connected to this server, selecting a different one") logger.Info("Already connected to this server, selecting a different one")
@ -274,14 +283,12 @@ func ServeTunnel(
return castedErr.cause, !castedErr.permanent return castedErr.cause, !castedErr.permanent
case clientRegisterTunnelError: case clientRegisterTunnelError:
logger.WithError(castedErr.cause).Error("Register tunnel error on client side") logger.WithError(castedErr.cause).Error("Register tunnel error on client side")
raven.CaptureError(castedErr.cause, tags)
return err, true return err, true
case muxerShutdownError: case muxerShutdownError:
logger.Infof("Muxer shutdown") logger.Infof("Muxer shutdown")
return err, true return err, true
default: default:
logger.WithError(err).Error("Serve tunnel error") logger.WithError(err).Error("Serve tunnel error")
raven.CaptureError(err, tags)
return err, true return err, true
} }
} }