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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-24 21:09:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-24 21:09:00 +0300
commit411cc77938f99b495e0fe802705d275a28e939ef (patch)
tree97770ec9904daeaaa1f7546b191d23b0a642da47 /lib/gitaly
parent3e36f70be4bd74a412b2ea1286090b54803a8c20 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitaly')
-rw-r--r--lib/gitaly/server.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/gitaly/server.rb b/lib/gitaly/server.rb
index 64ab5db4fcd..89a836e629f 100644
--- a/lib/gitaly/server.rb
+++ b/lib/gitaly/server.rb
@@ -53,6 +53,20 @@ module Gitaly
storage_status&.fs_type
end
+ def disk_used
+ disk_statistics_storage_status&.used
+ end
+
+ def disk_available
+ disk_statistics_storage_status&.available
+ end
+
+ # Simple convenience method for when obtaining both used and available
+ # statistics at once is preferred.
+ def disk_stats
+ disk_statistics_storage_status
+ end
+
def address
Gitlab::GitalyClient.address(@storage)
rescue RuntimeError => e
@@ -65,6 +79,10 @@ module Gitaly
@storage_status ||= info.storage_statuses.find { |s| s.storage_name == storage }
end
+ def disk_statistics_storage_status
+ @disk_statistics_storage_status ||= disk_statistics.storage_statuses.find { |s| s.storage_name == storage }
+ end
+
def matches_sha?
match = server_version.match(SHA_VERSION_REGEX)
return false unless match
@@ -76,7 +94,19 @@ module Gitaly
@info ||=
begin
Gitlab::GitalyClient::ServerService.new(@storage).info
- rescue GRPC::Unavailable, GRPC::DeadlineExceeded
+ rescue GRPC::Unavailable, GRPC::DeadlineExceeded => ex
+ Gitlab::ErrorTracking.track_exception(ex)
+ # This will show the server as being out of date
+ Gitaly::ServerInfoResponse.new(git_version: '', server_version: '', storage_statuses: [])
+ end
+ end
+
+ def disk_statistics
+ @disk_statistics ||=
+ begin
+ Gitlab::GitalyClient::ServerService.new(@storage).disk_statistics
+ rescue GRPC::Unavailable, GRPC::DeadlineExceeded => ex
+ Gitlab::ErrorTracking.track_exception(ex)
# This will show the server as being out of date
Gitaly::ServerInfoResponse.new(git_version: '', server_version: '', storage_statuses: [])
end