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:
authorJacob Vosmaer <jacob@gitlab.com>2019-07-11 14:03:11 +0300
committerJacob Vosmaer <jacob@gitlab.com>2019-07-11 14:03:11 +0300
commit666a2ab588b9e7340c300ec0c72286727fd3b429 (patch)
tree18c7e238bf27b5cb6492e35e7d6809a8d27c45c4
parent3af6f5daf3c0681d486a004b634758680b39f4b0 (diff)
Count catfile object types
-rw-r--r--internal/git/catfile/catfile.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/git/catfile/catfile.go b/internal/git/catfile/catfile.go
index 288470170..01c6f9cd6 100644
--- a/internal/git/catfile/catfile.go
+++ b/internal/git/catfile/catfile.go
@@ -34,6 +34,14 @@ var totalCatfileProcesses = prometheus.NewCounter(
},
)
+var catfileLookupCounter = prometheus.NewCounterVec(
+ prometheus.CounterOpts{
+ Name: "gitaly_catfile_lookups_total",
+ Help: "Git catfile lookups by object type",
+ },
+ []string{"type"},
+)
+
const (
// CacheFeatureFlagKey is the feature flag key for catfile batch caching. This should match
// what is in gitlab-ce
@@ -44,6 +52,7 @@ func init() {
prometheus.MustRegister(catfileCacheCounter)
prometheus.MustRegister(currentCatfileProcesses)
prometheus.MustRegister(totalCatfileProcesses)
+ prometheus.MustRegister(catfileLookupCounter)
}
// Batch abstracts 'git cat-file --batch' and 'git cat-file --batch-check'.
@@ -62,6 +71,7 @@ type Batch struct {
// Info returns an ObjectInfo if spec exists. If spec does not exist the
// error is of type NotFoundError.
func (c *Batch) Info(revspec string) (*ObjectInfo, error) {
+ catfileLookupCounter.WithLabelValues("info").Inc()
return c.batchCheck.info(revspec)
}
@@ -70,6 +80,7 @@ func (c *Batch) Info(revspec string) (*ObjectInfo, error) {
// and check the object type. Caller must consume the Reader before
// making another call on C.
func (c *Batch) Tree(revspec string) (io.Reader, error) {
+ catfileLookupCounter.WithLabelValues("tree").Inc()
return c.batchProcess.reader(revspec, "tree")
}
@@ -78,6 +89,7 @@ func (c *Batch) Tree(revspec string) (io.Reader, error) {
// and check the object type. Caller must consume the Reader before
// making another call on C.
func (c *Batch) Commit(revspec string) (io.Reader, error) {
+ catfileLookupCounter.WithLabelValues("commit").Inc()
return c.batchProcess.reader(revspec, "commit")
}
@@ -87,12 +99,14 @@ func (c *Batch) Commit(revspec string) (io.Reader, error) {
// It is an error if revspec does not point to a blob. To prevent this
// first use Info to resolve the revspec and check the object type.
func (c *Batch) Blob(revspec string) (io.Reader, error) {
+ catfileLookupCounter.WithLabelValues("blob").Inc()
return c.batchProcess.reader(revspec, "blob")
}
// Tag returns a raw tag object. Caller must consume the Reader before
// making another call on C.
func (c *Batch) Tag(revspec string) (io.Reader, error) {
+ catfileLookupCounter.WithLabelValues("tag").Inc()
return c.batchProcess.reader(revspec, "tag")
}