Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5541fde9
Commit
5541fde9
authored
Feb 18, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Being collecting blob size metrics
parent
da0e5519
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+8
-0
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+8
-0
No files found.
lib/gitlab/git/blob.rb
View file @
5541fde9
...
...
@@ -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
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
5541fde9
...
...
@@ -12,10 +12,18 @@ describe Gitlab::Git::Blob, :seed_helper do
let
(
:blob
)
{
Gitlab
::
Git
::
Blob
.
new
(
name:
'test'
)
}
it
'handles nil data'
do
expect
(
described_class
).
not_to
receive
(
:gitlab_blob_size
)
expect
(
blob
.
name
).
to
eq
(
'test'
)
expect
(
blob
.
size
).
to
eq
(
nil
)
expect
(
blob
.
loaded_size
).
to
eq
(
nil
)
end
it
'records blob size'
do
expect
(
described_class
).
to
receive
(
:gitlab_blob_size
).
and_call_original
Gitlab
::
Git
::
Blob
.
new
(
name:
'test'
,
size:
1234
)
end
end
shared_examples
'.find'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment