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
f67ec92e
Commit
f67ec92e
authored
Nov 17, 2020
by
fjsanpedro
Committed by
Francisco Javier López
Nov 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MAU counter for snippet show action
In this commit we add the logic to track the snippets show action
parent
8757820e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
2 deletions
+26
-2
app/controllers/concerns/snippets_actions.rb
app/controllers/concerns/snippets_actions.rb
+3
-0
config/feature_flags/development/usage_data_i_snippets_show.yml
.../feature_flags/development/usage_data_i_snippets_show.yml
+8
-0
lib/gitlab/usage_data_counters/known_events/common.yml
lib/gitlab/usage_data_counters/known_events/common.yml
+5
-0
spec/controllers/snippets_controller_spec.rb
spec/controllers/snippets_controller_spec.rb
+7
-0
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
.../lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
+2
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-1
No files found.
app/controllers/concerns/snippets_actions.rb
View file @
f67ec92e
...
@@ -9,11 +9,14 @@ module SnippetsActions
...
@@ -9,11 +9,14 @@ module SnippetsActions
include
Gitlab
::
NoteableMetadata
include
Gitlab
::
NoteableMetadata
include
Snippets
::
SendBlob
include
Snippets
::
SendBlob
include
SnippetsSort
include
SnippetsSort
include
RedisTracking
included
do
included
do
skip_before_action
:verify_authenticity_token
,
skip_before_action
:verify_authenticity_token
,
if:
->
{
action_name
==
'show'
&&
js_request?
}
if:
->
{
action_name
==
'show'
&&
js_request?
}
track_redis_hll_event
:show
,
name:
'i_snippets_show'
,
feature: :usage_data_i_snippets_show
,
feature_default_enabled:
false
respond_to
:html
respond_to
:html
end
end
...
...
config/feature_flags/development/usage_data_i_snippets_show.yml
0 → 100644
View file @
f67ec92e
---
name
:
usage_data_i_snippets_show
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48113
rollout_issue_url
:
milestone
:
'
13.7'
type
:
development
group
:
group::editor
default_enabled
:
false
lib/gitlab/usage_data_counters/known_events/common.yml
View file @
f67ec92e
...
@@ -408,3 +408,8 @@
...
@@ -408,3 +408,8 @@
redis_slot
:
ci_secrets_management
redis_slot
:
ci_secrets_management
aggregation
:
weekly
aggregation
:
weekly
feature_flag
:
usage_data_i_ci_secrets_management_vault_build_created
feature_flag
:
usage_data_i_ci_secrets_management_vault_build_created
-
name
:
i_snippets_show
category
:
snippets
redis_slot
:
snippets
aggregation
:
weekly
feature_flag
:
usage_data_i_snippets_show
spec/controllers/snippets_controller_spec.rb
View file @
f67ec92e
...
@@ -172,6 +172,13 @@ RSpec.describe SnippetsController do
...
@@ -172,6 +172,13 @@ RSpec.describe SnippetsController do
expect
(
assigns
(
:snippet
)).
to
eq
(
public_snippet
)
expect
(
assigns
(
:snippet
)).
to
eq
(
public_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it_behaves_like
'tracking unique hll events'
,
:usage_data_i_snippets_show
do
subject
(
:request
)
{
get
:show
,
params:
{
id:
public_snippet
.
to_param
}
}
let
(
:target_id
)
{
'i_snippets_show'
}
let
(
:expected_type
)
{
instance_of
(
String
)
}
end
end
end
context
'when not signed in'
do
context
'when not signed in'
do
...
...
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
View file @
f67ec92e
...
@@ -44,7 +44,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
...
@@ -44,7 +44,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
'golang_packages'
,
'golang_packages'
,
'debian_packages'
,
'debian_packages'
,
'container_packages'
,
'container_packages'
,
'tag_packages'
'tag_packages'
,
'snippets'
)
)
end
end
end
end
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
f67ec92e
...
@@ -1235,7 +1235,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
...
@@ -1235,7 +1235,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject
{
described_class
.
redis_hll_counters
}
subject
{
described_class
.
redis_hll_counters
}
let
(
:categories
)
{
::
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
categories
}
let
(
:categories
)
{
::
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
categories
}
let
(
:ineligible_total_categories
)
{
%w[source_code testing ci_secrets_management incident_management_alerts]
}
let
(
:ineligible_total_categories
)
{
%w[source_code testing ci_secrets_management incident_management_alerts
snippets
]
}
it
'has all known_events'
do
it
'has all known_events'
do
expect
(
subject
).
to
have_key
(
:redis_hll_counters
)
expect
(
subject
).
to
have_key
(
:redis_hll_counters
)
...
...
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