diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 12:08:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 12:08:51 +0000 |
commit | 8c4198cbe631278e87fee04157d23494fbb80cdb (patch) | |
tree | d35cf498af480389796fd9e5cb4bcc903aea60f3 /lib/gitlab | |
parent | 1ac794623a8be5dee111716a44dd04ff708f3541 (diff) | |
download | gitlab-ce-8c4198cbe631278e87fee04157d23494fbb80cdb.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/git/blob.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index ba1a474c523..caa1314dd7f 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -124,11 +124,12 @@ 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 + + record_metric_blob_size + record_metric_truncated(truncated?) end def binary_in_repo? @@ -210,6 +211,14 @@ module Gitlab self.class.gitlab_blob_size.observe({}, size) end + def record_metric_truncated(bool) + if bool + self.class.gitlab_blob_truncated_true.increment + else + self.class.gitlab_blob_truncated_false.increment + end + end + def has_lfs_version_key? !empty? && text_in_repo? && data.start_with?("version https://git-lfs.github.com/spec") end |