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
eb4bee4a
Commit
eb4bee4a
authored
Aug 31, 2020
by
Dmitry Gruzd
Committed by
Mark Chao
Aug 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore feature flag for track_advanced_search
parent
8691c13a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
ee/app/controllers/ee/search_controller.rb
ee/app/controllers/ee/search_controller.rb
+3
-2
ee/spec/controllers/ee/search_controller_spec.rb
ee/spec/controllers/ee/search_controller_spec.rb
+27
-13
No files found.
ee/app/controllers/ee/search_controller.rb
View file @
eb4bee4a
...
...
@@ -5,7 +5,7 @@ module EE
extend
ActiveSupport
::
Concern
prepended
do
before_action
:track_advanced_search
,
only: :show
,
if:
->
{
request
.
format
.
html?
&&
request
.
headers
[
'DNT'
]
!=
'1'
}
before_action
:track_advanced_search
,
only: :show
,
if:
->
{
::
Feature
.
enabled?
(
:search_track_unique_users
)
&&
request
.
format
.
html?
&&
request
.
headers
[
'DNT'
]
!=
'1'
}
end
private
...
...
@@ -15,7 +15,8 @@ module EE
track_unique_redis_hll_event
(
"i_search_advanced"
,
:search_track_unique_users
)
if
search_service
.
use_elasticsearch?
# track unique users who search against paid groups/projects
track_unique_redis_hll_event
(
"i_search_paid"
,
:search_track_unique_users
)
if
(
search_service
.
project
||
search_service
.
group
)
&
.
feature_available?
(
:elastic_search
)
# this line is commented out because of https://gitlab.com/gitlab-org/gitlab/-/issues/243486
# track_unique_redis_hll_event("i_search_paid", :search_track_unique_users) if (search_service.project || search_service.group)&.feature_available?(:elastic_search)
end
end
end
ee/spec/controllers/ee/search_controller_spec.rb
View file @
eb4bee4a
...
...
@@ -17,24 +17,38 @@ RSpec.describe SearchController do
end
context
'i_search_advanced'
do
it_behaves_like
'tracking unique hll events'
,
:show
do
let
(
:request_params
)
{
{
scope:
'projects'
,
search:
'term'
}
}
let
(
:target_id
)
{
'i_search_advanced'
}
end
end
let
(
:target_id
)
{
'i_search_advanced'
}
let
(
:request_params
)
{
{
scope:
'projects'
,
search:
'term'
}
}
context
'i_search_paid'
do
let
(
:group
)
{
create
(
:group
)
}
it_behaves_like
'tracking unique hll events'
,
:show
before
do
allow
(
group
).
to
receive
(
:feature_available?
).
with
(
:elastic_search
).
and_return
(
tru
e
)
end
it
'does not track if feature flag is disabled'
do
stub_feature_flags
(
search_track_unique_users:
fals
e
)
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
not_to
receive
(
:track_event
).
with
(
instance_of
(
String
),
target_id
)
it_behaves_like
'tracking unique hll events'
,
:show
do
let
(
:request_params
)
{
{
group_id:
group
.
id
,
scope:
'blobs'
,
search:
'term'
}
}
let
(
:target_id
)
{
'i_search_paid'
}
get
:show
,
params:
request_params
,
format: :html
end
end
# i_search_paid is commented out because of https://gitlab.com/gitlab-org/gitlab/-/issues/243486
# context 'i_search_paid' do
# let(:group) { create(:group) }
# let(:request_params) { { group_id: group.id, scope: 'blobs', search: 'term' } }
# let(:target_id) { 'i_search_paid' }
# before do
# allow(group).to receive(:feature_available?).with(:elastic_search).and_return(true)
# end
# it_behaves_like 'tracking unique hll events', :show
# it 'does not track if feature flag is disabled' do
# stub_feature_flags(search_track_unique_users: false)
# expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event).with(instance_of(String), target_id)
# get :show, params: request_params, format: :html
# end
# 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