summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/zj-gitaly-usage-data.yml5
-rw-r--r--lib/gitaly/server.rb18
-rw-r--r--lib/gitlab/usage_data.rb3
-rw-r--r--spec/lib/gitaly/server_spec.rb6
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb5
5 files changed, 34 insertions, 3 deletions
diff --git a/changelogs/unreleased/zj-gitaly-usage-data.yml b/changelogs/unreleased/zj-gitaly-usage-data.yml
new file mode 100644
index 00000000000..ce5087292ed
--- /dev/null
+++ b/changelogs/unreleased/zj-gitaly-usage-data.yml
@@ -0,0 +1,5 @@
+---
+title: Add Gitaly data to the usage ping
+merge_request:
+author:
+type: added
diff --git a/lib/gitaly/server.rb b/lib/gitaly/server.rb
index 7b238623418..907c6e1b605 100644
--- a/lib/gitaly/server.rb
+++ b/lib/gitaly/server.rb
@@ -2,8 +2,18 @@
module Gitaly
class Server
- def self.all
- Gitlab.config.repositories.storages.keys.map { |s| Gitaly::Server.new(s) }
+ class << self
+ def all
+ Gitlab.config.repositories.storages.keys.map { |s| Gitaly::Server.new(s) }
+ end
+
+ def count
+ all.size
+ end
+
+ def filesystems
+ all.map(&:filesystem_type).compact.uniq
+ end
end
attr_reader :storage
@@ -36,6 +46,10 @@ module Gitaly
storage_status&.writeable
end
+ def filesystem_type
+ storage_status&.fs_type
+ end
+
def address
Gitlab::GitalyClient.address(@storage)
rescue RuntimeError => e
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 9aa2e972adf..0180fe7fa71 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -136,8 +136,9 @@ module Gitlab
def components_usage_data
{
- gitlab_pages: { enabled: Gitlab.config.pages.enabled, version: Gitlab::Pages::VERSION },
git: { version: Gitlab::Git.version },
+ gitaly: { version: Gitaly::Server.all.first.server_version, servers: Gitaly::Server.count, filesystems: Gitaly::Server.filesystems },
+ gitlab_pages: { enabled: Gitlab.config.pages.enabled, version: Gitlab::Pages::VERSION },
database: { adapter: Gitlab::Database.adapter_name, version: Gitlab::Database.version }
}
end
diff --git a/spec/lib/gitaly/server_spec.rb b/spec/lib/gitaly/server_spec.rb
index 292ab870dad..34bd43cb3ab 100644
--- a/spec/lib/gitaly/server_spec.rb
+++ b/spec/lib/gitaly/server_spec.rb
@@ -47,6 +47,12 @@ describe Gitaly::Server do
end
end
+ describe "#filesystem_type" do
+ subject { server.filesystem_type }
+
+ it { is_expected.to be_present }
+ end
+
describe 'request memoization' do
context 'when requesting multiple properties', :request_store do
it 'uses memoization for the info request' do
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index e44463dd767..67d49a30825 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -54,6 +54,7 @@ describe Gitlab::UsageData do
gitlab_shared_runners_enabled
gitlab_pages
git
+ gitaly
database
avg_cycle_analytics
web_ide_commits
@@ -205,6 +206,10 @@ describe Gitlab::UsageData do
expect(subject[:git][:version]).to eq(Gitlab::Git.version)
expect(subject[:database][:adapter]).to eq(Gitlab::Database.adapter_name)
expect(subject[:database][:version]).to eq(Gitlab::Database.version)
+ expect(subject[:gitaly][:version]).to be_present
+ expect(subject[:gitaly][:servers]).to be >= 1
+ expect(subject[:gitaly][:filesystems]).to be_an(Array)
+ expect(subject[:gitaly][:filesystems].first).to be_a(String)
end
end