Commit 68262ea8 authored by Max Woolf's avatar Max Woolf

Merge branch '330810-more-identifiers-in-seat-link' into 'master'

Adds more identifiers to Seat Link

See merge request gitlab-org/gitlab!63909
parents f61814d8 9dc09451
......@@ -209,9 +209,14 @@ Seat Link daily sends a count of all users in connected GitLab self-managed inst
Seat Link provides **only** the following information to GitLab:
- Date
- Timestamp
- License key
- Historical maximum user count
- Billable users count
- GitLab version
- Hostname
- Instance ID
- MD5 hash of license
For offline or closed network customers, the existing [true-up model](#users-over-license) is used. Prorated charges are not possible without user count data.
......@@ -220,6 +225,8 @@ For offline or closed network customers, the existing [true-up model](#users-ove
<pre><code>
{
gitlab_version: '13.12.0',
timestamp: '2020-01-29T18:25:57+00:00',
date: '2020-01-29',
license_key: 'ZXlKa1lYUmhJam9pWm5WNmVsTjVZekZ2YTJoV2NucDBh
RXRxTTA5amQxcG1VMVZqDQpXR3RwZEc5SGIyMVhibmxuZDJ0NWFrNXJTVzVH
......@@ -255,8 +262,9 @@ TjJ4eVlVUkdkWEJtDQpkSHByYWpreVJrcG9UVlo0Y0hKSU9URndiV2RzVFdO
VlhHNXRhVmszTkV0SVEzcEpNMWRyZEVoRU4ydHINCmRIRnFRVTlCVUVVM1pV
SlRORE4xUjFaYVJGb3JlWGM5UFZ4dUlpd2lhWFlpt2lKV00yRnNVbk5RTjJk
Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=',
max_historical_user_count: 10,
billable_users_count: 6
hostname: 'gitlab.example.com',
instance_id: 'c1ac02cb-cb3f-4120-b7fe-961bbfa3abb7',
license_md5: '7cd897fffb3517dddf01b79a0889b515'
}
</code></pre>
......
......@@ -54,7 +54,10 @@ module Gitlab
date: timestamp.to_date.to_s,
license_key: key,
max_historical_user_count: max_users,
billable_users_count: billable_users_count
billable_users_count: billable_users_count,
hostname: Gitlab.config.gitlab.host,
instance_id: Gitlab::CurrentSettings.uuid,
license_md5: license&.md5
}
end
......
......@@ -76,6 +76,12 @@ RSpec.describe Gitlab::SeatLinkData do
end
describe '.to_json' do
let(:instance_id) { '123' }
before do
stub_application_setting(uuid: instance_id)
end
it { is_expected.to delegate_method(:to_json).to(:data) }
it 'returns payload data as a JSON string' do
......@@ -86,10 +92,33 @@ RSpec.describe Gitlab::SeatLinkData do
date: timestamp.to_date.iso8601,
license_key: key,
max_historical_user_count: max_users,
billable_users_count: billable_users_count
billable_users_count: billable_users_count,
hostname: Gitlab.config.gitlab.host,
instance_id: instance_id,
license_md5: ::License.current.md5
}.to_json
)
end
context 'when instance has no current license' do
it 'returns payload data as a JSON string' do
allow(License).to receive(:current).and_return(nil)
expect(subject.to_json).to eq(
{
gitlab_version: Gitlab::VERSION,
timestamp: timestamp.iso8601,
date: timestamp.to_date.iso8601,
license_key: key,
max_historical_user_count: max_users,
billable_users_count: billable_users_count,
hostname: Gitlab.config.gitlab.host,
instance_id: instance_id,
license_md5: nil
}.to_json
)
end
end
end
describe '#sync' do
......
......@@ -23,7 +23,10 @@ RSpec.describe SyncSeatLinkRequestWorker, type: :worker do
date: '2019-12-31',
license_key: '123',
max_historical_user_count: 5,
billable_users_count: 4
billable_users_count: 4,
hostname: Gitlab.config.gitlab.host,
instance_id: Gitlab::CurrentSettings.uuid,
license_md5: ::License.current.md5
}.to_json
)
end
......@@ -117,7 +120,10 @@ RSpec.describe SyncSeatLinkRequestWorker, type: :worker do
date: '2020-01-01',
license_key: '123',
max_historical_user_count: 5,
billable_users_count: 4
billable_users_count: 4,
hostname: Gitlab.config.gitlab.host,
instance_id: Gitlab::CurrentSettings.uuid,
license_md5: ::License.current.md5
}.to_json
)
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