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
d0e97256
Commit
d0e97256
authored
Mar 05, 2021
by
Mikolaj Wawrzyniak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add alt_usage_data metrics into names generator
parent
f49a8dbf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
lib/gitlab/usage/metrics/names_suggestions/generator.rb
lib/gitlab/usage/metrics/names_suggestions/generator.rb
+8
-2
spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb
.../gitlab/usage/metrics/names_suggestions/generator_spec.rb
+7
-1
No files found.
lib/gitlab/usage/metrics/names_suggestions/generator.rb
View file @
d0e97256
...
@@ -5,6 +5,8 @@ module Gitlab
...
@@ -5,6 +5,8 @@ module Gitlab
module
Metrics
module
Metrics
module
NamesSuggestions
module
NamesSuggestions
class
Generator
<
::
Gitlab
::
UsageData
class
Generator
<
::
Gitlab
::
UsageData
FREE_TEXT_METRIC_NAME
=
"<please fill metric name>"
class
<<
self
class
<<
self
def
generate
(
key_path
)
def
generate
(
key_path
)
uncached_data
.
deep_stringify_keys
.
dig
(
*
key_path
.
split
(
'.'
))
uncached_data
.
deep_stringify_keys
.
dig
(
*
key_path
.
split
(
'.'
))
...
@@ -21,11 +23,15 @@ module Gitlab
...
@@ -21,11 +23,15 @@ module Gitlab
end
end
def
redis_usage_counter
def
redis_usage_counter
"names_suggestions_for_redis_counters_are_not_supported_yet"
FREE_TEXT_METRIC_NAME
end
def
alt_usage_data
(
*
)
FREE_TEXT_METRIC_NAME
end
end
def
redis_usage_data_totals
(
counter
)
def
redis_usage_data_totals
(
counter
)
counter
.
fallback_totals
.
transform_values
{
|
_
|
"names_suggestions_for_redis_counters_are_not_supported_yet"
}
counter
.
fallback_totals
.
transform_values
{
|
_
|
FREE_TEXT_METRIC_NAME
}
end
end
def
sum
(
relation
,
column
,
*
rest
)
def
sum
(
relation
,
column
,
*
rest
)
...
...
spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb
View file @
d0e97256
...
@@ -36,7 +36,13 @@ RSpec.describe Gitlab::Usage::Metrics::NamesSuggestions::Generator do
...
@@ -36,7 +36,13 @@ RSpec.describe Gitlab::Usage::Metrics::NamesSuggestions::Generator do
context
'for redis metrics'
do
context
'for redis metrics'
do
it
'return correct name'
do
it
'return correct name'
do
expect
(
described_class
.
generate
(
'analytics_unique_visits.analytics_unique_visits_for_any_target'
)).
to
eq
'names_suggestions_for_redis_counters_are_not_supported_yet'
expect
(
described_class
.
generate
(
'analytics_unique_visits.analytics_unique_visits_for_any_target'
)).
to
eq
'<please fill metric name>'
end
end
context
'for alt_usage_data metrics'
do
it
'return correct name'
do
expect
(
described_class
.
generate
(
'settings.operating_system'
)).
to
eq
'<please fill metric name>'
end
end
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