Commit cf3186a3 authored by alinamihaila's avatar alinamihaila

Remove save_raw_usage_data feature flag

  - Usage ping payload is saved now in
  raw_usage_data table
parent c9f1648c
......@@ -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
......@@ -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
......
---
title: Save usage ping payload in raw_usage_data table
merge_request: 49559
author:
type: added
---
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
......@@ -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
......
......@@ -134,10 +134,9 @@ RSpec.describe SubmitUsagePingService do
it_behaves_like 'saves DevOps report data from the response'
end
context 'with save_raw_usage_data feature enabled' do
context 'with saving 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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment