diff --git a/go.mod b/go.mod index f0fe06d4cce3930a1807c2964628f54f5b68774e..1a44922fdad30aa90447027c185532aa695daa76 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/mattn/go-shellwords v1.0.11 github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a + github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/otiai10/copy v1.4.2 github.com/pires/go-proxyproto v0.6.0 github.com/prometheus/client_golang v1.10.0 diff --git a/internal/sshd/sshd.go b/internal/sshd/sshd.go index b918109c65716b5a17e6434d08ac6a60b2f5578b..6e6d58706be75edb8abf49fd2938cad05b205972 100644 --- a/internal/sshd/sshd.go +++ b/internal/sshd/sshd.go @@ -12,6 +12,7 @@ import ( "sync" "time" + "github.com/opentracing/opentracing-go" "github.com/pires/go-proxyproto" "golang.org/x/crypto/ssh" @@ -216,6 +217,9 @@ func (s *Server) handleConn(ctx context.Context, nconn net.Conn) { ctx, cancel := context.WithCancel(correlation.ContextWithCorrelation(ctx, correlation.SafeRandomID())) defer cancel() + span, ctx := opentracing.StartSpanFromContext(ctx, "SSH connection") + defer span.Finish() + sconn, chans, reqs, err := ssh.NewServerConn(nconn, s.serverConfig(ctx)) if err != nil { log.WithError(err).Info("Failed to initialize SSH connection")