Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cf93bbad
Commit
cf93bbad
authored
Jul 20, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display the JSON payload in settings page for EE usage ping
parent
6a9dc4cb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
37 deletions
+41
-37
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/helpers/license_helper.rb
app/helpers/license_helper.rb
+19
-0
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+2
-1
app/workers/gitlab_usage_ping_worker.rb
app/workers/gitlab_usage_ping_worker.rb
+1
-20
spec/helpers/license_helper_spec.rb
spec/helpers/license_helper_spec.rb
+18
-0
spec/workers/gitlab_usage_ping_worker_spec.rb
spec/workers/gitlab_usage_ping_worker_spec.rb
+0
-16
No files found.
CHANGELOG-EE
View file @
cf93bbad
Please view this file on the master branch, on stable branches it's out of date.
v 8.10.0 (unreleased)
- Add EE license usage ping !557
- Rename Git Hooks to Push Rules
- Fix EE keys fingerprint add index migration if came from CE
- Add todos for MR approvers !547
...
...
app/helpers/license_helper.rb
View file @
cf93bbad
...
...
@@ -17,6 +17,25 @@ module LicenseHelper
end
end
def
license_usage_data
usage_data
=
{
version:
Gitlab
::
VERSION
,
active_user_count:
current_active_user_count
}
license
=
License
.
current
if
license
usage_data
[
:license_md5
]
=
Digest
::
MD5
.
hexdigest
(
license
.
data
)
usage_data
[
:historical_max_users
]
=
max_historical_user_count
usage_data
[
:licensee
]
=
license
.
licensee
usage_data
[
:license_user_count
]
=
license
.
user_count
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
private
def
no_license_message
(
signed_in
,
is_admin
)
...
...
app/views/admin/application_settings/_form.html.haml
View file @
cf93bbad
...
...
@@ -63,7 +63,8 @@
Usage ping enabled
.help-block
Every week GitLab will report license usage back to GitLab, Inc.
Disable this option if you do not want this to occur.
Disable this option if you do not want this to occur. This is the JSON payload that will be sent:
%pre
.js-syntax-highlight.code.highlight
=
Gitlab
::
Highlight
.
highlight
(
'payload.json'
,
license_usage_data
.
to_json
)
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
...
...
app/workers/gitlab_usage_ping_worker.rb
View file @
cf93bbad
...
...
@@ -16,7 +16,7 @@ class GitlabUsagePingWorker
begin
HTTParty
.
post
(
url
,
body:
data
.
to_json
,
body:
license_usage_
data
.
to_json
,
headers:
{
'Content-type'
=>
'application/json'
}
)
rescue
HTTParty
::
Error
=>
e
...
...
@@ -28,25 +28,6 @@ class GitlabUsagePingWorker
Gitlab
::
ExclusiveLease
.
new
(
'gitlab_usage_ping_worker:ping'
,
timeout:
LEASE_TIMEOUT
).
try_obtain
end
def
data
usage_data
=
{
version:
Gitlab
::
VERSION
,
active_user_count:
current_active_user_count
}
license
=
License
.
current
if
license
usage_data
[
:license_md5
]
=
Digest
::
MD5
.
hexdigest
(
license
.
data
)
usage_data
[
:historical_max_users
]
=
max_historical_user_count
usage_data
[
:licensee
]
=
license
.
licensee
usage_data
[
:license_user_count
]
=
license
.
user_count
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
url
'https://version.gitlab.com/usage_data'
end
...
...
spec/helpers/license_helper_spec.rb
View file @
cf93bbad
...
...
@@ -20,4 +20,22 @@ describe LicenseHelper do
end
end
end
describe
'#license_usage_data'
do
it
"gathers license data"
do
data
=
license_usage_data
license
=
License
.
current
expect
(
data
[
:license_md5
]).
to
eq
(
Digest
::
MD5
.
hexdigest
(
license
.
data
))
expect
(
data
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
data
[
:licensee
]).
to
eq
(
license
.
licensee
)
expect
(
data
[
:active_user_count
]).
to
eq
(
User
.
active
.
count
)
expect
(
data
[
:licensee
]).
to
eq
(
license
.
licensee
)
expect
(
data
[
:license_user_count
]).
to
eq
(
license
.
user_count
)
expect
(
data
[
:license_starts_at
]).
to
eq
(
license
.
starts_at
)
expect
(
data
[
:license_expires_at
]).
to
eq
(
license
.
expires_at
)
expect
(
data
[
:license_add_ons
]).
to
eq
(
license
.
add_ons
)
expect
(
data
[
:recorded_at
]).
to
be_a
(
Time
)
end
end
end
spec/workers/gitlab_usage_ping_worker_spec.rb
View file @
cf93bbad
...
...
@@ -3,22 +3,6 @@ require 'spec_helper'
describe
GitlabUsagePingWorker
do
subject
{
GitlabUsagePingWorker
.
new
}
it
"gathers license data"
do
data
=
subject
.
data
license
=
License
.
current
expect
(
data
[
:license_md5
]).
to
eq
(
Digest
::
MD5
.
hexdigest
(
license
.
data
))
expect
(
data
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
data
[
:licensee
]).
to
eq
(
license
.
licensee
)
expect
(
data
[
:active_user_count
]).
to
eq
(
User
.
active
.
count
)
expect
(
data
[
:licensee
]).
to
eq
(
license
.
licensee
)
expect
(
data
[
:license_user_count
]).
to
eq
(
license
.
user_count
)
expect
(
data
[
:license_starts_at
]).
to
eq
(
license
.
starts_at
)
expect
(
data
[
:license_expires_at
]).
to
eq
(
license
.
expires_at
)
expect
(
data
[
:license_add_ons
]).
to
eq
(
license
.
add_ons
)
expect
(
data
[
:recorded_at
]).
to
be_a
(
Time
)
end
it
"sends POST request"
do
stub_application_setting
(
usage_ping_enabled:
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment