Commit e8891509 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'dz-improve-error-tracking-collector' into 'master'

Improve error tracking integrated collector

See merge request gitlab-org/gitlab!67756
parents 6a211730 a62d2354
......@@ -22,8 +22,8 @@ module API
end
def feature_enabled?
::Feature.enabled?(:integrated_error_tracking, project) &&
project.error_tracking_setting&.enabled?
project.error_tracking_setting&.enabled? &&
project.error_tracking_setting&.integrated_client?
end
def find_client_key(public_key)
......
......@@ -12,5 +12,9 @@ FactoryBot.define do
trait :disabled do
enabled { false }
end
trait :integrated do
integrated { true }
end
end
end
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe API::ErrorTrackingCollector do
let_it_be(:project) { create(:project, :private) }
let_it_be(:setting) { create(:project_error_tracking_setting, project: project) }
let_it_be(:setting) { create(:project_error_tracking_setting, :integrated, project: project) }
let_it_be(:client_key) { create(:error_tracking_client_key, project: project) }
describe "POST /error_tracking/collector/api/:id/envelope" do
......@@ -40,6 +40,14 @@ RSpec.describe API::ErrorTrackingCollector do
it_behaves_like 'not found'
end
context 'integrated error tracking is disabled' do
before do
setting.update!(integrated: false)
end
it_behaves_like 'not found'
end
context 'feature flag is disabled' do
before do
stub_feature_flags(integrated_error_tracking: false)
......
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