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
eae5f187
Commit
eae5f187
authored
Oct 08, 2021
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove product analytics tracking
Changelog: removed
parent
03226ec9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
142 deletions
+0
-142
config/feature_flags/ops/product_analytics_tracking.yml
config/feature_flags/ops/product_analytics_tracking.yml
+0
-8
lib/gitlab/tracking.rb
lib/gitlab/tracking.rb
+0
-5
lib/gitlab/tracking/destinations/product_analytics.rb
lib/gitlab/tracking/destinations/product_analytics.rb
+0
-41
spec/lib/gitlab/tracking/destinations/product_analytics_spec.rb
...ib/gitlab/tracking/destinations/product_analytics_spec.rb
+0
-84
spec/lib/gitlab/tracking_spec.rb
spec/lib/gitlab/tracking_spec.rb
+0
-2
spec/support/stub_snowplow.rb
spec/support/stub_snowplow.rb
+0
-2
No files found.
config/feature_flags/ops/product_analytics_tracking.yml
deleted
100644 → 0
View file @
03226ec9
---
name
:
product_analytics_tracking
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46482
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/285519
milestone
:
'
13.7'
type
:
ops
group
:
group::product intelligence
default_enabled
:
false
lib/gitlab/tracking.rb
View file @
eae5f187
...
...
@@ -13,7 +13,6 @@ module Gitlab
contexts
=
[
Tracking
::
StandardContext
.
new
(
project:
project
,
user:
user
,
namespace:
namespace
,
**
extra
).
to_context
,
*
context
]
snowplow
.
event
(
category
,
action
,
label:
label
,
property:
property
,
value:
value
,
context:
contexts
)
product_analytics
.
event
(
category
,
action
,
label:
label
,
property:
property
,
value:
value
,
context:
contexts
)
rescue
StandardError
=>
error
Gitlab
::
ErrorTracking
.
track_and_raise_for_dev_exception
(
error
,
snowplow_category:
category
,
snowplow_action:
action
)
end
...
...
@@ -35,10 +34,6 @@ module Gitlab
def
snowplow
@snowplow
||=
Gitlab
::
Tracking
::
Destinations
::
Snowplow
.
new
end
def
product_analytics
@product_analytics
||=
Gitlab
::
Tracking
::
Destinations
::
ProductAnalytics
.
new
end
end
end
end
lib/gitlab/tracking/destinations/product_analytics.rb
deleted
100644 → 0
View file @
03226ec9
# frozen_string_literal: true
module
Gitlab
module
Tracking
module
Destinations
class
ProductAnalytics
<
Base
extend
::
Gitlab
::
Utils
::
Override
include
::
Gitlab
::
Utils
::
StrongMemoize
override
:event
def
event
(
category
,
action
,
label:
nil
,
property:
nil
,
value:
nil
,
context:
nil
)
return
unless
event_allowed?
(
category
,
action
)
return
unless
enabled?
tracker
.
track_struct_event
(
category
,
action
,
label
,
property
,
value
,
context
,
(
Time
.
now
.
to_f
*
1000
).
to_i
)
end
private
def
event_allowed?
(
category
,
action
)
category
==
'epics'
&&
action
==
'promote'
end
def
enabled?
Feature
.
enabled?
(
:product_analytics_tracking
,
type: :ops
)
&&
Gitlab
::
CurrentSettings
.
usage_ping_enabled?
&&
Gitlab
::
CurrentSettings
.
self_monitoring_project_id
.
present?
end
def
tracker
@tracker
||=
SnowplowTracker
::
Tracker
.
new
(
SnowplowTracker
::
AsyncEmitter
.
new
(
::
ProductAnalytics
::
Tracker
::
COLLECTOR_URL
,
protocol:
Gitlab
.
config
.
gitlab
.
protocol
),
SnowplowTracker
::
Subject
.
new
,
Gitlab
::
Tracking
::
SNOWPLOW_NAMESPACE
,
Gitlab
::
CurrentSettings
.
self_monitoring_project_id
.
to_s
)
end
end
end
end
end
spec/lib/gitlab/tracking/destinations/product_analytics_spec.rb
deleted
100644 → 0
View file @
03226ec9
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Tracking
::
Destinations
::
ProductAnalytics
do
let
(
:emitter
)
{
SnowplowTracker
::
Emitter
.
new
(
'localhost'
,
buffer_size:
1
)
}
let
(
:tracker
)
{
SnowplowTracker
::
Tracker
.
new
(
emitter
,
SnowplowTracker
::
Subject
.
new
,
'namespace'
,
'app_id'
)
}
describe
'#event'
do
shared_examples
'does not send an event'
do
it
'does not send an event'
do
expect_any_instance_of
(
SnowplowTracker
::
Tracker
).
not_to
receive
(
:track_struct_event
)
subject
.
event
(
allowed_category
,
allowed_action
)
end
end
let
(
:allowed_category
)
{
'epics'
}
let
(
:allowed_action
)
{
'promote'
}
let
(
:self_monitoring_project
)
{
create
(
:project
)
}
before
do
stub_feature_flags
(
product_analytics_tracking:
true
)
stub_application_setting
(
self_monitoring_project_id:
self_monitoring_project
.
id
)
stub_application_setting
(
usage_ping_enabled:
true
)
end
context
'with allowed event'
do
it
'sends an event to Product Analytics snowplow collector'
do
expect
(
SnowplowTracker
::
AsyncEmitter
)
.
to
receive
(
:new
)
.
with
(
ProductAnalytics
::
Tracker
::
COLLECTOR_URL
,
protocol:
Gitlab
.
config
.
gitlab
.
protocol
)
.
and_return
(
emitter
)
expect
(
SnowplowTracker
::
Tracker
)
.
to
receive
(
:new
)
.
with
(
emitter
,
an_instance_of
(
SnowplowTracker
::
Subject
),
Gitlab
::
Tracking
::
SNOWPLOW_NAMESPACE
,
self_monitoring_project
.
id
.
to_s
)
.
and_return
(
tracker
)
freeze_time
do
expect
(
tracker
)
.
to
receive
(
:track_struct_event
)
.
with
(
allowed_category
,
allowed_action
,
'label'
,
'property'
,
1.5
,
nil
,
(
Time
.
now
.
to_f
*
1000
).
to_i
)
subject
.
event
(
allowed_category
,
allowed_action
,
label:
'label'
,
property:
'property'
,
value:
1.5
)
end
end
end
context
'with non-allowed event'
do
it
'does not send an event'
do
expect_any_instance_of
(
SnowplowTracker
::
Tracker
).
not_to
receive
(
:track_struct_event
)
subject
.
event
(
'category'
,
'action'
)
subject
.
event
(
allowed_category
,
'action'
)
subject
.
event
(
'category'
,
allowed_action
)
end
end
context
'when self-monitoring project does not exist'
do
before
do
stub_application_setting
(
self_monitoring_project_id:
nil
)
end
include_examples
'does not send an event'
end
context
'when product_analytics_tracking FF is disabled'
do
before
do
stub_feature_flags
(
product_analytics_tracking:
false
)
end
include_examples
'does not send an event'
end
context
'when usage ping is disabled'
do
before
do
stub_application_setting
(
usage_ping_enabled:
false
)
end
include_examples
'does not send an event'
end
end
end
spec/lib/gitlab/tracking_spec.rb
View file @
eae5f187
...
...
@@ -41,7 +41,6 @@ RSpec.describe Gitlab::Tracking do
shared_examples
'delegates to destination'
do
|
klass
|
before
do
allow_any_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
Snowplow
).
to
receive
(
:event
)
allow_any_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
ProductAnalytics
).
to
receive
(
:event
)
end
it
"delegates to
#{
klass
}
destination"
do
...
...
@@ -73,7 +72,6 @@ RSpec.describe Gitlab::Tracking do
end
it_behaves_like
'delegates to destination'
,
Gitlab
::
Tracking
::
Destinations
::
Snowplow
it_behaves_like
'delegates to destination'
,
Gitlab
::
Tracking
::
Destinations
::
ProductAnalytics
it
'tracks errors'
do
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:track_and_raise_for_dev_exception
).
with
(
...
...
spec/support/stub_snowplow.rb
View file @
eae5f187
...
...
@@ -8,8 +8,6 @@ module StubSnowplow
host
=
'localhost'
# rubocop:disable RSpec/AnyInstanceOf
allow_any_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
ProductAnalytics
).
to
receive
(
:event
)
allow_any_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
Snowplow
)
.
to
receive
(
:emitter
)
.
and_return
(
SnowplowTracker
::
Emitter
.
new
(
host
,
buffer_size:
buffer_size
))
...
...
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