Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
22e82122
Commit
22e82122
authored
Mar 09, 2021
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Snowplow controller concern and usages
Part of Snowplow standardization effort
parent
5dd14a02
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
13 additions
and
71 deletions
+13
-71
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-1
app/controllers/groups/email_campaigns_controller.rb
app/controllers/groups/email_campaigns_controller.rb
+1
-2
app/helpers/packages_helper.rb
app/helpers/packages_helper.rb
+2
-1
ee/app/controllers/concerns/group_invite_members.rb
ee/app/controllers/concerns/group_invite_members.rb
+1
-1
ee/app/controllers/groups/analytics/coverage_reports_controller.rb
...ntrollers/groups/analytics/coverage_reports_controller.rb
+1
-1
ee/app/controllers/groups/analytics/repository_analytics_controller.rb
...llers/groups/analytics/repository_analytics_controller.rb
+1
-1
ee/app/controllers/survey_responses_controller.rb
ee/app/controllers/survey_responses_controller.rb
+1
-3
ee/spec/controllers/survey_responses_controller_spec.rb
ee/spec/controllers/survey_responses_controller_spec.rb
+2
-2
lib/gitlab/tracking.rb
lib/gitlab/tracking.rb
+0
-15
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+0
-2
spec/controllers/projects/registry/tags_controller_spec.rb
spec/controllers/projects/registry/tags_controller_spec.rb
+4
-3
spec/support/shared_examples/controllers/trackable_shared_examples.rb
.../shared_examples/controllers/trackable_shared_examples.rb
+0
-39
No files found.
app/controllers/application_controller.rb
View file @
22e82122
...
...
@@ -16,7 +16,6 @@ class ApplicationController < ActionController::Base
include
SessionlessAuthentication
include
SessionsHelper
include
ConfirmEmailWarning
include
Gitlab
::
Tracking
::
ControllerConcern
include
Gitlab
::
Experimentation
::
ControllerConcern
include
InitializesCurrentUserMode
include
Impersonation
...
...
app/controllers/groups/email_campaigns_controller.rb
View file @
22e82122
...
...
@@ -2,7 +2,6 @@
class
Groups::EmailCampaignsController
<
Groups
::
ApplicationController
include
InProductMarketingHelper
include
Gitlab
::
Tracking
::
ControllerConcern
EMAIL_CAMPAIGNS_SCHEMA_URL
=
'iglu:com.gitlab/email_campaigns/jsonschema/1-0-0'
...
...
@@ -25,7 +24,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController
subject_line:
subject_line
(
@track
,
@series
)
}
track_
self_describing_event
(
EMAIL_CAMPAIGNS_SCHEMA_URL
,
data:
data
)
::
Gitlab
::
Tracking
.
self_describing_event
(
EMAIL_CAMPAIGNS_SCHEMA_URL
,
data:
data
)
end
def
redirect_link
...
...
app/helpers/packages_helper.rb
View file @
22e82122
...
...
@@ -50,6 +50,7 @@ module PackagesHelper
def
track_package_event
(
event_name
,
scope
,
**
args
)
::
Packages
::
CreateEventService
.
new
(
nil
,
current_user
,
event_name:
event_name
,
scope:
scope
).
execute
track_event
(
event_name
,
**
args
)
category
=
args
.
delete
(
:category
)
||
self
.
class
.
name
::
Gitlab
::
Tracking
.
event
(
category
,
event_name
.
to_s
,
**
args
)
end
end
ee/app/controllers/concerns/group_invite_members.rb
View file @
22e82122
...
...
@@ -11,7 +11,7 @@ module GroupInviteMembers
result
=
Members
::
CreateService
.
new
(
current_user
,
invite_params
).
execute
(
group
)
track_event
(
'invite_members'
,
label:
'new_group_form'
)
if
result
[
:status
]
==
:success
::
Gitlab
::
Tracking
.
event
(
self
.
class
.
name
,
'invite_members'
,
label:
'new_group_form'
)
if
result
[
:status
]
==
:success
end
def
emails_param
...
...
ee/app/controllers/groups/analytics/coverage_reports_controller.rb
View file @
22e82122
...
...
@@ -11,7 +11,7 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
def
index
respond_to
do
|
format
|
format
.
csv
do
track_event
(
:download_code_coverage_csv
,
**
download_tracker_params
)
::
Gitlab
::
Tracking
.
event
(
self
.
class
.
name
,
'download_code_coverage_csv'
,
**
download_tracker_params
)
send_data
(
render_csv
(
report_results
),
type:
'text/csv; charset=utf-8'
)
end
end
...
...
ee/app/controllers/groups/analytics/repository_analytics_controller.rb
View file @
22e82122
...
...
@@ -12,7 +12,7 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
end
def
show
track_event
(
**
pageview_tracker_params
)
Gitlab
::
Tracking
.
event
(
self
.
class
.
name
,
'show'
,
**
pageview_tracker_params
)
end
private
...
...
ee/app/controllers/survey_responses_controller.rb
View file @
22e82122
# frozen_string_literal: true
class
SurveyResponsesController
<
ApplicationController
include
Gitlab
::
Tracking
::
ControllerConcern
SURVEY_RESPONSE_SCHEMA_URL
=
'iglu:com.gitlab/survey_response/jsonschema/1-0-0'
skip_before_action
:authenticate_user!
...
...
@@ -28,7 +26,7 @@ class SurveyResponsesController < ApplicationController
response:
params
[
:response
]
}.
compact
track_
self_describing_event
(
SURVEY_RESPONSE_SCHEMA_URL
,
data:
data
)
::
Gitlab
::
Tracking
.
self_describing_event
(
SURVEY_RESPONSE_SCHEMA_URL
,
data:
data
)
end
def
to_number
(
param
)
...
...
ee/spec/controllers/survey_responses_controller_spec.rb
View file @
22e82122
...
...
@@ -21,7 +21,7 @@ RSpec.describe SurveyResponsesController do
end
it
'tracks a survey_response event'
do
expect
(
controller
).
to
receive
(
:track_
self_describing_event
).
with
(
expect
(
Gitlab
::
Tracking
).
to
receive
(
:
self_describing_event
).
with
(
SurveyResponsesController
::
SURVEY_RESPONSE_SCHEMA_URL
,
data:
{
survey_id:
1
,
response:
'bar'
}
)
...
...
@@ -32,7 +32,7 @@ RSpec.describe SurveyResponsesController do
context
'not on GitLab.com'
do
it
'does not track a survey_response event'
do
expect
(
controller
).
not_to
receive
(
:track_
self_describing_event
)
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:
self_describing_event
)
subject
end
...
...
lib/gitlab/tracking.rb
View file @
22e82122
...
...
@@ -4,21 +4,6 @@ module Gitlab
module
Tracking
SNOWPLOW_NAMESPACE
=
'gl'
module
ControllerConcern
extend
ActiveSupport
::
Concern
protected
def
track_event
(
action
=
action_name
,
**
args
)
category
=
args
.
delete
(
:category
)
||
self
.
class
.
name
Gitlab
::
Tracking
.
event
(
category
,
action
.
to_s
,
**
args
)
end
def
track_self_describing_event
(
schema_url
,
data
:,
**
args
)
Gitlab
::
Tracking
.
self_describing_event
(
schema_url
,
data:
data
,
**
args
)
end
end
class
<<
self
def
enabled?
Gitlab
::
CurrentSettings
.
snowplow_enabled?
...
...
spec/controllers/application_controller_spec.rb
View file @
22e82122
...
...
@@ -56,8 +56,6 @@ RSpec.describe ApplicationController do
end
end
it_behaves_like
'a Trackable Controller'
describe
'#add_gon_variables'
do
before
do
Gon
.
clear
...
...
spec/controllers/projects/registry/tags_controller_spec.rb
View file @
22e82122
...
...
@@ -42,7 +42,7 @@ RSpec.describe Projects::Registry::TagsController do
it
'tracks the event'
,
:snowplow
do
get_tags
expect_snowplow_event
(
category:
anything
,
action:
'list_tags'
)
expect_snowplow_event
(
category:
'Projects::Registry::TagsController'
,
action:
'list_tags'
)
end
end
...
...
@@ -107,11 +107,12 @@ RSpec.describe Projects::Registry::TagsController do
destroy_tag
(
'test.'
)
end
it
'tracks the event'
do
it
'tracks the event'
,
:snowplow
do
expect_delete_tags
(
%w[test.]
)
expect
(
controller
).
to
receive
(
:track_event
).
with
(
:delete_tag
)
destroy_tag
(
'test.'
)
expect_snowplow_event
(
category:
'Projects::Registry::TagsController'
,
action:
'delete_tag'
)
end
end
end
...
...
spec/support/shared_examples/controllers/trackable_shared_examples.rb
deleted
100644 → 0
View file @
5dd14a02
# frozen_string_literal: true
RSpec
.
shared_examples
'a Trackable Controller'
do
describe
'#track_event'
,
:snowplow
do
before
do
sign_in
user
end
context
'with no params'
do
controller
(
described_class
)
do
def
index
track_event
head
:ok
end
end
it
'tracks the action name'
,
:snowplow
do
get
:index
expect_snowplow_event
(
category:
'AnonymousController'
,
action:
'index'
)
end
end
context
'with params'
do
controller
(
described_class
)
do
def
index
track_event
(
'some_event'
,
category:
'SomeCategory'
,
label:
'errorlabel'
)
head
:ok
end
end
it
'tracks with the specified param'
do
get
:index
expect_snowplow_event
(
category:
'SomeCategory'
,
action:
'some_event'
,
label:
'errorlabel'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment