Skip to content
Snippets Groups Projects
Commit dee42d97 authored by Vitaly Slobodin's avatar Vitaly Slobodin :crystal_ball:
Browse files

Merge branch 'brodock/error-tracking-config' into 'master'

Add GitLab Error Tracking to /admin settings

See merge request !91148
parents 1f29610d 17f9e75e
No related branches found
No related tags found
1 merge request!91148Add GitLab Error Tracking to /admin settings
Pipeline #581711762 passed
......@@ -238,6 +238,8 @@ def visible_attributes
:email_author_in_body,
:enabled_git_access_protocol,
:enforce_terms,
:error_tracking_enabled,
:error_tracking_api_url,
:external_pipeline_validation_service_timeout,
:external_pipeline_validation_service_token,
:external_pipeline_validation_service_url,
......
......@@ -594,6 +594,14 @@ def self.kroki_formats_attributes
presence: true, length: { maximum: 255 },
if: :sentry_enabled?
validates :error_tracking_enabled,
inclusion: { in: [true, false], message: _('must be a boolean value') }
validates :error_tracking_api_url,
presence: true,
addressable_url: true,
length: { maximum: 255 },
if: :error_tracking_enabled?
validates :users_get_by_id_limit,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :users_get_by_id_limit_allowlist,
......
- expanded = integration_expanded?('error_tracking_')
%section.settings.as-error-tracking.no-animate#js-error-tracking-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('GitLab Error Tracking')
= render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do
= expanded ? _('Collapse') : _('Expand')
%p
= _('Allows projects to track errors using an Opstrace integration.').html_safe % { link: help_page_path('operations/error_tracking.md') }
= link_to _('Learn more.'), help_page_path('operations/error_tracking.md'), target: '_blank', rel: 'noopener noreferrer'
.settings-content
= gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-error-tracking-settings'), html: { class: 'fieldset-form', id: 'error-tracking-settings' } do |f|
= form_errors(@application_setting, pajamas_alert: true) if expanded
%fieldset
.form-group
= f.gitlab_ui_checkbox_component :error_tracking_enabled,
_('Enable GitLab Error Tracking')
.form-group
= f.label :error_tracking_api_url, _('Opstrace endpoint for Error Tracking integration'), class: 'label-light'
= f.text_field :error_tracking_api_url, class: 'form-control gl-form-input'
= f.submit _('Save changes'), class: 'gl-button btn btn-confirm'
......@@ -117,6 +117,7 @@
= render_if_exists 'admin/application_settings/feishu_integration'
= render 'admin/application_settings/third_party_offers'
= render 'admin/application_settings/snowplow'
= render 'admin/application_settings/error_tracking' if Feature.enabled?(:gitlab_error_tracking)
= render 'admin/application_settings/eks'
= render 'admin/application_settings/floc'
= render_if_exists 'admin/application_settings/add_license'
......
---
name: gitlab_error_tracking
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91148
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/366382
milestone: '15.2'
type: development
group: group::observability
default_enabled: false
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddErrorTrackingSettings < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
def up
add_column :application_settings, :error_tracking_enabled, :boolean,
default: false, null: false, if_not_exists: true
add_column :application_settings, :error_tracking_api_url, :text, if_not_exists: true
add_text_limit :application_settings, :error_tracking_api_url, 255
end
def down
remove_column :application_settings, :error_tracking_enabled, if_exists: true
remove_column :application_settings, :error_tracking_api_url, if_exists: true
end
end
1f44130f3f8af92bfaa7de488da2f5f0804045afa6e2ac233d2660a7937a9e32
\ No newline at end of file
......@@ -11329,6 +11329,8 @@ CREATE TABLE application_settings (
encrypted_feishu_app_key_iv bytea,
encrypted_feishu_app_secret bytea,
encrypted_feishu_app_secret_iv bytea,
error_tracking_enabled boolean DEFAULT false NOT NULL,
error_tracking_api_url text,
git_rate_limit_users_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)),
......@@ -11346,6 +11348,7 @@ CREATE TABLE application_settings (
CONSTRAINT check_3455368420 CHECK ((char_length(database_grafana_api_url) <= 255)),
CONSTRAINT check_3559645ae5 CHECK ((char_length(container_registry_import_target_plan) <= 255)),
CONSTRAINT check_3def0f1829 CHECK ((char_length(sentry_clientside_dsn) <= 255)),
CONSTRAINT check_492cc1354d CHECK ((char_length(error_tracking_api_url) <= 255)),
CONSTRAINT check_4f8b811780 CHECK ((char_length(sentry_dsn) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)),
......@@ -3902,6 +3902,9 @@ msgstr ""
msgid "Allows projects or subgroups in this group to override the global setting."
msgstr ""
 
msgid "Allows projects to track errors using an Opstrace integration."
msgstr ""
msgid "Allows you to add and manage Kubernetes clusters."
msgstr ""
 
......@@ -14215,6 +14218,9 @@ msgstr ""
msgid "Enable Auto DevOps"
msgstr ""
 
msgid "Enable GitLab Error Tracking"
msgstr ""
msgid "Enable Gitpod"
msgstr ""
 
......@@ -17374,6 +17380,9 @@ msgstr ""
msgid "GitLab Billing Team."
msgstr ""
 
msgid "GitLab Error Tracking"
msgstr ""
msgid "GitLab Import"
msgstr ""
 
......@@ -27132,6 +27141,9 @@ msgstr ""
msgid "OperationsDashboard|The operations dashboard provides a summary of each project's operational health, including pipeline and alert statuses."
msgstr ""
 
msgid "Opstrace endpoint for Error Tracking integration"
msgstr ""
msgid "Optimize your workflow with CI/CD Pipelines"
msgstr ""
 
......@@ -1075,6 +1075,27 @@ def expect_invalid
is_expected.to validate_numericality_of(:metrics_method_call_threshold).is_greater_than_or_equal_to(0)
end
end
context 'error tracking settings' do
context 'with error tracking disabled' do
before do
setting.error_tracking_enabled = false
end
it { is_expected.to allow_value(nil).for(:error_tracking_api_url) }
end
context 'with error tracking enabled' do
before do
setting.error_tracking_enabled = true
end
it { is_expected.to allow_value(http).for(:error_tracking_api_url) }
it { is_expected.to allow_value(https).for(:error_tracking_api_url) }
it { is_expected.not_to allow_value(ftp).for(:error_tracking_api_url) }
it { is_expected.to validate_presence_of(:error_tracking_api_url) }
end
end
end
context 'restrict creating duplicates' do
......
......@@ -97,4 +97,26 @@
expect(rendered).to match ' data-minimum-password-length='
end
end
describe 'error tracking integration' do
context 'with error tracking feature flag enabled' do
it 'expects error tracking settings to be available' do
stub_feature_flags(gitlab_error_tracking: true)
render
expect(rendered).to have_field('application_setting_error_tracking_api_url')
end
end
context 'with error tracking feature flag disabled' do
it 'expects error tracking settings to not be avaiable' do
stub_feature_flags(gitlab_error_tracking: false)
render
expect(rendered).not_to have_field('application_setting_error_tracking_api_url')
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment