Commit 8f7510cc authored by drew cimino's avatar drew cimino

Feature flag definition

parent 025a5b42
......@@ -7,6 +7,7 @@ module Ci
ArtifactsExistError = Class.new(StandardError)
LSIF_ARTIFACT_TYPE = 'lsif'
METRICS_REPORT_UPLOAD_EVENT_NAME = 'i_testing_metrics_report_artifact_uploaders'
OBJECT_STORAGE_ERRORS = [
Errno::EIO,
......@@ -157,7 +158,7 @@ module Ci
def track_artifact_uploader(artifact)
return unless artifact.file_type == 'metrics'
track_usage_event('i_metrics_report_artifact_uploaders', @job.user_id)
track_usage_event(METRICS_REPORT_UPLOAD_EVENT_NAME, @job.user_id)
end
def parse_dotenv_artifact(artifact)
......
---
name: usage_data_i_testing_metrics_report_artifact_uploaders
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51670
rollout_issue_url:
milestone: '13.9'
type: development
group: group::testing
default_enabled: true
......@@ -27,6 +27,14 @@ RSpec.describe Ci::CreateJobArtifactsService do
UploadedFile.new(upload.path, **params)
end
def unique_metrics_report_uploaders
Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(
event_names: described_class::METRICS_REPORT_UPLOAD_EVENT_NAME,
start_date: 2.weeks.ago,
end_date: 2.weeks.from_now
)
end
describe '#execute' do
subject { service.execute(artifacts_file, params, metadata_file: metadata_file) }
......@@ -43,9 +51,9 @@ RSpec.describe Ci::CreateJobArtifactsService do
end
it 'does not track the job user_id' do
expect(service).not_to receive(:track_usage_event)
subject
expect(unique_metrics_report_uploaders).to eq(0)
end
context 'when metadata file is also uploaded' do
......@@ -188,9 +196,9 @@ RSpec.describe Ci::CreateJobArtifactsService do
let(:params) { { 'artifact_type' => 'metrics', 'artifact_format' => 'gzip' }.with_indifferent_access }
it 'tracks the job user_id' do
expect(service).to receive(:track_usage_event).with('i_metrics_report_artifact_uploaders', 123)
subject
expect(unique_metrics_report_uploaders).to eq(1)
end
end
......
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