diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /lib/product_analytics/collector_app.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'lib/product_analytics/collector_app.rb')
-rw-r--r-- | lib/product_analytics/collector_app.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/product_analytics/collector_app.rb b/lib/product_analytics/collector_app.rb deleted file mode 100644 index 1008d2f264c..00000000000 --- a/lib/product_analytics/collector_app.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module ProductAnalytics - class CollectorApp - def call(env) - request = Rack::Request.new(env) - params = request.params - - return not_found unless EventParams.has_required_params?(params) - - # Product analytics feature is behind a flag and is disabled by default. - # We expect limited amount of projects with this feature enabled in first release. - # Since collector has no authentication we temporary prevent recording of events - # for project without the feature enabled. During increase of feature adoption, this - # check will be removed for better performance. - project = Project.find(params['aid'].to_i) - return not_found unless Feature.enabled?(:product_analytics, project) - - # Snowplow tracker has own format of events. - # We need to convert them to match the schema of our database. - event_params = EventParams.parse_event_params(params) - - if ProductAnalyticsEvent.create(event_params) - ok - else - not_found - end - rescue ActiveRecord::InvalidForeignKey, ActiveRecord::RecordNotFound - not_found - end - - def ok - [200, {}, []] - end - - def not_found - [404, {}, []] - end - end -end |