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
cf3186a3
Commit
cf3186a3
authored
Dec 09, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove save_raw_usage_data feature flag
- Usage ping payload is saved now in raw_usage_data table
parent
c9f1648c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
46 deletions
+10
-46
app/models/raw_usage_data.rb
app/models/raw_usage_data.rb
+1
-1
app/services/submit_usage_ping_service.rb
app/services/submit_usage_ping_service.rb
+0
-2
changelogs/unreleased/241158-remove-feature-flag-save_raw_usage_data.yml
...leased/241158-remove-feature-flag-save_raw_usage_data.yml
+5
-0
config/feature_flags/development/save_raw_usage_data.yml
config/feature_flags/development/save_raw_usage_data.yml
+0
-8
spec/models/raw_usage_data_spec.rb
spec/models/raw_usage_data_spec.rb
+3
-21
spec/services/submit_usage_ping_service_spec.rb
spec/services/submit_usage_ping_service_spec.rb
+1
-14
No files found.
app/models/raw_usage_data.rb
View file @
cf3186a3
...
...
@@ -5,6 +5,6 @@ class RawUsageData < ApplicationRecord
validates
:recorded_at
,
presence:
true
,
uniqueness:
true
def
update_sent_at!
self
.
update_column
(
:sent_at
,
Time
.
current
)
if
Feature
.
enabled?
(
:save_raw_usage_data
)
self
.
update_column
(
:sent_at
,
Time
.
current
)
end
end
app/services/submit_usage_ping_service.rb
View file @
cf3186a3
...
...
@@ -43,8 +43,6 @@ class SubmitUsagePingService
private
def
save_raw_usage_data
(
usage_data
)
return
unless
Feature
.
enabled?
(
:save_raw_usage_data
)
RawUsageData
.
safe_find_or_create_by
(
recorded_at:
usage_data
[
:recorded_at
])
do
|
record
|
record
.
payload
=
usage_data
end
...
...
changelogs/unreleased/241158-remove-feature-flag-save_raw_usage_data.yml
0 → 100644
View file @
cf3186a3
---
title
:
Save usage ping payload in raw_usage_data table
merge_request
:
49559
author
:
type
:
added
config/feature_flags/development/save_raw_usage_data.yml
deleted
100644 → 0
View file @
c9f1648c
---
name
:
save_raw_usage_data
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38457
rollout_issue_url
:
milestone
:
'
13.3'
type
:
development
group
:
group::product analytics
default_enabled
:
false
spec/models/raw_usage_data_spec.rb
View file @
cf3186a3
...
...
@@ -16,28 +16,10 @@ RSpec.describe RawUsageData do
describe
'#update_sent_at!'
do
let
(
:raw_usage_data
)
{
create
(
:raw_usage_data
)
}
context
'with save_raw_usage_data feature enabled'
do
before
do
stub_feature_flags
(
save_raw_usage_data:
true
)
end
it
'updates sent_at'
do
raw_usage_data
.
update_sent_at!
it
'updates sent_at'
do
raw_usage_data
.
update_sent_at!
expect
(
raw_usage_data
.
sent_at
).
not_to
be_nil
end
end
context
'with save_raw_usage_data feature disabled'
do
before
do
stub_feature_flags
(
save_raw_usage_data:
false
)
end
it
'updates sent_at'
do
raw_usage_data
.
update_sent_at!
expect
(
raw_usage_data
.
sent_at
).
to
be_nil
end
expect
(
raw_usage_data
.
sent_at
).
not_to
be_nil
end
end
end
...
...
spec/services/submit_usage_ping_service_spec.rb
View file @
cf3186a3
...
...
@@ -134,10 +134,9 @@ RSpec.describe SubmitUsagePingService do
it_behaves_like
'saves DevOps report data from the response'
end
context
'with sav
e_raw_usage_data feature enabled
'
do
context
'with sav
ing raw_usage_data
'
do
before
do
stub_response
(
body:
with_dev_ops_score_params
)
stub_feature_flags
(
save_raw_usage_data:
true
)
end
it
'creates a raw_usage_data record'
do
...
...
@@ -159,18 +158,6 @@ RSpec.describe SubmitUsagePingService do
end
end
context
'with save_raw_usage_data feature disabled'
do
before
do
stub_response
(
body:
with_dev_ops_score_params
)
end
it
'does not create a raw_usage_data record'
do
stub_feature_flags
(
save_raw_usage_data:
false
)
expect
{
subject
.
execute
}.
to
change
(
RawUsageData
,
:count
).
by
(
0
)
end
end
context
'and usage ping response has unsuccessful status'
do
before
do
stub_response
(
body:
nil
,
status:
504
)
...
...
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