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
2e19caa3
Commit
2e19caa3
authored
May 17, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
b9a3438b
f2cb5220
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
9 deletions
+26
-9
changelogs/unreleased/zj-usage-ping-pool-repository.yml
changelogs/unreleased/zj-usage-ping-pool-repository.yml
+5
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+10
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+11
-8
No files found.
changelogs/unreleased/zj-usage-ping-pool-repository.yml
0 → 100644
View file @
2e19caa3
---
title
:
Add Pool repository to the usage ping
merge_request
:
28267
author
:
type
:
other
lib/gitlab/usage_data.rb
View file @
2e19caa3
...
@@ -26,7 +26,7 @@ module Gitlab
...
@@ -26,7 +26,7 @@ module Gitlab
uuid:
Gitlab
::
CurrentSettings
.
uuid
,
uuid:
Gitlab
::
CurrentSettings
.
uuid
,
hostname:
Gitlab
.
config
.
gitlab
.
host
,
hostname:
Gitlab
.
config
.
gitlab
.
host
,
version:
Gitlab
::
VERSION
,
version:
Gitlab
::
VERSION
,
installation_type:
Gitlab
::
INSTALLATION_TYPE
,
installation_type:
installation_type
,
active_user_count:
count
(
User
.
active
),
active_user_count:
count
(
User
.
active
),
recorded_at:
Time
.
now
,
recorded_at:
Time
.
now
,
edition:
'CE'
edition:
'CE'
...
@@ -81,6 +81,7 @@ module Gitlab
...
@@ -81,6 +81,7 @@ module Gitlab
milestone_lists:
count
(
List
.
milestone
),
milestone_lists:
count
(
List
.
milestone
),
milestones:
count
(
Milestone
),
milestones:
count
(
Milestone
),
pages_domains:
count
(
PagesDomain
),
pages_domains:
count
(
PagesDomain
),
pool_repositories:
count
(
PoolRepository
),
projects:
count
(
Project
),
projects:
count
(
Project
),
projects_imported_from_github:
count
(
Project
.
where
(
import_type:
'github'
)),
projects_imported_from_github:
count
(
Project
.
where
(
import_type:
'github'
)),
projects_with_repositories_enabled:
count
(
ProjectFeature
.
where
(
'repository_access_level > ?'
,
ProjectFeature
::
DISABLED
)),
projects_with_repositories_enabled:
count
(
ProjectFeature
.
where
(
'repository_access_level > ?'
,
ProjectFeature
::
DISABLED
)),
...
@@ -190,6 +191,14 @@ module Gitlab
...
@@ -190,6 +191,14 @@ module Gitlab
result
[
key
]
=
approx_counts
[
model
]
||
-
1
result
[
key
]
=
approx_counts
[
model
]
||
-
1
end
end
end
end
def
installation_type
if
Rails
.
env
.
production?
Gitlab
::
INSTALLATION_TYPE
else
"gitlab-development-kit"
end
end
end
end
end
end
end
end
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
2e19caa3
...
@@ -63,12 +63,7 @@ describe Gitlab::UsageData do
...
@@ -63,12 +63,7 @@ describe Gitlab::UsageData do
end
end
it
"gathers usage counts"
do
it
"gathers usage counts"
do
count_data
=
subject
[
:counts
]
expected_keys
=
%i(
expect
(
count_data
[
:boards
]).
to
eq
(
1
)
expect
(
count_data
[
:projects
]).
to
eq
(
3
)
expect
(
count_data
.
keys
).
to
include
(
*
%i(
assignee_lists
assignee_lists
boards
boards
ci_builds
ci_builds
...
@@ -112,6 +107,7 @@ describe Gitlab::UsageData do
...
@@ -112,6 +107,7 @@ describe Gitlab::UsageData do
milestone_lists
milestone_lists
milestones
milestones
notes
notes
pool_repositories
projects
projects
projects_imported_from_github
projects_imported_from_github
projects_jira_active
projects_jira_active
...
@@ -132,7 +128,14 @@ describe Gitlab::UsageData do
...
@@ -132,7 +128,14 @@ describe Gitlab::UsageData do
uploads
uploads
web_hooks
web_hooks
user_preferences
user_preferences
)
)
)
count_data
=
subject
[
:counts
]
expect
(
count_data
[
:boards
]).
to
eq
(
1
)
expect
(
count_data
[
:projects
]).
to
eq
(
3
)
expect
(
count_data
.
keys
).
to
include
(
*
expected_keys
)
expect
(
expected_keys
-
count_data
.
keys
).
to
be_empty
end
end
it
'does not gather user preferences usage data when the feature is disabled'
do
it
'does not gather user preferences usage data when the feature is disabled'
do
...
@@ -211,7 +214,7 @@ describe Gitlab::UsageData do
...
@@ -211,7 +214,7 @@ describe Gitlab::UsageData do
it
"gathers license data"
do
it
"gathers license data"
do
expect
(
subject
[
:uuid
]).
to
eq
(
Gitlab
::
CurrentSettings
.
uuid
)
expect
(
subject
[
:uuid
]).
to
eq
(
Gitlab
::
CurrentSettings
.
uuid
)
expect
(
subject
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
subject
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
subject
[
:installation_type
]).
to
eq
(
Gitlab
::
INSTALLATION_TYPE
)
expect
(
subject
[
:installation_type
]).
to
eq
(
'gitlab-development-kit'
)
expect
(
subject
[
:active_user_count
]).
to
eq
(
User
.
active
.
count
)
expect
(
subject
[
:active_user_count
]).
to
eq
(
User
.
active
.
count
)
expect
(
subject
[
:recorded_at
]).
to
be_a
(
Time
)
expect
(
subject
[
:recorded_at
]).
to
be_a
(
Time
)
end
end
...
...
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