Commit 465b4ec5 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'usage-ping-back-back-ports' into 'master'

Usage ping back back ports

See merge request !1587
parents b30e44dc e793a2d1
...@@ -148,6 +148,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -148,6 +148,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:version_check_enabled, :version_check_enabled,
:terminal_max_session_time, :terminal_max_session_time,
:polling_interval_multiplier, :polling_interval_multiplier,
:usage_ping_enabled,
disabled_oauth_sign_in_sources: [], disabled_oauth_sign_in_sources: [],
import_sources: [], import_sources: [],
...@@ -169,7 +170,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -169,7 +170,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:elasticsearch_search, :elasticsearch_search,
:repository_size_limit, :repository_size_limit,
:shared_runners_minutes, :shared_runners_minutes,
:usage_ping_enabled,
:minimum_mirror_sync_time, :minimum_mirror_sync_time,
:geo_status_timeout, :geo_status_timeout,
:elasticsearch_experimental_indexer, :elasticsearch_experimental_indexer,
......
...@@ -257,7 +257,8 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -257,7 +257,8 @@ class ApplicationSetting < ActiveRecord::Base
terminal_max_session_time: 0, terminal_max_session_time: 0,
two_factor_grace_period: 48, two_factor_grace_period: 48,
user_default_external: false, user_default_external: false,
polling_interval_multiplier: 1 polling_interval_multiplier: 1,
usage_ping_enabled: true
} }
end end
...@@ -266,7 +267,6 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -266,7 +267,6 @@ class ApplicationSetting < ActiveRecord::Base
elasticsearch_url: ENV['ELASTIC_URL'] || 'http://localhost:9200', elasticsearch_url: ENV['ELASTIC_URL'] || 'http://localhost:9200',
elasticsearch_aws: false, elasticsearch_aws: false,
elasticsearch_aws_region: ENV['ELASTIC_REGION'] || 'us-east-1', elasticsearch_aws_region: ENV['ELASTIC_REGION'] || 'us-east-1',
usage_ping_enabled: true,
minimum_mirror_sync_time: Gitlab::Mirror::FIFTEEN, minimum_mirror_sync_time: Gitlab::Mirror::FIFTEEN,
repository_size_limit: 0 repository_size_limit: 0
} }
......
...@@ -99,6 +99,10 @@ class License < ActiveRecord::Base ...@@ -99,6 +99,10 @@ class License < ActiveRecord::Base
restricted_attr(:previous_user_count) restricted_attr(:previous_user_count)
end end
def plan
restricted_attr(:plan)
end
def current_active_users_count def current_active_users_count
@current_active_users_count ||= User.active.count @current_active_users_count ||= User.active.count
end end
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
- [default, 1] - [default, 1]
- [pages, 1] - [pages, 1]
- [system_hook_push, 1] - [system_hook_push, 1]
- [update_user_activity, 1]
# EE specific queues # EE specific queues
- [geo, 1] - [geo, 1]
- [project_mirror, 1] - [project_mirror, 1]
...@@ -63,4 +64,3 @@ ...@@ -63,4 +64,3 @@
- [elastic_indexer, 1] - [elastic_indexer, 1]
- [elastic_commit_indexer, 1] - [elastic_commit_indexer, 1]
- [export_csv, 1] - [export_csv, 1]
- [update_user_activity, 1]
...@@ -67,14 +67,19 @@ module Gitlab ...@@ -67,14 +67,19 @@ module Gitlab
end end
def license_usage_data def license_usage_data
usage_data = { uuid: current_application_settings.uuid, usage_data = {
version: Gitlab::VERSION, uuid: current_application_settings.uuid,
active_user_count: User.active.count, version: Gitlab::VERSION,
mattermost_enabled: Gitlab.config.mattermost.enabled } active_user_count: User.active.count,
recorded_at: Time.now,
mattermost_enabled: Gitlab.config.mattermost.enabled,
edition: 'EE'
}
license = ::License.current license = ::License.current
if license if license
usage_data[:edition] = license_edition(license.plan)
usage_data[:license_md5] = Digest::MD5.hexdigest(license.data) usage_data[:license_md5] = Digest::MD5.hexdigest(license.data)
usage_data[:historical_max_users] = ::HistoricalData.max_historical_user_count usage_data[:historical_max_users] = ::HistoricalData.max_historical_user_count
usage_data[:licensee] = license.licensee usage_data[:licensee] = license.licensee
...@@ -82,11 +87,21 @@ module Gitlab ...@@ -82,11 +87,21 @@ module Gitlab
usage_data[:license_starts_at] = license.starts_at usage_data[:license_starts_at] = license.starts_at
usage_data[:license_expires_at] = license.expires_at usage_data[:license_expires_at] = license.expires_at
usage_data[:license_add_ons] = license.add_ons usage_data[:license_add_ons] = license.add_ons
usage_data[:recorded_at] = Time.now
end end
usage_data usage_data
end end
def license_edition(plan)
case plan
when 'premium'
'EEP'
when 'starter'
'EES'
else # Older licenses
'EE'
end
end
end end
end end
end end
...@@ -20,8 +20,9 @@ describe Gitlab::UsageData do ...@@ -20,8 +20,9 @@ describe Gitlab::UsageData do
licensee licensee
license_md5 license_md5
recorded_at recorded_at
version
mattermost_enabled mattermost_enabled
edition
version
uuid uuid
)) ))
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