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
aff5fbaf
Commit
aff5fbaf
authored
Apr 01, 2022
by
Niko Belokolodov
Committed by
Mayra Cabrera
Apr 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move active_users_project_repo metric to Snowplow
parent
134eecdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
app/services/event_create_service.rb
app/services/event_create_service.rb
+4
-0
spec/services/event_create_service_spec.rb
spec/services/event_create_service_spec.rb
+29
-2
No files found.
app/services/event_create_service.rb
View file @
aff5fbaf
...
...
@@ -184,6 +184,10 @@ class EventCreateService
track_event
(
event_action: :pushed
,
event_target:
Project
,
author_id:
current_user
.
id
)
if
Feature
.
enabled?
(
:route_hll_to_snowplow
,
project
,
default_enabled: :yaml
)
Gitlab
::
Tracking
.
event
(
self
.
class
.
to_s
,
'action_active_users_project_repo'
,
namespace:
project
,
user:
current_user
)
end
Users
::
LastPushEventService
.
new
(
current_user
)
.
cache_last_push_event
(
event
)
...
...
spec/services/event_create_service_spec.rb
View file @
aff5fbaf
...
...
@@ -3,6 +3,8 @@
require
'spec_helper'
RSpec
.
describe
EventCreateService
,
:clean_gitlab_redis_cache
,
:clean_gitlab_redis_shared_state
do
include
SnowplowHelpers
let
(
:service
)
{
described_class
.
new
}
let_it_be
(
:user
,
reload:
true
)
{
create
:user
}
...
...
@@ -18,6 +20,27 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi
end
end
shared_examples
'Snowplow event'
do
it
'is not emitted if FF is disabled'
do
stub_feature_flags
(
route_hll_to_snowplow:
false
)
subject
expect_no_snowplow_event
end
it
'is emitted'
do
subject
expect_snowplow_event
(
category:
described_class
.
to_s
,
action:
'action_active_users_project_repo'
,
namespace:
project
,
user:
user
)
end
end
describe
'Issues'
do
describe
'#open_issue'
do
let
(
:issue
)
{
create
(
:issue
)
}
...
...
@@ -247,7 +270,7 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi
end
end
describe
'#push'
do
describe
'#push'
,
:snowplow
do
let
(
:push_data
)
do
{
commits:
[
...
...
@@ -270,9 +293,11 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi
it_behaves_like
"it records the event in the event counter"
do
let
(
:event_action
)
{
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
PUSH_ACTION
}
end
it_behaves_like
'Snowplow event'
end
describe
'#bulk_push'
do
describe
'#bulk_push'
,
:snowplow
do
let
(
:push_data
)
do
{
action: :created
,
...
...
@@ -288,6 +313,8 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi
it_behaves_like
"it records the event in the event counter"
do
let
(
:event_action
)
{
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
PUSH_ACTION
}
end
it_behaves_like
'Snowplow event'
end
describe
'Project'
do
...
...
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