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