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
f48b05ed
Commit
f48b05ed
authored
Aug 11, 2020
by
Alina Mihaila
Committed by
James Lopez
Aug 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version-app url should be environment specific
parent
82678ecc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
app/services/submit_usage_ping_service.rb
app/services/submit_usage_ping_service.rb
+12
-2
spec/services/submit_usage_ping_service_spec.rb
spec/services/submit_usage_ping_service_spec.rb
+1
-1
No files found.
app/services/submit_usage_ping_service.rb
View file @
f48b05ed
# frozen_string_literal: true
class
SubmitUsagePingService
URL
=
'https://version.gitlab.com/usage_data'
PRODUCTION_URL
=
'https://version.gitlab.com/usage_data'
STAGING_URL
=
'https://gitlab-services-version-gitlab-com-staging.gs-staging.gitlab.org/usage_data'
METRICS
=
%w[leader_issues instance_issues percentage_issues leader_notes instance_notes
percentage_notes leader_milestones instance_milestones percentage_milestones
...
...
@@ -23,7 +24,7 @@ class SubmitUsagePingService
raise
SubmissionError
.
new
(
'Usage data is blank'
)
if
payload
.
blank?
response
=
Gitlab
::
HTTP
.
post
(
URL
,
url
,
body:
payload
,
allow_local_requests:
true
,
headers:
{
'Content-type'
=>
'application/json'
}
...
...
@@ -45,4 +46,13 @@ class SubmitUsagePingService
metrics
.
slice
(
*
METRICS
)
)
end
# See https://gitlab.com/gitlab-org/gitlab/-/issues/233615 for details
def
url
if
Rails
.
env
.
production?
PRODUCTION_URL
else
STAGING_URL
end
end
end
spec/services/submit_usage_ping_service_spec.rb
View file @
f48b05ed
...
...
@@ -164,7 +164,7 @@ RSpec.describe SubmitUsagePingService do
end
def
stub_response
(
body
:,
status:
201
)
stub_full_request
(
'https://version.gitlab.com/usage_data'
,
method: :post
)
stub_full_request
(
SubmitUsagePingService
::
STAGING_URL
,
method: :post
)
.
to_return
(
headers:
{
'Content-Type'
=>
'application/json'
},
body:
body
.
to_json
,
...
...
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