Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2020-05-04 15:26:16 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2020-05-04 15:26:16 +0300
commit03461ddde0118130a8943e4d1efbde66434e1d35 (patch)
treeff61466153e4e052d813d8281b0789035d1d8f8b /app.go
parentdd46b590ff7bbd6a628acbd7191f5e31847a4c52 (diff)
Add a prometheus counter for GitLab API call failures
Diffstat (limited to 'app.go')
-rw-r--r--app.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/app.go b/app.go
index ea25ba53..0d628864 100644
--- a/app.go
+++ b/app.go
@@ -11,7 +11,7 @@ import (
"github.com/rs/cors"
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/labkit/errortracking"
- "gitlab.com/gitlab-org/labkit/metrics"
+ labmetrics "gitlab.com/gitlab-org/labkit/metrics"
mimedb "gitlab.com/lupine/go-mimedb"
"gitlab.com/gitlab-org/gitlab-pages/internal/acme"
@@ -25,6 +25,7 @@ import (
"gitlab.com/gitlab-org/gitlab-pages/internal/netutil"
"gitlab.com/gitlab-org/gitlab-pages/internal/request"
"gitlab.com/gitlab-org/gitlab-pages/internal/source"
+ "gitlab.com/gitlab-org/gitlab-pages/metrics"
)
const (
@@ -159,6 +160,7 @@ func (a *theApp) routingMiddleware(handler http.Handler) http.Handler {
// middleware chain and simply respond with 502 after logging this
host, domain, err := a.getHostAndDomain(r)
if err != nil {
+ metrics.DomainsSourceFailures.Inc()
log.WithError(err).Error("could not fetch domain information from a source")
httperrors.Serve502(w)
@@ -331,7 +333,7 @@ func (a *theApp) buildHandlerPipeline() (http.Handler, error) {
}
// Metrics
- metricsMiddleware := metrics.NewHandlerFactory(metrics.WithNamespace("gitlab_pages"))
+ metricsMiddleware := labmetrics.NewHandlerFactory(labmetrics.WithNamespace("gitlab_pages"))
handler = metricsMiddleware(handler)
handler = a.routingMiddleware(handler)