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
3874901c
Commit
3874901c
authored
Apr 13, 2021
by
Mikolaj Wawrzyniak
Committed by
Alper Akgun
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rollout feature flag
Rollout product_intelligence_metrics_names_suggestions feautre flag
parent
4936d09d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
54 deletions
+15
-54
changelogs/unreleased/mwaw-323460-feature-flag-product_intelligence_metrics_names_suggestions-d.yml
...flag-product_intelligence_metrics_names_suggestions-d.yml
+5
-0
config/feature_flags/development/product_intelligence_metrics_names_suggestions.yml
...opment/product_intelligence_metrics_names_suggestions.yml
+0
-8
lib/generators/gitlab/usage_metric_definition_generator.rb
lib/generators/gitlab/usage_metric_definition_generator.rb
+0
-2
spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb
...nerators/gitlab/usage_metric_definition_generator_spec.rb
+10
-44
No files found.
changelogs/unreleased/mwaw-323460-feature-flag-product_intelligence_metrics_names_suggestions-d.yml
0 → 100644
View file @
3874901c
---
title
:
Rollout product_intelligence_metrics_names_suggestions feature flag
merge_request
:
58995
author
:
type
:
added
config/feature_flags/development/product_intelligence_metrics_names_suggestions.yml
deleted
100644 → 0
View file @
4936d09d
---
name
:
product_intelligence_metrics_names_suggestions
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55733
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/323460
milestone
:
'
13.10'
type
:
development
group
:
group::product intelligence
default_enabled
:
false
lib/generators/gitlab/usage_metric_definition_generator.rb
View file @
3874901c
...
...
@@ -65,8 +65,6 @@ module Gitlab
private
def
metric_name_suggestion
return
unless
Feature
.
enabled?
(
:product_intelligence_metrics_names_suggestions
,
default_enabled: :yaml
)
"
\n
name:
\"
#{
Usage
::
Metrics
::
NamesSuggestions
::
Generator
.
generate
(
key_path
)
}
\"
"
end
...
...
spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb
View file @
3874901c
...
...
@@ -32,38 +32,20 @@ RSpec.describe Gitlab::UsageMetricDefinitionGenerator do
end
describe
'Creating metric definition file'
do
let
(
:sample_metric
)
{
load_sample_metric_definition
}
# Stub version so that `milestone` key remains constant between releases to prevent flakiness.
before
do
stub_const
(
'Gitlab::VERSION'
,
'13.9.0'
)
allow
(
::
Gitlab
::
Usage
::
Metrics
::
NamesSuggestions
::
Generator
).
to
receive
(
:generate
).
and_return
(
'test metric name'
)
end
context
'with product_intelligence_metrics_names_suggestions feature ON'
do
let
(
:sample_metric
)
{
load_sample_metric_definition
(
filename:
'sample_metric_with_name_suggestions.yml'
)
}
it
'creates a metric definition file using the template'
do
stub_feature_flags
(
product_intelligence_metrics_names_suggestions:
true
)
described_class
.
new
([
key_path
],
{
'dir'
=>
dir
}).
invoke_all
metric_definition_path
=
Dir
.
glob
(
File
.
join
(
temp_dir
,
'metrics/counts_7d/*_test_metric.yml'
)).
first
expect
(
YAML
.
safe_load
(
File
.
read
(
metric_definition_path
))).
to
eq
(
sample_metric
)
end
end
context
'with product_intelligence_metrics_names_suggestions feature OFF'
do
it
'creates a metric definition file using the template'
do
stub_feature_flags
(
product_intelligence_metrics_names_suggestions:
false
)
let
(
:sample_metric
)
{
load_sample_metric_definition
(
filename:
'sample_metric_with_name_suggestions.yml'
)
}
described_class
.
new
([
key_path
],
{
'dir'
=>
dir
}).
invoke_all
it
'creates a metric definition file using the template'
do
described_class
.
new
([
key_path
],
{
'dir'
=>
dir
}).
invoke_all
metric_definition_path
=
Dir
.
glob
(
File
.
join
(
temp_dir
,
'metrics/counts_7d/*_test_metric.yml'
)).
first
metric_definition_path
=
Dir
.
glob
(
File
.
join
(
temp_dir
,
'metrics/counts_7d/*_test_metric.yml'
)).
first
expect
(
YAML
.
safe_load
(
File
.
read
(
metric_definition_path
))).
to
eq
(
sample_metric
)
end
expect
(
YAML
.
safe_load
(
File
.
read
(
metric_definition_path
))).
to
eq
(
sample_metric
)
end
end
...
...
@@ -104,28 +86,12 @@ RSpec.describe Gitlab::UsageMetricDefinitionGenerator do
end
describe
'Name suggestions'
do
context
'with product_intelligence_metrics_names_suggestions feature ON'
do
it
'adds name key to metric definition'
do
stub_feature_flags
(
product_intelligence_metrics_names_suggestions:
true
)
expect
(
::
Gitlab
::
Usage
::
Metrics
::
NamesSuggestions
::
Generator
).
to
receive
(
:generate
).
and_return
(
'some name'
)
described_class
.
new
([
key_path
],
{
'dir'
=>
dir
}).
invoke_all
metric_definition_path
=
Dir
.
glob
(
File
.
join
(
temp_dir
,
'metrics/counts_7d/*_test_metric.yml'
)).
first
expect
(
YAML
.
safe_load
(
File
.
read
(
metric_definition_path
))).
to
include
(
"name"
=>
"some name"
)
end
end
context
'with product_intelligence_metrics_names_suggestions feature OFF'
do
it
'adds name key to metric definition'
do
stub_feature_flags
(
product_intelligence_metrics_names_suggestions:
false
)
it
'adds name key to metric definition'
do
expect
(
::
Gitlab
::
Usage
::
Metrics
::
NamesSuggestions
::
Generator
).
to
receive
(
:generate
).
and_return
(
'some name'
)
described_class
.
new
([
key_path
],
{
'dir'
=>
dir
}).
invoke_all
metric_definition_path
=
Dir
.
glob
(
File
.
join
(
temp_dir
,
'metrics/counts_7d/*_test_metric.yml'
)).
first
expect
(
::
Gitlab
::
Usage
::
Metrics
::
NamesSuggestions
::
Generator
).
not_to
receive
(
:generate
)
described_class
.
new
([
key_path
],
{
'dir'
=>
dir
}).
invoke_all
metric_definition_path
=
Dir
.
glob
(
File
.
join
(
temp_dir
,
'metrics/counts_7d/*_test_metric.yml'
)).
first
expect
(
YAML
.
safe_load
(
File
.
read
(
metric_definition_path
)).
keys
).
not_to
include
(
:name
)
end
expect
(
YAML
.
safe_load
(
File
.
read
(
metric_definition_path
))).
to
include
(
"name"
=>
"some name"
)
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