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
338226ec
Commit
338226ec
authored
Oct 13, 2021
by
Niko Belokolodov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate add_user_count metric to use instrumentation class
parent
f21f76b8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletion
+30
-1
config/metrics/license/20210204124829_active_user_count.yml
config/metrics/license/20210204124829_active_user_count.yml
+1
-0
lib/gitlab/usage/metrics/instrumentations/active_user_count_metric.rb
...sage/metrics/instrumentations/active_user_count_metric.rb
+15
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+1
-1
spec/lib/gitlab/usage/metrics/instrumentations/active_user_count_metric_spec.rb
...metrics/instrumentations/active_user_count_metric_spec.rb
+13
-0
No files found.
config/metrics/license/20210204124829_active_user_count.yml
View file @
338226ec
...
...
@@ -10,6 +10,7 @@ status: active
milestone
:
"
<13.9"
data_category
:
subscription
time_frame
:
none
instrumentation_class
:
ActiveUserCountMetric
data_source
:
database
distribution
:
-
ce
...
...
lib/gitlab/usage/metrics/instrumentations/active_user_count_metric.rb
0 → 100644
View file @
338226ec
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
ActiveUserCountMetric
<
DatabaseMetric
operation
:count
relation
{
User
.
active
}
end
end
end
end
end
lib/gitlab/usage_data.rb
View file @
338226ec
...
...
@@ -76,7 +76,7 @@ module Gitlab
hostname:
add_metric
(
'HostnameMetric'
),
version:
alt_usage_data
{
Gitlab
::
VERSION
},
installation_type:
alt_usage_data
{
installation_type
},
active_user_count:
count
(
User
.
active
),
active_user_count:
add_metric
(
'ActiveUserCountMetric'
),
edition:
'CE'
}
end
...
...
spec/lib/gitlab/usage/metrics/instrumentations/active_user_count_metric_spec.rb
0 → 100644
View file @
338226ec
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
ActiveUserCountMetric
do
before
do
create
(
:user
)
end
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'none'
,
data_source:
'ruby'
}
do
let
(
:expected_value
)
{
::
User
.
active
.
count
}
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