Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-05 00:07:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-05 00:07:37 +0300
commit808b8561f4e75b2db7c7e94a6c7651efb546048b (patch)
tree2cb7546939b56fef3a73a52dd8790de55f0fc0e4 /app/models
parentcc514c362bcd4b657bf6a6d1d37f5305952df363 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/analytics/cycle_analytics/stage.rb17
-rw-r--r--app/models/concerns/database_event_tracking.rb52
-rw-r--r--app/models/integrations/external_wiki.rb1
-rw-r--r--app/models/merge_request/metrics.rb30
4 files changed, 2 insertions, 98 deletions
diff --git a/app/models/analytics/cycle_analytics/stage.rb b/app/models/analytics/cycle_analytics/stage.rb
index 6f152e7749e..4686dc3aedd 100644
--- a/app/models/analytics/cycle_analytics/stage.rb
+++ b/app/models/analytics/cycle_analytics/stage.rb
@@ -7,7 +7,6 @@ module Analytics
self.table_name = :analytics_cycle_analytics_group_stages
- include DatabaseEventTracking
include Analytics::CycleAnalytics::Stageable
include Analytics::CycleAnalytics::Parentable
@@ -38,22 +37,6 @@ module Analytics
.select("DISTINCT ON(stage_event_hash_id) #{quoted_table_name}.*")
end
- SNOWPLOW_ATTRIBUTES = %i[
- id
- created_at
- updated_at
- relative_position
- start_event_identifier
- end_event_identifier
- group_id
- start_event_label_id
- end_event_label_id
- hidden
- custom
- name
- group_value_stream_id
- ].freeze
-
private
def max_stages_count
diff --git a/app/models/concerns/database_event_tracking.rb b/app/models/concerns/database_event_tracking.rb
deleted file mode 100644
index 7e2f445189e..00000000000
--- a/app/models/concerns/database_event_tracking.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# frozen_string_literal: true
-
-module DatabaseEventTracking
- extend ActiveSupport::Concern
-
- included do
- after_create_commit :publish_database_create_event
- after_destroy_commit :publish_database_destroy_event
- after_update_commit :publish_database_update_event
- end
-
- def publish_database_create_event
- publish_database_event('create')
- end
-
- def publish_database_destroy_event
- publish_database_event('destroy')
- end
-
- def publish_database_update_event
- publish_database_event('update')
- end
-
- def publish_database_event(name)
- # Gitlab::Tracking#event is triggering Snowplow event
- # Snowplow events are sent with usage of
- # https://snowplow.github.io/snowplow-ruby-tracker/SnowplowTracker/AsyncEmitter.html
- # that reports data asynchronously and does not impact performance nor carries a risk of
- # rollback in case of error
-
- Gitlab::Tracking.database_event(
- self.class.to_s,
- "database_event_#{name}",
- label: self.class.table_name,
- project: try(:project),
- namespace: (try(:group) || try(:namespace)) || try(:project)&.namespace,
- property: name,
- **filtered_record_attributes
- )
- rescue StandardError => err
- # this rescue should be a dead code due to utilization of AsyncEmitter, however
- # since this concern is expected to be included in every model, it is better to
- # prevent against any unexpected outcome
- Gitlab::ErrorTracking.track_and_raise_for_dev_exception(err)
- end
-
- def filtered_record_attributes
- attributes
- .with_indifferent_access
- .slice(*self.class::SNOWPLOW_ATTRIBUTES)
- end
-end
diff --git a/app/models/integrations/external_wiki.rb b/app/models/integrations/external_wiki.rb
index 7408f86d231..e5360e58426 100644
--- a/app/models/integrations/external_wiki.rb
+++ b/app/models/integrations/external_wiki.rb
@@ -7,6 +7,7 @@ module Integrations
field :external_wiki_url,
section: SECTION_TYPE_CONNECTION,
title: -> { s_('ExternalWikiService|External wiki URL') },
+ description: -> { s_('ExternalWikiService|URL of the external wiki.') },
placeholder: -> { s_('ExternalWikiService|https://example.com/xxx/wiki/...') },
help: -> { s_('ExternalWikiService|Enter the URL to the external wiki.') },
required: true
diff --git a/app/models/merge_request/metrics.rb b/app/models/merge_request/metrics.rb
index 3c592c0008f..6d6c0ee07af 100644
--- a/app/models/merge_request/metrics.rb
+++ b/app/models/merge_request/metrics.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class MergeRequest::Metrics < ApplicationRecord
- include DatabaseEventTracking
-
belongs_to :merge_request, inverse_of: :metrics
belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :pipeline_id
belongs_to :latest_closed_by, class_name: 'User'
@@ -33,8 +31,7 @@ class MergeRequest::Metrics < ApplicationRecord
RETURNING id, #{inserted_columns.join(', ')}
SQL
- result = connection.execute(sql).first
- new(result).publish_database_create_event
+ connection.execute(sql)
end
end
@@ -48,31 +45,6 @@ class MergeRequest::Metrics < ApplicationRecord
with_valid_time_to_merge
.pick(time_to_merge_expression)
end
-
- SNOWPLOW_ATTRIBUTES = %i[
- id
- merge_request_id
- latest_build_started_at
- latest_build_finished_at
- first_deployed_to_production_at
- merged_at
- created_at
- updated_at
- pipeline_id
- merged_by_id
- latest_closed_by_id
- latest_closed_at
- first_comment_at
- first_commit_at
- last_commit_at
- diff_size
- modified_paths_size
- commits_count
- first_approved_at
- first_reassigned_at
- added_lines
- removed_lines
- ].freeze
end
MergeRequest::Metrics.prepend_mod_with('MergeRequest::Metrics')