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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 15:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 15:09:13 +0300
commitcd3e2c7b9355f8990ab294b34b5e4add4f3985fa (patch)
tree77264b3e569ec95da8476f604d3d5cf4b03e85dc /lib
parentc1fc5da123a1fe670e32740669a9d5e59eff38f5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/highlight_cache.rb8
-rw-r--r--lib/gitlab/git/blob.rb8
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/diff/highlight_cache.rb b/lib/gitlab/diff/highlight_cache.rb
index 0a8fbb9a673..3940b3fca4b 100644
--- a/lib/gitlab/diff/highlight_cache.rb
+++ b/lib/gitlab/diff/highlight_cache.rb
@@ -17,6 +17,14 @@ module Gitlab
buckets [100, 1000, 10000, 100000, 1000000, 10000000]
end
+ define_counter :gitlab_redis_diff_caching_hit do
+ docstring 'Redis diff caching hits'
+ end
+
+ define_counter :gitlab_redis_diff_caching_miss do
+ docstring 'Redis diff caching misses'
+ end
+
def initialize(diff_collection)
@diff_collection = diff_collection
end
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb
index cbde713e3b9..ba1a474c523 100644
--- a/lib/gitlab/git/blob.rb
+++ b/lib/gitlab/git/blob.rb
@@ -124,6 +124,8 @@ module Gitlab
self.__send__("#{key}=", options[key.to_sym]) # rubocop:disable GitlabSecurity/PublicSend
end
+ record_metric_blob_size
+
# Retain the actual size before it is encoded
@loaded_size = @data.bytesize if @data
@loaded_all_data = @loaded_size == size
@@ -202,6 +204,12 @@ module Gitlab
private
+ def record_metric_blob_size
+ return unless size
+
+ self.class.gitlab_blob_size.observe({}, size)
+ end
+
def has_lfs_version_key?
!empty? && text_in_repo? && data.start_with?("version https://git-lfs.github.com/spec")
end