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:
Diffstat (limited to 'lib/gitaly/server.rb')
-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