diff --git a/internal/helper/logging.go b/internal/helper/logging.go index ec550bcf26907debeb6842f075bb4122c5f1d4b2..3b95b1d99f20f1d3a00c11d274ecb720a03f3975 100644 --- a/internal/helper/logging.go +++ b/internal/helper/logging.go @@ -36,6 +36,14 @@ var ( }, []string{"ci"}, ) + + cloneFetchBytes = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "gitlab_workhorse_git_clone_fetch_bytes", + Help: "How many Git clone/fetch bytes for CI have been send by gitlab-workhorse, partitioned by CI yes/no status.", + }, + []string{"ci"}, + ) ) func init() { @@ -51,6 +59,7 @@ func registerPrometheusMetrics() { prometheus.MustRegister(sessionsActive) prometheus.MustRegister(requestsTotal) prometheus.MustRegister(cloneFetchRequests) + prometheus.MustRegister(cloneFetchBytes) } type LoggingResponseWriter struct { @@ -118,4 +127,5 @@ func (l *LoggingResponseWriter) countCloneFetchRequests(r *http.Request) { } cloneFetchRequests.WithLabelValues(forCi).Inc() + cloneFetchBytes.WithLabelValues(forCi).Add(float64(l.written)) }