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
d496c4b3
Commit
d496c4b3
authored
May 26, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specific fallbacks for alt_usage_data
parent
6984d66c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
26 deletions
+28
-26
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+3
-3
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+22
-22
lib/gitlab/utils/usage_data.rb
lib/gitlab/utils/usage_data.rb
+3
-1
No files found.
ee/lib/ee/gitlab/usage_data.rb
View file @
d496c4b3
...
...
@@ -60,9 +60,9 @@ module EE
def
features_usage_data_ee
{
elasticsearch_enabled:
alt_usage_data
{
::
Gitlab
::
CurrentSettings
.
elasticsearch_search?
},
license_trial_ends_on:
alt_usage_data
{
License
.
trial_ends_on
},
geo_enabled:
alt_usage_data
{
::
Gitlab
::
Geo
.
enabled?
}
elasticsearch_enabled:
alt_usage_data
(
fallback:
nil
)
{
::
Gitlab
::
CurrentSettings
.
elasticsearch_search?
},
license_trial_ends_on:
alt_usage_data
(
fallback:
nil
)
{
License
.
trial_ends_on
},
geo_enabled:
alt_usage_data
(
fallback:
nil
)
{
::
Gitlab
::
Geo
.
enabled?
}
}
end
...
...
lib/gitlab/usage_data.rb
View file @
d496c4b3
...
...
@@ -41,10 +41,10 @@ module Gitlab
def
license_usage_data
{
recorded_at:
Time
.
now
,
# should be calculated very first
uuid:
Gitlab
::
CurrentSettings
.
uuid
,
hostname:
Gitlab
.
config
.
gitlab
.
host
,
version:
Gitlab
::
VERSION
,
installation_type:
installation_type
,
uuid:
alt_usage_data
{
Gitlab
::
CurrentSettings
.
uuid
}
,
hostname:
alt_usage_data
{
Gitlab
.
config
.
gitlab
.
host
}
,
version:
alt_usage_data
{
Gitlab
::
VERSION
}
,
installation_type:
alt_usage_data
{
installation_type
}
,
active_user_count:
count
(
User
.
active
),
edition:
'CE'
}
...
...
@@ -174,19 +174,19 @@ module Gitlab
def
features_usage_data_ce
{
container_registry_enabled:
Gitlab
.
config
.
registry
.
enabled
,
container_registry_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
.
config
.
registry
.
enabled
}
,
dependency_proxy_enabled:
Gitlab
.
config
.
try
(
:dependency_proxy
)
&
.
enabled
,
gitlab_shared_runners_enabled:
Gitlab
.
config
.
gitlab_ci
.
shared_runners_enabled
,
gravatar_enabled:
Gitlab
::
CurrentSettings
.
gravatar_enabled?
,
ldap_enabled:
Gitlab
.
config
.
ldap
.
enabled
,
mattermost_enabled:
Gitlab
.
config
.
mattermost
.
enabled
,
omniauth_enabled:
Gitlab
::
Auth
.
omniauth_enabled?
,
prometheus_metrics_enabled:
Gitlab
::
Metrics
.
prometheus_metrics_enabled?
,
reply_by_email_enabled:
Gitlab
::
IncomingEmail
.
enabled?
,
signup_enabled:
Gitlab
::
CurrentSettings
.
allow_signup?
,
web_ide_clientside_preview_enabled:
Gitlab
::
CurrentSettings
.
web_ide_clientside_preview_enabled?
,
gitlab_shared_runners_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
.
config
.
gitlab_ci
.
shared_runners_enabled
}
,
gravatar_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
CurrentSettings
.
gravatar_enabled?
}
,
ldap_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
.
config
.
ldap
.
enabled
}
,
mattermost_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
.
config
.
mattermost
.
enabled
}
,
omniauth_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
Auth
.
omniauth_enabled?
}
,
prometheus_metrics_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
Metrics
.
prometheus_metrics_enabled?
}
,
reply_by_email_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
IncomingEmail
.
enabled?
}
,
signup_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
CurrentSettings
.
allow_signup?
}
,
web_ide_clientside_preview_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
CurrentSettings
.
web_ide_clientside_preview_enabled?
}
,
ingress_modsecurity_enabled:
Feature
.
enabled?
(
:ingress_modsecurity
),
grafana_link_enabled:
Gitlab
::
CurrentSettings
.
grafana_enabled?
grafana_link_enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
::
CurrentSettings
.
grafana_enabled?
}
}
end
...
...
@@ -213,19 +213,19 @@ module Gitlab
def
components_usage_data
{
git:
{
version:
Gitlab
::
Git
.
version
},
git:
{
version:
alt_usage_data
(
fallback:
{
major:
-
1
})
{
Gitlab
::
Git
.
version
}
},
gitaly:
{
version:
Gitaly
::
Server
.
all
.
first
.
server_version
,
version:
alt_usage_data
{
Gitaly
::
Server
.
all
.
first
.
server_version
}
,
servers:
alt_usage_data
{
Gitaly
::
Server
.
count
},
filesystems:
Gitaly
::
Server
.
filesystems
filesystems:
alt_usage_data
(
fallback:
[
"-1"
])
{
Gitaly
::
Server
.
filesystems
}
},
gitlab_pages:
{
enabled:
Gitlab
.
config
.
pages
.
enabled
,
version:
Gitlab
::
Pages
::
VERSION
enabled:
alt_usage_data
(
fallback:
nil
)
{
Gitlab
.
config
.
pages
.
enabled
}
,
version:
alt_usage_data
{
Gitlab
::
Pages
::
VERSION
}
},
database:
{
adapter:
Gitlab
::
Database
.
adapter_name
,
version:
Gitlab
::
Database
.
version
adapter:
alt_usage_data
{
Gitlab
::
Database
.
adapter_name
}
,
version:
alt_usage_data
{
Gitlab
::
Database
.
version
}
},
app_server:
{
type:
app_server_type
}
}
...
...
lib/gitlab/utils/usage_data.rb
View file @
d496c4b3
...
...
@@ -15,11 +15,13 @@
# active_user_count: count(User.active)
#
# * alt_usage_data method
# handles StandardError and fallbacks into -1 this way not all measures fail if we encounter one exception
# handles StandardError and fallbacks by default into -1 this way not all measures fail if we encounter one exception
# there might be cases where we need to set a specific fallback in order to be aligned wih what version app is expecting as a type
#
# Examples:
# alt_usage_data { Gitlab::VERSION }
# alt_usage_data { Gitlab::CurrentSettings.uuid }
# alt_usage_data(fallback: nil) { Gitlab.config.registry.enabled }
#
# * redis_usage_data method
# handles ::Redis::CommandError, Gitlab::UsageDataCounters::BaseCounter::UnknownEvent
...
...
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