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
201c1167
Commit
201c1167
authored
Apr 20, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jira imports to usage data
- imported issues, projects with jira imports, jira imports count
parent
f32805a7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
1 deletion
+29
-1
app/models/jira_import_state.rb
app/models/jira_import_state.rb
+5
-0
changelogs/unreleased/208920-jira-import-usage-data.yml
changelogs/unreleased/208920-jira-import-usage-data.yml
+5
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+11
-1
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+5
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+3
-0
No files found.
app/models/jira_import_state.rb
View file @
201c1167
...
...
@@ -3,6 +3,7 @@
class
JiraImportState
<
ApplicationRecord
include
AfterCommitQueue
include
ImportState
::
SidekiqJobTracker
include
UsageStatistics
self
.
table_name
=
'jira_imports'
...
...
@@ -97,4 +98,8 @@ class JiraImportState < ApplicationRecord
}
)
end
def
self
.
finished_imports_count
finished
.
sum
(
:imported_issues_count
)
end
end
changelogs/unreleased/208920-jira-import-usage-data.yml
0 → 100644
View file @
201c1167
---
title
:
Add jira imports to usage data
merge_request
:
29925
author
:
type
:
added
lib/gitlab/usage_data.rb
View file @
201c1167
...
...
@@ -251,7 +251,7 @@ module Gitlab
results
[
:projects_slack_notifications_active
]
=
results
[
:projects_slack_active
]
results
[
:projects_slack_slash_active
]
=
results
[
:projects_slack_slash_commands_active
]
results
.
merge
(
jira_usage
)
results
.
merge
(
jira_usage
)
.
merge
(
jira_import_usage
)
end
def
jira_usage
...
...
@@ -285,6 +285,16 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
def
jira_import_usage
finished_jira_imports
=
JiraImportState
.
finished
{
jira_imports_total_imported_count:
count
(
finished_jira_imports
),
jira_imports_projects_count:
distinct_count
(
finished_jira_imports
,
:project_id
),
jira_imports_total_imported_issues_count:
alt_usage_data
{
JiraImportState
.
finished_imports_count
}
}
end
def
user_preferences_usage
{}
# augmented in EE
end
...
...
spec/factories/usage_data.rb
View file @
201c1167
...
...
@@ -12,6 +12,11 @@ FactoryBot.define do
create
(
:jira_service
,
:jira_cloud_service
,
project:
projects
[
2
])
create
(
:jira_service
,
:without_properties_callback
,
project:
projects
[
3
],
properties:
{
url:
'https://mysite.atlassian.net'
})
jira_label
=
create
(
:label
,
project:
projects
[
0
])
create
(
:jira_import_state
,
:finished
,
project:
projects
[
0
],
label:
jira_label
,
failed_to_import_count:
2
,
imported_issues_count:
7
,
total_issue_count:
9
)
create
(
:jira_import_state
,
:finished
,
project:
projects
[
1
],
label:
jira_label
,
imported_issues_count:
3
,
total_issue_count:
3
)
create
(
:jira_import_state
,
:finished
,
project:
projects
[
1
],
label:
jira_label
,
imported_issues_count:
3
)
create
(
:jira_import_state
,
:scheduled
,
project:
projects
[
1
],
label:
jira_label
)
create
(
:prometheus_service
,
project:
projects
[
1
])
create
(
:service
,
project:
projects
[
0
],
type:
'SlackSlashCommandsService'
,
active:
true
)
create
(
:service
,
project:
projects
[
1
],
type:
'SlackService'
,
active:
true
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
201c1167
...
...
@@ -42,6 +42,9 @@ describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:projects_jira_active
]).
to
eq
(
4
)
expect
(
count_data
[
:projects_jira_server_active
]).
to
eq
(
2
)
expect
(
count_data
[
:projects_jira_cloud_active
]).
to
eq
(
2
)
expect
(
count_data
[
:jira_imports_projects_count
]).
to
eq
(
2
)
expect
(
count_data
[
:jira_imports_total_imported_count
]).
to
eq
(
3
)
expect
(
count_data
[
:jira_imports_total_imported_issues_count
]).
to
eq
(
13
)
expect
(
count_data
[
:projects_slack_notifications_active
]).
to
eq
(
2
)
expect
(
count_data
[
:projects_slack_slash_active
]).
to
eq
(
1
)
expect
(
count_data
[
:projects_slack_active
]).
to
eq
(
2
)
...
...
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