summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2021-07-27 14:54:14 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2021-07-27 17:59:26 +0300
commit4e3ff70b119eb25abb8fd9e3d31cd184643206f0 (patch)
tree2cc7d80f330ec6d947acd9e8e82e7e7948de3965
parentf6baecaa794ef85b144fa9cd05940e3f020b4a0e (diff)
downloadgitlab-shell-id-gitlab-sshd-in-a-single-span.tar.gz
Unify all operations within same connection into spanid-gitlab-sshd-in-a-single-span
-rw-r--r--go.mod1
-rw-r--r--internal/sshd/sshd.go4
2 files changed, 5 insertions, 0 deletions
diff --git a/go.mod b/go.mod
index f0fe06d..1a44922 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 b918109..6e6d587 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")