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
1f3f6049
Commit
1f3f6049
authored
Mar 25, 2021
by
Rajendra Kadam
Committed by
Mayra Cabrera
Mar 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Usage ping non sql metrics
parent
d18efebe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
lib/gitlab/usage_data_non_sql_metrics.rb
lib/gitlab/usage_data_non_sql_metrics.rb
+29
-0
spec/lib/gitlab/usage_data_non_sql_metrics_spec.rb
spec/lib/gitlab/usage_data_non_sql_metrics_spec.rb
+37
-0
No files found.
lib/gitlab/usage_data_non_sql_metrics.rb
0 → 100644
View file @
1f3f6049
# frozen_string_literal: true
module
Gitlab
class
UsageDataNonSqlMetrics
<
UsageData
SQL_METRIC_DEFAULT
=
-
3
class
<<
self
def
count
(
relation
,
column
=
nil
,
batch:
true
,
batch_size:
nil
,
start:
nil
,
finish:
nil
)
SQL_METRIC_DEFAULT
end
def
distinct_count
(
relation
,
column
=
nil
,
batch:
true
,
batch_size:
nil
,
start:
nil
,
finish:
nil
)
SQL_METRIC_DEFAULT
end
def
estimate_batch_distinct_count
(
relation
,
column
=
nil
,
batch_size:
nil
,
start:
nil
,
finish:
nil
)
SQL_METRIC_DEFAULT
end
def
sum
(
relation
,
column
,
batch_size:
nil
,
start:
nil
,
finish:
nil
)
SQL_METRIC_DEFAULT
end
def
histogram
(
relation
,
column
,
buckets
:,
bucket_size:
buckets
.
size
)
SQL_METRIC_DEFAULT
end
end
end
end
spec/lib/gitlab/usage_data_non_sql_metrics_spec.rb
0 → 100644
View file @
1f3f6049
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
UsageDataNonSqlMetrics
do
let
(
:default_count
)
{
Gitlab
::
UsageDataNonSqlMetrics
::
SQL_METRIC_DEFAULT
}
describe
'.count'
do
it
'returns default value for count'
do
expect
(
described_class
.
count
(
User
)).
to
eq
(
default_count
)
end
end
describe
'.distinct_count'
do
it
'returns default value for distinct count'
do
expect
(
described_class
.
distinct_count
(
User
)).
to
eq
(
default_count
)
end
end
describe
'.estimate_batch_distinct_count'
do
it
'returns default value for estimate_batch_distinct_count'
do
expect
(
described_class
.
estimate_batch_distinct_count
(
User
)).
to
eq
(
default_count
)
end
end
describe
'.sum'
do
it
'returns default value for sum'
do
expect
(
described_class
.
sum
(
JiraImportState
.
finished
,
:imported_issues_count
)).
to
eq
(
default_count
)
end
end
describe
'.histogram'
do
it
'returns default value for histogram'
do
expect
(
described_class
.
histogram
(
JiraImportState
.
finished
,
:imported_issues_count
,
buckets:
[],
bucket_size:
0
)).
to
eq
(
default_count
)
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