summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-07-20 16:31:09 +0000
committerNick Thomas <nick@gitlab.com>2021-07-20 16:31:09 +0000
commit50da611814d256c77e689977265ec7e07633a4dc (patch)
treeb72fbdeae3ac5345c4fc0950fd32a83523ae9b19
parent8c932b0d5a698ea6b9a770be8f8c6ecc58b38727 (diff)
parentaf6b041069f731ee16b0855306d7deeb74240ae9 (diff)
downloadgitlab-shell-50da611814d256c77e689977265ec7e07633a4dc.tar.gz
Merge branch 'igorwwwwwwwwwwwwwwwwwwww-main-patch-84756' into 'main'
Add tracing instrumentation to http client See merge request gitlab-org/gitlab-shell!495
-rw-r--r--client/httpclient.go3
-rw-r--r--internal/config/config.go14
2 files changed, 6 insertions, 11 deletions
diff --git a/client/httpclient.go b/client/httpclient.go
index 1ae4420..0dcec94 100644
--- a/client/httpclient.go
+++ b/client/httpclient.go
@@ -14,6 +14,7 @@ import (
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/labkit/correlation"
+ "gitlab.com/gitlab-org/labkit/tracing"
)
const (
@@ -85,7 +86,7 @@ func NewHTTPClientWithOpts(gitlabURL, gitlabRelativeURLRoot, caFile, caPath stri
}
c := &http.Client{
- Transport: correlation.NewInstrumentedRoundTripper(transport),
+ Transport: correlation.NewInstrumentedRoundTripper(tracing.NewRoundTripper(transport)),
Timeout: readTimeout(readTimeoutSeconds),
}
diff --git a/internal/config/config.go b/internal/config/config.go
index 71e7840..4c75ad5 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -10,7 +10,6 @@ import (
"sync"
"time"
- "gitlab.com/gitlab-org/labkit/tracing"
yaml "gopkg.in/yaml.v2"
"gitlab.com/gitlab-org/gitlab-shell/client"
@@ -73,9 +72,9 @@ var (
Listen: "[::]:22",
WebListen: "localhost:9122",
ConcurrentSessionsLimit: 10,
- GracePeriodSeconds: 10,
- ReadinessProbe: "/start",
- LivenessProbe: "/health",
+ GracePeriodSeconds: 10,
+ ReadinessProbe: "/start",
+ LivenessProbe: "/health",
HostKeyFiles: []string{
"/run/secrets/ssh-hostkeys/ssh_host_rsa_key",
"/run/secrets/ssh-hostkeys/ssh_host_ecdsa_key",
@@ -96,7 +95,7 @@ func (c *Config) ApplyGlobalState() {
func (c *Config) HttpClient() *client.HttpClient {
c.httpClientOnce.Do(func() {
- client := client.NewHTTPClient(
+ c.httpClient = client.NewHTTPClient(
c.GitlabUrl,
c.GitlabRelativeURLRoot,
c.HttpSettings.CaFile,
@@ -104,11 +103,6 @@ func (c *Config) HttpClient() *client.HttpClient {
c.HttpSettings.SelfSignedCert,
c.HttpSettings.ReadTimeoutSeconds,
)
-
- tr := client.Transport
- client.Transport = tracing.NewRoundTripper(tr)
-
- c.httpClient = client
})
return c.httpClient