diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-12 19:16:40 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-05-12 19:16:40 +0000 |
commit | b012c0b3164e58b55c9860ea6874b76491669a40 (patch) | |
tree | 85732fd1be1a1d233c2582a52676bc7f2dbcf630 | |
parent | 2d83e4c5d15cdfd8da71be6ee0d5746b8ec9ef99 (diff) | |
parent | f0b3ed91bc87117194578cfc5f58849886b5a97d (diff) | |
download | gitlab-ce-b012c0b3164e58b55c9860ea6874b76491669a40.tar.gz |
Merge branch 'disable-usage-ping' into 'master'
Usage ping updates
Closes #31741 and #31453
See merge request !11231
-rw-r--r-- | app/models/application_setting.rb | 10 | ||||
-rw-r--r-- | app/views/admin/application_settings/_form.html.haml | 21 | ||||
-rw-r--r-- | changelogs/unreleased/disable-usage-ping-2.yml | 4 | ||||
-rw-r--r-- | changelogs/unreleased/disable-usage-ping.yml | 4 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | doc/user/admin_area/settings/usage_statistics.md | 81 | ||||
-rw-r--r-- | lib/gitlab/usage_data.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 1 | ||||
-rw-r--r-- | spec/models/application_setting_spec.rb | 62 |
9 files changed, 118 insertions, 67 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 54f01f8637e..043f57241a3 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -246,7 +246,7 @@ class ApplicationSetting < ActiveRecord::Base two_factor_grace_period: 48, user_default_external: false, polling_interval_multiplier: 1, - usage_ping_enabled: true + usage_ping_enabled: Settings.gitlab['usage_ping_enabled'] } end @@ -349,6 +349,14 @@ class ApplicationSetting < ActiveRecord::Base sidekiq_throttling_enabled end + def usage_ping_can_be_configured? + Settings.gitlab.usage_ping_enabled + end + + def usage_ping_enabled + usage_ping_can_be_configured? && super + end + private def ensure_uuid! diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 4b6628169ef..e1b4e34cd2b 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -502,17 +502,24 @@ Let GitLab inform you when an update is available. .form-group .col-sm-offset-2.col-sm-10 + - can_be_configured = @application_setting.usage_ping_can_be_configured? .checkbox = f.label :usage_ping_enabled do - = f.check_box :usage_ping_enabled + = f.check_box :usage_ping_enabled, disabled: !can_be_configured Usage ping enabled - = link_to icon('question-circle'), help_page_path("user/admin_area/settings/usage_statistics", anchor: "usage-data") + = link_to icon('question-circle'), help_page_path("user/admin_area/settings/usage_statistics", anchor: "usage-ping") .help-block - Every week GitLab will report license usage back to GitLab, Inc. - Disable this option if you do not want this to occur. To see the - JSON payload that will be sent, visit the - = succeed '.' do - = link_to "Cohorts page", admin_cohorts_path(anchor: 'usage-ping') + - if can_be_configured + Every week GitLab will report license usage back to GitLab, Inc. + Disable this option if you do not want this to occur. To see the + JSON payload that will be sent, visit the + = succeed '.' do + = link_to "Cohorts page", admin_cohorts_path(anchor: 'usage-ping') + - else + The usage ping is disabled, and cannot be configured through this + form. For more information, see the documentation on + = succeed '.' do + = link_to 'deactivating the usage ping', help_page_path('user/admin_area/settings/usage_statistics', anchor: 'deactivate-the-usage-ping') %fieldset %legend Email diff --git a/changelogs/unreleased/disable-usage-ping-2.yml b/changelogs/unreleased/disable-usage-ping-2.yml new file mode 100644 index 00000000000..4abd325f120 --- /dev/null +++ b/changelogs/unreleased/disable-usage-ping-2.yml @@ -0,0 +1,4 @@ +--- +title: Add hostname to usage ping +merge_request: +author: diff --git a/changelogs/unreleased/disable-usage-ping.yml b/changelogs/unreleased/disable-usage-ping.yml new file mode 100644 index 00000000000..5438eb56dba --- /dev/null +++ b/changelogs/unreleased/disable-usage-ping.yml @@ -0,0 +1,4 @@ +--- +title: Allow usage ping to be disabled completely in gitlab.yml +merge_request: +author: diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 6097ae6534e..ea1815f500a 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -241,6 +241,7 @@ Settings.gitlab['domain_whitelist'] ||= [] Settings.gitlab['import_sources'] ||= %w[github bitbucket gitlab google_code fogbugz git gitlab_project gitea] Settings.gitlab['trusted_proxies'] ||= [] Settings.gitlab['no_todos_messages'] ||= YAML.load_file(Rails.root.join('config', 'no_todos_messages.yml')) +Settings.gitlab['usage_ping_enabled'] = true if Settings.gitlab['usage_ping_enabled'].nil? # # CI diff --git a/doc/user/admin_area/settings/usage_statistics.md b/doc/user/admin_area/settings/usage_statistics.md index 733e70ca9bf..375e7f08e8b 100644 --- a/doc/user/admin_area/settings/usage_statistics.md +++ b/doc/user/admin_area/settings/usage_statistics.md @@ -28,60 +28,13 @@ for all signed in users. [were added][ee-735] in GitLab Enterprise Edition 8.12. [Moved to GitLab Community Edition][ce-23361] in 9.1. -GitLab Inc. can collect non-sensitive information about how GitLab users -use their GitLab instance upon the activation of a ping feature -located in the admin panel (`/admin/application_settings`). - -You can see the **exact** JSON payload that your instance sends to GitLab -in the "Usage statistics" section of the admin panel. - -Nothing qualitative is collected. Only quantitative. That means no project -names, author names, comment bodies, names of labels, etc. - -The usage ping is sent in order for GitLab Inc. to have a better understanding -of how our users use our product, and to be more data-driven when creating or -changing features. - -The total number of the following is sent back to GitLab Inc.: - -- Comments -- Groups -- Users -- Projects -- Issues -- Labels -- CI builds -- Snippets -- Milestones -- Todos -- Pushes -- Merge requests -- Environments -- Triggers -- Deploy keys -- Pages -- Project Services -- Projects using the Prometheus service -- Issue Boards -- CI Runners -- Deployments -- Geo Nodes -- LDAP Groups -- LDAP Keys -- LDAP Users -- LFS objects -- Protected branches -- Releases -- Remote mirrors -- Uploads -- Web hooks - -Also, we track if you've installed Mattermost with GitLab. -For example: `"mattermost_enabled":true"`. - -More data will be added over time. The goal of this ping is to be as light as -possible, so it won't have any performance impact on your installation when -the calculation is made. +GitLab sends a weekly payload containing usage data to GitLab Inc. The usage +ping uses high-level data to help our product, support, and sales teams. It does +not send any project names, usernames, or any other specific data. The +information from the usage ping is not anonymous, it is linked to the hostname +of the instance. + +You can view the exact JSON payload in the administration panel. ### Deactivate the usage ping @@ -89,13 +42,23 @@ By default, usage ping is opt-out. If you want to deactivate this feature, go to the Settings page of your administration panel and uncheck the Usage ping checkbox. -## Privacy policy +To disable the usage ping and prevent it from being configured in future through +the administration panel, Omnibus installs can set the following in +[`gitlab.rb`](https://docs.gitlab.com/omnibus/settings/configuration.html#configuration-options): + +```ruby +gitlab_rails['usage_ping_enabled'] = false +``` -GitLab Inc. does **not** collect any sensitive information, like project names -or the content of the comments. GitLab Inc. does not disclose or otherwise make -available any of the data collected on a customer specific basis. +And source installs can set the following in `gitlab.yml`: -Read more about this in the [Privacy policy](https://about.gitlab.com/privacy). +```yaml +production: &base + # ... + gitlab: + # ... + usage_ping_enabled: false +``` [ee-557]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/557 [ee-735]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/735 diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 14d8e925d0e..4382cf7b12f 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -52,6 +52,7 @@ module Gitlab def license_usage_data usage_data = { uuid: current_application_settings.uuid, + hostname: Gitlab.config.gitlab.host, version: Gitlab::VERSION, active_user_count: User.active.count, recorded_at: Time.now, diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 9046d5c413f..2c46920456b 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -17,6 +17,7 @@ describe Gitlab::UsageData do edition version uuid + hostname )) end diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 3c3ae3832de..fa229542f70 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -211,4 +211,66 @@ describe ApplicationSetting, models: true do expect(setting.domain_blacklist).to contain_exactly('example.com', 'test.com', 'foo.bar') end end + + describe 'usage ping settings' do + context 'when the usage ping is disabled in gitlab.yml' do + before do + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(false) + end + + it 'does not allow the usage ping to be configured' do + expect(setting.usage_ping_can_be_configured?).to be_falsey + end + + context 'when the usage ping is disabled in the DB' do + before do + setting.usage_ping_enabled = false + end + + it 'returns false for usage_ping_enabled' do + expect(setting.usage_ping_enabled).to be_falsey + end + end + + context 'when the usage ping is enabled in the DB' do + before do + setting.usage_ping_enabled = true + end + + it 'returns false for usage_ping_enabled' do + expect(setting.usage_ping_enabled).to be_falsey + end + end + end + + context 'when the usage ping is enabled in gitlab.yml' do + before do + allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true) + end + + it 'allows the usage ping to be configured' do + expect(setting.usage_ping_can_be_configured?).to be_truthy + end + + context 'when the usage ping is disabled in the DB' do + before do + setting.usage_ping_enabled = false + end + + it 'returns false for usage_ping_enabled' do + expect(setting.usage_ping_enabled).to be_falsey + end + end + + context 'when the usage ping is enabled in the DB' do + before do + setting.usage_ping_enabled = true + end + + it 'returns true for usage_ping_enabled' do + expect(setting.usage_ping_enabled).to be_truthy + end + end + end + end end |