diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-06-01 07:08:45 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-06-01 07:08:45 +0300 |
commit | 93566c8f6f83fb7877b61ae9142995e3a1703152 (patch) | |
tree | 2a9489591bc24b1f86d40e9db0b961b59a251596 | |
parent | d820de93ee18a6c052fd73df6743718424f00e8f (diff) | |
parent | 0eb40887915d8d76b2f23000c4c64d5b01487b32 (diff) |
Merge branch 'fix/domain-fail-metric' into 'master'
fix: move DomainsSourceFailures increase into the gitlab client
See merge request gitlab-org/gitlab-pages!773
-rw-r--r-- | internal/routing/middleware.go | 2 | ||||
-rw-r--r-- | internal/source/gitlab/client/client.go | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/internal/routing/middleware.go b/internal/routing/middleware.go index 712e22a3..bee7c9df 100644 --- a/internal/routing/middleware.go +++ b/internal/routing/middleware.go @@ -9,7 +9,6 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/logging" "gitlab.com/gitlab-org/gitlab-pages/internal/request" "gitlab.com/gitlab-org/gitlab-pages/internal/source" - "gitlab.com/gitlab-org/gitlab-pages/metrics" ) // NewMiddleware returns middleware which determine the host and domain for the request, for @@ -20,7 +19,6 @@ func NewMiddleware(handler http.Handler, s source.Source) http.Handler { // middleware chain and simply respond with 502 after logging this d, err := getDomain(r, s) if err != nil && !errors.Is(err, domain.ErrDomainDoesNotExist) { - metrics.DomainsSourceFailures.Inc() logging.LogRequest(r).WithError(err).Error("could not fetch domain information from a source") httperrors.Serve502(w) diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go index 4fd2363b..75868cce 100644 --- a/internal/source/gitlab/client/client.go +++ b/internal/source/gitlab/client/client.go @@ -105,6 +105,7 @@ func (gc *Client) GetLookup(ctx context.Context, host string) api.Lookup { resp, err := gc.get(ctx, "/api/v4/internal/pages", params) if err != nil { + metrics.DomainsSourceFailures.Inc() return api.Lookup{Name: host, Error: err} } |