Commit 2718930b authored by Kerri Miller's avatar Kerri Miller

Define counter for #truncated?

parent f378b397
...@@ -5,6 +5,7 @@ module Gitlab ...@@ -5,6 +5,7 @@ module Gitlab
class Blob class Blob
include Gitlab::BlobHelper include Gitlab::BlobHelper
include Gitlab::EncodingHelper include Gitlab::EncodingHelper
include Gitlab::Metrics::Methods
extend Gitlab::Git::WrapsGitalyErrors extend Gitlab::Git::WrapsGitalyErrors
# This number is the maximum amount of data that we want to display to # This number is the maximum amount of data that we want to display to
...@@ -26,6 +27,14 @@ module Gitlab ...@@ -26,6 +27,14 @@ module Gitlab
attr_accessor :name, :path, :size, :data, :mode, :id, :commit_id, :loaded_size, :binary attr_accessor :name, :path, :size, :data, :mode, :id, :commit_id, :loaded_size, :binary
define_counter :gitlab_blob_truncated_true do
docstring 'blob.truncated? == true'
end
define_counter :gitlab_blob_truncated_false do
docstring 'blob.truncated? == false'
end
class << self class << self
def find(repository, sha, path, limit: MAX_DATA_DISPLAY_SIZE) def find(repository, sha, path, limit: MAX_DATA_DISPLAY_SIZE)
tree_entry(repository, sha, path, limit) tree_entry(repository, sha, path, limit)
......
...@@ -588,4 +588,14 @@ describe Gitlab::Git::Blob, :seed_helper do ...@@ -588,4 +588,14 @@ describe Gitlab::Git::Blob, :seed_helper do
end end
end end
end end
describe 'metrics' do
it 'defines :gitlab_blob_truncated_true counter' do
expect(described_class).to respond_to(:gitlab_blob_truncated_true)
end
it 'defines :gitlab_blob_truncated_false counter' do
expect(described_class).to respond_to(:gitlab_blob_truncated_false)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment