diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-04-27 12:04:23 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-04-27 12:13:12 +0300 |
commit | 540da445f858fffafcc7dbc71610494009900a0e (patch) | |
tree | c6aee9857dfa96b30890b635117ef8ac09b17049 /cmd/gitaly-lfs-smudge | |
parent | 99ce0e45396ccb7c39821c9a874ddcd75ed5951f (diff) |
gitlab: Implement metric to measure latency of API calls
On various mutating operations, we're calling GitLab's internal API to
verify that the mutating operation is in fact allowed for the user.
These checks may take a significant amount of time, as GitLab will do
deep inspection of the proposed changes by calling various API endpoints
of Gitaly. But right now, it is quite hard to see exactly _how_ long
they take because 1. the correlation ID gets lost and 2. we only log
when the POST to the internal API finished, but never when it started.
The first pain point needs to be fixed on Rails side: we already send
the X-Request-Id header via the gitlabnet client implementation. So we
instead improve observability at least a bit by implementing latency
metrics which measure how long each of the POSTs is taking.
Diffstat (limited to 'cmd/gitaly-lfs-smudge')
-rw-r--r-- | cmd/gitaly-lfs-smudge/lfs_smudge.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/gitaly-lfs-smudge/lfs_smudge.go b/cmd/gitaly-lfs-smudge/lfs_smudge.go index f40fb2405..c132f15d9 100644 --- a/cmd/gitaly-lfs-smudge/lfs_smudge.go +++ b/cmd/gitaly-lfs-smudge/lfs_smudge.go @@ -11,6 +11,7 @@ import ( "github.com/git-lfs/git-lfs/lfs" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" + "gitlab.com/gitlab-org/gitaly/internal/gitaly/config/prometheus" "gitlab.com/gitlab-org/gitaly/internal/gitlab" gitalylog "gitlab.com/gitlab-org/gitaly/internal/log" "gitlab.com/gitlab-org/labkit/log" @@ -78,7 +79,7 @@ func handleSmudge(to io.Writer, from io.Reader, config configProvider) (io.Reade WithField("gitaly_tls_config", tlsCfg). Debug("loaded GitLab API config") - client, err := gitlab.NewHTTPClient(glCfg, tlsCfg) + client, err := gitlab.NewHTTPClient(glCfg, tlsCfg, prometheus.Config{}) if err != nil { return contents, err } |