diff options
Diffstat (limited to 'internal/config/config.go')
-rw-r--r-- | internal/config/config.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 4c75ad5..ba21219 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -10,9 +10,11 @@ import ( "sync" "time" + "github.com/prometheus/client_golang/prometheus/promhttp" yaml "gopkg.in/yaml.v2" "gitlab.com/gitlab-org/gitlab-shell/client" + "gitlab.com/gitlab-org/gitlab-shell/internal/metrics" ) const ( @@ -95,7 +97,7 @@ func (c *Config) ApplyGlobalState() { func (c *Config) HttpClient() *client.HttpClient { c.httpClientOnce.Do(func() { - c.httpClient = client.NewHTTPClient( + client := client.NewHTTPClient( c.GitlabUrl, c.GitlabRelativeURLRoot, c.HttpSettings.CaFile, @@ -103,6 +105,12 @@ func (c *Config) HttpClient() *client.HttpClient { c.HttpSettings.SelfSignedCert, c.HttpSettings.ReadTimeoutSeconds, ) + + tr := client.Transport + client.Transport = promhttp.InstrumentRoundTripperDuration(metrics.HttpRequestDuration, tr) + + + c.httpClient = client }) return c.httpClient |