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
43921022
Commit
43921022
authored
Sep 01, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ide actions to Usage Data
parent
146c43c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
27 deletions
+49
-27
changelogs/unreleased/232844-fj-add-ide-actions-usage-data.yml
...elogs/unreleased/232844-fj-add-ide-actions-usage-data.yml
+5
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+22
-26
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+22
-1
No files found.
changelogs/unreleased/232844-fj-add-ide-actions-usage-data.yml
0 → 100644
View file @
43921022
---
title
:
Add IDE edit actions to Usage Data
merge_request
:
40939
author
:
type
:
changed
lib/gitlab/usage_data.rb
View file @
43921022
...
...
@@ -650,41 +650,37 @@ module Gitlab
end
def
action_monthly_active_users
(
time_period
)
counter
=
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
date_range
=
{
date_from:
time_period
[
:created_at
].
first
,
date_to:
time_period
[
:created_at
].
last
}
project_count
=
redis_usage_data
do
counter
.
count_unique_events
(
event_action:
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
PUSH_ACTION
,
date_from:
time_period
[
:created_at
].
first
,
date_to:
time_period
[
:created_at
].
last
)
end
event_monthly_active_users
(
date_range
)
.
merge!
(
ide_monthly_active_users
(
date_range
))
end
design_count
=
redis_usage_data
do
counter
.
count_unique_events
(
event_action:
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
DESIGN_ACTION
,
date_from:
time_period
[
:created_at
].
first
,
date_to:
time_period
[
:created_at
].
last
)
end
private
wiki_count
=
redis_usage_data
do
counter
.
count_unique_events
(
event_action:
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
WIKI_ACTION
,
date_from:
time_period
[
:created_at
].
first
,
date_to:
time_period
[
:created_at
].
last
)
def
event_monthly_active_users
(
date_range
)
data
=
{
action_monthly_active_users_project_repo:
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
PUSH_ACTION
,
action_monthly_active_users_design_management:
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
DESIGN_ACTION
,
action_monthly_active_users_wiki_repo:
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
::
WIKI_ACTION
}
data
.
each
do
|
key
,
event
|
data
[
key
]
=
redis_usage_data
{
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
.
count_unique_events
(
event_action:
event
,
**
date_range
)
}
end
end
def
ide_monthly_active_users
(
date_range
)
counter
=
Gitlab
::
UsageDataCounters
::
EditorUniqueCounter
{
action_monthly_active_users_project_repo:
project_count
,
action_monthly_active_users_design_management:
design_count
,
action_monthly_active_users_wiki_repo:
wiki_count
action_monthly_active_users_web_ide_edit:
redis_usage_data
{
counter
.
count_web_ide_edit_actions
(
date_range
)
},
action_monthly_active_users_sfe_edit:
redis_usage_data
{
counter
.
count_sfe_edit_actions
(
date_range
)
},
action_monthly_active_users_snippet_editor_edit:
redis_usage_data
{
counter
.
count_snippet_editor_edit_actions
(
date_range
)
},
action_monthly_active_users_ide_edit:
redis_usage_data
{
counter
.
count_edit_using_editor
(
date_range
)
}
}
end
private
def
distinct_count_service_desk_enabled_projects
(
time_period
)
project_creator_id_start
=
user_minimum_id
project_creator_id_finish
=
user_maximum_id
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
43921022
...
...
@@ -999,6 +999,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
describe
'#action_monthly_active_users'
,
:clean_gitlab_redis_shared_state
do
let
(
:time_period
)
{
{
created_at:
2
.
days
.
ago
..
time
}
}
let
(
:time
)
{
Time
.
zone
.
now
}
let
(
:user1
)
{
build
(
:user
,
id:
1
)
}
let
(
:user2
)
{
build
(
:user
,
id:
2
)
}
let
(
:user3
)
{
build
(
:user
,
id:
3
)
}
before
do
counter
=
Gitlab
::
UsageDataCounters
::
TrackUniqueEvents
...
...
@@ -1014,6 +1017,20 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
counter
.
track_event
(
event_action: :created
,
event_target:
project
,
author_id:
5
,
time:
time
-
3
.
days
)
counter
.
track_event
(
event_action: :created
,
event_target:
wiki
,
author_id:
3
)
counter
.
track_event
(
event_action: :created
,
event_target:
design
,
author_id:
3
)
counter
=
Gitlab
::
UsageDataCounters
::
EditorUniqueCounter
counter
.
track_web_ide_edit_action
(
author:
user1
)
counter
.
track_web_ide_edit_action
(
author:
user1
)
counter
.
track_sfe_edit_action
(
author:
user1
)
counter
.
track_snippet_editor_edit_action
(
author:
user1
)
counter
.
track_snippet_editor_edit_action
(
author:
user1
,
time:
time
-
3
.
days
)
counter
.
track_web_ide_edit_action
(
author:
user2
)
counter
.
track_sfe_edit_action
(
author:
user2
)
counter
.
track_web_ide_edit_action
(
author:
user3
,
time:
time
-
3
.
days
)
counter
.
track_snippet_editor_edit_action
(
author:
user3
)
end
it
'returns the distinct count of user actions within the specified time period'
do
...
...
@@ -1021,7 +1038,11 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
{
action_monthly_active_users_design_management:
1
,
action_monthly_active_users_project_repo:
3
,
action_monthly_active_users_wiki_repo:
1
action_monthly_active_users_wiki_repo:
1
,
action_monthly_active_users_web_ide_edit:
2
,
action_monthly_active_users_sfe_edit:
2
,
action_monthly_active_users_snippet_editor_edit:
2
,
action_monthly_active_users_ide_edit:
3
}
)
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