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

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Wiedler <iwiedler@gitlab.com>2020-08-26 12:56:57 +0300
committerIgor Wiedler <iwiedler@gitlab.com>2020-08-26 12:59:18 +0300
commit166dce9c130ce803d9a817926e5431be1b282e93 (patch)
treefed2c0d8adb2a33a2b4994b15ede2bea55a9baf3
parentc681e8d76689516be2e4f141a48fb11f13273884 (diff)
concept: log packfile negotiation stats per RPCconcept-packfile-logging
-rw-r--r--internal/git/stats/packfile_negotiation.go13
-rw-r--r--internal/service/smarthttp/upload_pack.go2
-rw-r--r--internal/service/ssh/upload_pack.go2
3 files changed, 14 insertions, 3 deletions
diff --git a/internal/git/stats/packfile_negotiation.go b/internal/git/stats/packfile_negotiation.go
index 266d2d545..7a14a5726 100644
--- a/internal/git/stats/packfile_negotiation.go
+++ b/internal/git/stats/packfile_negotiation.go
@@ -1,6 +1,7 @@
package stats
import (
+ "context"
"errors"
"fmt"
"io"
@@ -8,6 +9,7 @@ import (
"strings"
"github.com/prometheus/client_golang/prometheus"
+ "gitlab.com/gitlab-org/gitaly/internal/command"
"gitlab.com/gitlab-org/gitaly/internal/git/pktline"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
)
@@ -106,7 +108,7 @@ func (n *PackfileNegotiation) Parse(body io.Reader) error {
// UpdateMetrics updates Prometheus counters with features that have been used
// during a packfile negotiation.
-func (n *PackfileNegotiation) UpdateMetrics(metrics *prometheus.CounterVec) {
+func (n *PackfileNegotiation) UpdateMetrics(ctx context.Context, metrics *prometheus.CounterVec) {
if n.Deepen != "" {
metrics.WithLabelValues("deepen").Inc()
}
@@ -117,4 +119,13 @@ func (n *PackfileNegotiation) UpdateMetrics(metrics *prometheus.CounterVec) {
metrics.WithLabelValues("have").Inc()
}
metrics.WithLabelValues("total").Inc()
+
+ stats := command.StatsFromContext(ctx)
+ if n.Deepen != "" {
+ stats.RecordSum("packfile_negotiation.deepen", 1)
+ }
+ if n.Filter != "" {
+ stats.RecordSum("packfile_negotiation.filter", 1)
+ }
+ stats.RecordSum("packfile_negotiation.haves", n.Haves)
}
diff --git a/internal/service/smarthttp/upload_pack.go b/internal/service/smarthttp/upload_pack.go
index a0107517b..295019840 100644
--- a/internal/service/smarthttp/upload_pack.go
+++ b/internal/service/smarthttp/upload_pack.go
@@ -49,7 +49,7 @@ func (s *server) PostUploadPack(stream gitalypb.SmartHTTPService_PostUploadPackS
ctxlogrus.Extract(stream.Context()).WithError(err).Debug("failed parsing packfile negotiation")
return
}
- stats.UpdateMetrics(s.packfileNegotiationMetrics)
+ stats.UpdateMetrics(ctx, s.packfileNegotiationMetrics)
statsCh <- stats
}()
diff --git a/internal/service/ssh/upload_pack.go b/internal/service/ssh/upload_pack.go
index 0c9e60342..696a33741 100644
--- a/internal/service/ssh/upload_pack.go
+++ b/internal/service/ssh/upload_pack.go
@@ -98,7 +98,7 @@ func (s *server) sshUploadPack(stream gitalypb.SSHService_SSHUploadPackServer, r
ctxlogrus.Extract(stream.Context()).WithError(err).Debug("failed parsing packfile negotiation")
return
}
- stats.UpdateMetrics(s.packfileNegotiationMetrics)
+ stats.UpdateMetrics(ctx, s.packfileNegotiationMetrics)
}()
cmd, monitor, err := monitorStdinCommand(ctx, stdin, stdout, stderr, env, globalOpts, git.SubCmd{