Commit c54dd7b0 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch '297020-linux-distribution-details-in-usage-ping' into 'master'

Add Operating System details to usage ping

See merge request gitlab-org/gitlab!54778
parents 898748a3 d70bee31
......@@ -74,6 +74,9 @@ gem 'acme-client', '~> 2.0', '>= 2.0.6'
# Browser detection
gem 'browser', '~> 4.2'
# OS detection for usage ping
gem 'ohai', '~> 16.10'
# GPG
gem 'gpgme', '~> 2.0.19'
......
......@@ -172,6 +172,14 @@ GEM
cbor (0.5.9.6)
character_set (1.4.0)
charlock_holmes (0.7.7)
chef-config (16.10.17)
addressable
chef-utils (= 16.10.17)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
tomlrb (~> 1.2)
chef-utils (16.10.17)
childprocess (3.0.0)
chunky_png (1.3.5)
citrus (3.0.2)
......@@ -348,6 +356,8 @@ GEM
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
ffi-yajl (2.3.4)
libyajl2 (~> 1.2)
flipper (0.17.1)
flipper-active_record (0.17.1)
activerecord (>= 4.2, < 7)
......@@ -403,6 +413,7 @@ GEM
fuubar (2.2.0)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
fuzzyurl (0.9.0)
gemoji (3.0.1)
gemojione (3.3.0)
json
......@@ -668,6 +679,7 @@ GEM
actionmailer (>= 3.2)
letter_opener (~> 1.0)
railties (>= 3.2)
libyajl2 (1.2.0)
license_finder (6.0.0)
bundler
rubyzip (>= 1, < 3)
......@@ -717,6 +729,12 @@ GEM
mini_mime (1.0.2)
mini_portile2 (2.5.0)
minitest (5.11.3)
mixlib-cli (2.1.8)
mixlib-config (3.0.9)
tomlrb
mixlib-log (3.0.9)
mixlib-shellout (3.2.5)
chef-utils
ms_rest (0.7.6)
concurrent-ruby (~> 1.0)
faraday (>= 0.9, < 2.0.0)
......@@ -741,6 +759,8 @@ GEM
connection_pool (~> 2.2)
net-ldap (0.16.3)
net-ntp (2.1.3)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.0.0)
netrc (0.11.0)
nio4r (2.5.4)
......@@ -764,6 +784,19 @@ GEM
octokit (4.20.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
ohai (16.10.6)
chef-config (>= 12.8, < 17)
chef-utils (>= 16.0, < 17)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
ipaddress
mixlib-cli (>= 1.7.0)
mixlib-config (>= 2.0, < 4.0)
mixlib-log (>= 2.0.1, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
plist (~> 3.1)
train-core
wmi-lite (~> 1.0)
oj (3.10.6)
omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0)
......@@ -857,6 +890,7 @@ GEM
railties (>= 4.0.0)
pg (1.2.3)
pg_query (1.3.0)
plist (3.6.0)
png_quantizator (0.2.1)
po_to_json (1.0.1)
json (>= 1.6.0)
......@@ -1196,9 +1230,17 @@ GEM
parslet (~> 1.8.0)
toml-rb (1.0.0)
citrus (~> 3.0, > 3.0)
tomlrb (1.3.0)
tpm-key_attestation (0.9.0)
bindata (~> 2.4)
openssl-signature_algorithm (~> 0.4.0)
train-core (3.4.9)
addressable (~> 2.5)
ffi (!= 1.13.0)
json (>= 1.8, < 3.0)
mixlib-shellout (>= 2.0, < 4.0)
net-scp (>= 1.2, < 4.0)
net-ssh (>= 2.9, < 7.0)
truncato (0.7.11)
htmlentities (~> 4.3.1)
nokogiri (>= 1.7.0, <= 2.0)
......@@ -1271,6 +1313,7 @@ GEM
expression_parser
rinku
with_env (1.1.0)
wmi-lite (1.0.5)
xml-simple (1.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
......@@ -1443,6 +1486,7 @@ DEPENDENCIES
nokogiri (~> 1.11.1)
oauth2 (~> 1.4)
octokit (~> 4.15)
ohai (~> 16.10)
oj (~> 3.10.6)
omniauth (~> 1.8)
omniauth-atlassian-oauth2 (~> 0.2.0)
......
---
title: Add Operating System details to usage ping
merge_request: 54778
author:
type: added
---
key_path: settings.operating_system
description: Information about the operating system running GitLab
product_section: enablement
product_stage: enablement
product_group: group::distribution
product_category: collection
value_type: string
status: implemented
milestone: "13.10"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54778
time_frame: none
data_source: ruby
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
......@@ -20846,6 +20846,26 @@ Is encrypted LDAP secrets configured?
| `tier` | free, premium, ultimate |
| `skip_validation` | true |
## `settings.operating_system`
Information about the operating system running GitLab
| field | value |
| --- | --- |
| `key_path` | **`settings.operating_system`** |
| `product_section` | enablement |
| `product_stage` | enablement |
| `product_group` | `group::distribution` |
| `product_category` | `collection` |
| `value_type` | string |
| `status` | implemented |
| `milestone` | 13.10 |
| `introduced_by_url` | [Introduced by](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54778) |
| `time_frame` | none |
| `data_source` | Ruby |
| `distribution` | ce, ee |
| `tier` | free, premium, ultimate |
## `signup_enabled`
Whether public signup is enabled
......
......@@ -242,7 +242,8 @@ module Gitlab
def system_usage_data_settings
{
settings: {
ldap_encrypted_secrets_enabled: alt_usage_data(fallback: nil) { Gitlab::Auth::Ldap::Config.encrypted_secrets.active? }
ldap_encrypted_secrets_enabled: alt_usage_data(fallback: nil) { Gitlab::Auth::Ldap::Config.encrypted_secrets.active? },
operating_system: alt_usage_data(fallback: nil) { operating_system }
}
}
end
......@@ -505,6 +506,17 @@ module Gitlab
end
end
def operating_system
ohai_data = Ohai::System.new.tap do |oh|
oh.all_plugins(['platform'])
end.data
platform = ohai_data['platform']
platform = 'raspbian' if ohai_data['platform'] == 'debian' && /armv/.match?(ohai_data['kernel']['machine'])
"#{platform}-#{ohai_data['platform_version']}"
end
def last_28_days_time_period(column: :created_at)
{ column => 30.days.ago..2.days.ago }
end
......
......@@ -30,6 +30,7 @@ UsageData/LargeTable:
- :Settings
- :CE_MEMOIZED_VALUES
- :EE_MEMOIZED_VALUES
- :Ohai::System
CountMethods:
- :count
- :distinct_count
......
......@@ -1129,12 +1129,40 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end
end
describe ".operating_system" do
let(:ohai_data) { { "platform" => "ubuntu", "platform_version" => "20.04" } }
before do
allow_next_instance_of(Ohai::System) do |ohai|
allow(ohai).to receive(:data).and_return(ohai_data)
end
end
subject { described_class.operating_system }
it { is_expected.to eq("ubuntu-20.04") }
context 'when on Debian with armv architecture' do
let(:ohai_data) { { "platform" => "debian", "platform_version" => "10", 'kernel' => { 'machine' => 'armv' } } }
it { is_expected.to eq("raspbian-10") }
end
end
describe ".system_usage_data_settings" do
before do
allow(described_class).to receive(:operating_system).and_return('ubuntu-20.04')
end
subject { described_class.system_usage_data_settings }
it 'gathers settings usage data', :aggregate_failures do
expect(subject[:settings][:ldap_encrypted_secrets_enabled]).to eq(Gitlab::Auth::Ldap::Config.encrypted_secrets.active?)
end
it 'populates operating system information' do
expect(subject[:settings][:operating_system]).to eq('ubuntu-20.04')
end
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