Commit bad25752 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Count git clone/fetch bytes send

parent be1c3faa
...@@ -36,6 +36,14 @@ var ( ...@@ -36,6 +36,14 @@ var (
}, },
[]string{"ci"}, []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() { func init() {
...@@ -51,6 +59,7 @@ func registerPrometheusMetrics() { ...@@ -51,6 +59,7 @@ func registerPrometheusMetrics() {
prometheus.MustRegister(sessionsActive) prometheus.MustRegister(sessionsActive)
prometheus.MustRegister(requestsTotal) prometheus.MustRegister(requestsTotal)
prometheus.MustRegister(cloneFetchRequests) prometheus.MustRegister(cloneFetchRequests)
prometheus.MustRegister(cloneFetchBytes)
} }
type LoggingResponseWriter struct { type LoggingResponseWriter struct {
...@@ -118,4 +127,5 @@ func (l *LoggingResponseWriter) countCloneFetchRequests(r *http.Request) { ...@@ -118,4 +127,5 @@ func (l *LoggingResponseWriter) countCloneFetchRequests(r *http.Request) {
} }
cloneFetchRequests.WithLabelValues(forCi).Inc() cloneFetchRequests.WithLabelValues(forCi).Inc()
cloneFetchBytes.WithLabelValues(forCi).Add(float64(l.written))
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment