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
f5d7b6a8
Commit
f5d7b6a8
authored
Mar 27, 2020
by
Qingyu Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add app server type to usage ping
parent
c38ce405
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
changelogs/unreleased/208502-add-app-server-type-to-usage-ping.yml
...s/unreleased/208502-add-app-server-type-to-usage-ping.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
+24
-0
No files found.
changelogs/unreleased/208502-add-app-server-type-to-usage-ping.yml
0 → 100644
View file @
f5d7b6a8
---
title
:
Add app server type to usage ping
merge_request
:
28189
author
:
type
:
added
lib/gitlab/usage_data.rb
View file @
f5d7b6a8
...
...
@@ -174,10 +174,19 @@ module Gitlab
git:
{
version:
Gitlab
::
Git
.
version
},
gitaly:
{
version:
Gitaly
::
Server
.
all
.
first
.
server_version
,
servers:
Gitaly
::
Server
.
count
,
filesystems:
Gitaly
::
Server
.
filesystems
},
gitlab_pages:
{
enabled:
Gitlab
.
config
.
pages
.
enabled
,
version:
Gitlab
::
Pages
::
VERSION
},
database:
{
adapter:
Gitlab
::
Database
.
adapter_name
,
version:
Gitlab
::
Database
.
version
}
database:
{
adapter:
Gitlab
::
Database
.
adapter_name
,
version:
Gitlab
::
Database
.
version
},
app_server:
{
type:
app_server_type
}
}
end
def
app_server_type
Gitlab
::
Runtime
.
identify
.
to_s
rescue
Gitlab
::
Runtime
::
IdentificationError
=>
e
Gitlab
::
AppLogger
.
error
(
e
.
message
)
Gitlab
::
ErrorTracking
.
track_exception
(
e
)
'unknown_app_server_type'
end
def
ingress_modsecurity_usage
::
Clusters
::
Applications
::
IngressModsecurityUsageService
.
new
.
execute
end
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
f5d7b6a8
...
...
@@ -147,6 +147,8 @@ describe Gitlab::UsageData, :aggregate_failures do
subject
{
described_class
.
components_usage_data
}
it
'gathers components usage data'
do
expect
(
Gitlab
::
UsageData
).
to
receive
(
:app_server_type
).
and_return
(
'server_type'
)
expect
(
subject
[
:app_server
][
:type
]).
to
eq
(
'server_type'
)
expect
(
subject
[
:gitlab_pages
][
:enabled
]).
to
eq
(
Gitlab
.
config
.
pages
.
enabled
)
expect
(
subject
[
:gitlab_pages
][
:version
]).
to
eq
(
Gitlab
::
Pages
::
VERSION
)
expect
(
subject
[
:git
][
:version
]).
to
eq
(
Gitlab
::
Git
.
version
)
...
...
@@ -159,6 +161,28 @@ describe Gitlab::UsageData, :aggregate_failures do
end
end
describe
'#app_server_type'
do
subject
{
described_class
.
app_server_type
}
it
'successfully identifies runtime and returns the identifier'
do
expect
(
Gitlab
::
Runtime
).
to
receive
(
:identify
).
and_return
(
:runtime_identifier
)
is_expected
.
to
eq
(
'runtime_identifier'
)
end
context
'when runtime is not identified'
do
let
(
:exception
)
{
Gitlab
::
Runtime
::
IdentificationError
.
new
(
'exception message from runtime identify'
)
}
it
'logs the exception and returns unknown app server type'
do
expect
(
Gitlab
::
Runtime
).
to
receive
(
:identify
).
and_raise
(
exception
)
expect
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
with
(
exception
.
message
)
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:track_exception
).
with
(
exception
)
expect
(
subject
).
to
eq
(
'unknown_app_server_type'
)
end
end
end
describe
'#cycle_analytics_usage_data'
do
subject
{
described_class
.
cycle_analytics_usage_data
}
...
...
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