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
10ab24bd
Commit
10ab24bd
authored
Apr 22, 2021
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add issues metric instrumentation
- Add CountIssuesMetric - Add CountUsersCreatingIssuesMetric
parent
cfdd2aca
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
80 additions
and
6 deletions
+80
-6
config/metrics/counts_28d/20210216181139_issues.yml
config/metrics/counts_28d/20210216181139_issues.yml
+6
-5
config/metrics/counts_all/20210216181102_issues.yml
config/metrics/counts_all/20210216181102_issues.yml
+1
-0
config/metrics/counts_all/20210216181115_issues.yml
config/metrics/counts_all/20210216181115_issues.yml
+1
-0
doc/development/usage_ping/dictionary.md
doc/development/usage_ping/dictionary.md
+1
-1
lib/gitlab/usage/metrics/instrumentations/count_issues_metric.rb
...lab/usage/metrics/instrumentations/count_issues_metric.rb
+18
-0
lib/gitlab/usage/metrics/instrumentations/count_users_creating_issues_metric.rb
...cs/instrumentations/count_users_creating_issues_metric.rb
+15
-0
spec/lib/gitlab/usage/metrics/instrumentations/count_issues_metric_spec.rb
...sage/metrics/instrumentations/count_issues_metric_spec.rb
+9
-0
spec/lib/gitlab/usage/metrics/instrumentations/count_users_creating_issues_metric_spec.rb
...strumentations/count_users_creating_issues_metric_spec.rb
+17
-0
spec/lib/gitlab/usage_data_metrics_spec.rb
spec/lib/gitlab/usage_data_metrics_spec.rb
+12
-0
No files found.
config/metrics/counts_28d/20210216181139_issues.yml
View file @
10ab24bd
---
key_path
:
usage_activity_by_stage_monthly.plan.issues
description
:
Count of
MAU creating issues
description
:
Count of
users creating Issues in last 28 days.
product_section
:
dev
product_stage
:
plan
product_group
:
group::project management
...
...
@@ -9,6 +9,7 @@ value_type: number
status
:
data_available
time_frame
:
28d
data_source
:
database
instrumentation_class
:
'
Gitlab::Usage::Metrics::Instrumentations::CountUsersCreatingIssuesMetric'
distribution
:
-
ce
-
ee
...
...
config/metrics/counts_all/20210216181102_issues.yml
View file @
10ab24bd
...
...
@@ -9,6 +9,7 @@ value_type: number
status
:
data_available
time_frame
:
all
data_source
:
database
instrumentation_class
:
'
Gitlab::Usage::Metrics::Instrumentations::CountIssuesMetric'
distribution
:
-
ce
-
ee
...
...
config/metrics/counts_all/20210216181115_issues.yml
View file @
10ab24bd
...
...
@@ -9,6 +9,7 @@ value_type: number
status
:
data_available
time_frame
:
all
data_source
:
database
instrumentation_class
:
'
Gitlab::Usage::Metrics::Instrumentations::CountUsersCreatingIssuesMetric'
distribution
:
-
ce
-
ee
...
...
doc/development/usage_ping/dictionary.md
View file @
10ab24bd
...
...
@@ -18256,7 +18256,7 @@ Tiers: `free`
### `usage_activity_by_stage_monthly.plan.issues`
Count of
MAU creating issues
Count of
users creating Issues in last 28 days.
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216181139_issues.yml)
...
...
lib/gitlab/usage/metrics/instrumentations/count_issues_metric.rb
0 → 100644
View file @
10ab24bd
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
CountIssuesMetric
<
DatabaseMetric
operation
:count
start
{
Issue
.
minimum
(
:id
)
}
finish
{
Issue
.
maximum
(
:id
)
}
relation
{
Issue
}
end
end
end
end
end
lib/gitlab/usage/metrics/instrumentations/count_users_creating_issues_metric.rb
0 → 100644
View file @
10ab24bd
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
CountUsersCreatingIssuesMetric
<
DatabaseMetric
operation
:distinct_count
,
column: :author_id
relation
{
Issue
}
end
end
end
end
end
spec/lib/gitlab/usage/metrics/instrumentations/count_issues_metric_spec.rb
0 → 100644
View file @
10ab24bd
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
CountIssuesMetric
do
let_it_be
(
:issue
)
{
create
(
:issue
)
}
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'all'
,
data_source:
'database'
},
1
end
spec/lib/gitlab/usage/metrics/instrumentations/count_users_creating_issues_metric_spec.rb
0 → 100644
View file @
10ab24bd
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
CountUsersCreatingIssuesMetric
do
let_it_be
(
:author
)
{
create
(
:user
)
}
let_it_be
(
:issues
)
{
create_list
(
:issue
,
2
,
author:
author
,
created_at:
4
.
days
.
ago
)
}
let_it_be
(
:old_issue
)
{
create
(
:issue
,
author:
author
,
created_at:
2
.
months
.
ago
)
}
context
'with all time frame'
do
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'all'
,
data_source:
'database'
},
1
end
context
'for 28d time frame'
do
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'28d'
,
data_source:
'database'
},
1
end
end
spec/lib/gitlab/usage_data_metrics_spec.rb
View file @
10ab24bd
...
...
@@ -20,6 +20,18 @@ RSpec.describe Gitlab::UsageDataMetrics do
it
'includes top level keys'
do
expect
(
subject
).
to
include
(
:uuid
)
end
it
'includes counts keys'
do
expect
(
subject
[
:counts
]).
to
include
(
:issues
)
end
it
'includes usage_activity_by_stage keys'
do
expect
(
subject
[
:usage_activity_by_stage
][
:plan
]).
to
include
(
:issues
)
end
it
'includes usage_activity_by_stage_monthly keys'
do
expect
(
subject
[
:usage_activity_by_stage_monthly
][
:plan
]).
to
include
(
:issues
)
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