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
764e56d7
Commit
764e56d7
authored
Oct 27, 2021
by
Niko Belokolodov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete License classes
parent
229b520f
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
36 additions
and
83 deletions
+36
-83
ee/config/metrics/license/20210204124831_license_md5.yml
ee/config/metrics/license/20210204124831_license_md5.yml
+1
-2
ee/config/metrics/license/20210204124833_license_id.yml
ee/config/metrics/license/20210204124833_license_id.yml
+1
-2
ee/config/metrics/license/20210204124843_license_user_count.yml
...fig/metrics/license/20210204124843_license_user_count.yml
+1
-2
ee/config/metrics/license/20210204124845_license_starts_at.yml
...nfig/metrics/license/20210204124845_license_starts_at.yml
+1
-2
ee/config/metrics/license/20210204124847_license_expires_at.yml
...fig/metrics/license/20210204124847_license_expires_at.yml
+1
-2
ee/config/metrics/license/20210204124849_license_plan.yml
ee/config/metrics/license/20210204124849_license_plan.yml
+1
-2
ee/config/metrics/license/20210204124851_license_trial.yml
ee/config/metrics/license/20210204124851_license_trial.yml
+1
-2
ee/config/metrics/license/20210204124852_license_subscription_id.yml
...etrics/license/20210204124852_license_subscription_id.yml
+1
-2
ee/config/metrics/license/20210204124926_license_trial_ends_on.yml
.../metrics/license/20210204124926_license_trial_ends_on.yml
+1
-2
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+3
-3
ee/lib/gitlab/usage/metrics/instrumentations/license_md_five_metric.rb
.../usage/metrics/instrumentations/license_md_five_metric.rb
+0
-15
ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb
...b/gitlab/usage/metrics/instrumentations/license_metric.rb
+13
-8
ee/lib/gitlab/usage/metrics/instrumentations/zuora_subscription_id_metric.rb
.../metrics/instrumentations/zuora_subscription_id_metric.rb
+0
-15
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+4
-0
ee/spec/lib/gitlab/usage/metrics/instrumentations/license_md_five_metric_spec.rb
...e/metrics/instrumentations/license_md_five_metric_spec.rb
+0
-9
ee/spec/lib/gitlab/usage/metrics/instrumentations/zuora_subscription_id_metric_spec.rb
...ics/instrumentations/zuora_subscription_id_metric_spec.rb
+0
-9
lib/gitlab/usage/metrics/names_suggestions/generator.rb
lib/gitlab/usage/metrics/names_suggestions/generator.rb
+2
-2
lib/gitlab/usage_data_non_sql_metrics.rb
lib/gitlab/usage_data_non_sql_metrics.rb
+2
-2
lib/gitlab/usage_data_queries.rb
lib/gitlab/usage_data_queries.rb
+2
-2
lib/gitlab/utils/usage_data.rb
lib/gitlab/utils/usage_data.rb
+1
-0
No files found.
ee/config/metrics/license/20210204124831_license_md5.yml
View file @
764e56d7
...
@@ -11,8 +11,7 @@ time_frame: none
...
@@ -11,8 +11,7 @@ time_frame: none
data_source
:
license
data_source
:
license
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
md5
-
md5
data_category
:
standard
data_category
:
standard
distribution
:
distribution
:
-
ee
-
ee
...
...
ee/config/metrics/license/20210204124833_license_id.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ data_source: license
...
@@ -12,8 +12,7 @@ data_source: license
data_category
:
subscription
data_category
:
subscription
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
id
-
id
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/config/metrics/license/20210204124843_license_user_count.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ data_source: license
...
@@ -12,8 +12,7 @@ data_source: license
data_category
:
subscription
data_category
:
subscription
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
user_count
user_count
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/config/metrics/license/20210204124845_license_starts_at.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ data_source: license
...
@@ -12,8 +12,7 @@ data_source: license
data_category
:
subscription
data_category
:
subscription
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
starts_at
-
starts_at
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/config/metrics/license/20210204124847_license_expires_at.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ time_frame: none
...
@@ -12,8 +12,7 @@ time_frame: none
data_source
:
license
data_source
:
license
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
expires_at
-
expires_at
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/config/metrics/license/20210204124849_license_plan.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ data_source: license
...
@@ -12,8 +12,7 @@ data_source: license
data_category
:
subscription
data_category
:
subscription
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
plan
-
plan
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/config/metrics/license/20210204124851_license_trial.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ data_source: license
...
@@ -12,8 +12,7 @@ data_source: license
data_category
:
subscription
data_category
:
subscription
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
trial
-
trial
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/config/metrics/license/20210204124852_license_subscription_id.yml
View file @
764e56d7
...
@@ -11,8 +11,7 @@ time_frame: none
...
@@ -11,8 +11,7 @@ time_frame: none
data_source
:
license
data_source
:
license
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
subscription_id
-
subsription_id
data_category
:
standard
data_category
:
standard
distribution
:
distribution
:
-
ee
-
ee
...
...
ee/config/metrics/license/20210204124926_license_trial_ends_on.yml
View file @
764e56d7
...
@@ -12,8 +12,7 @@ data_source: database
...
@@ -12,8 +12,7 @@ data_source: database
data_category
:
subscription
data_category
:
subscription
instrumentation_class
:
LicenseMetric
instrumentation_class
:
LicenseMetric
options
:
options
:
attribute
:
attribute
:
trial_ends_on
-
trial_ends_on
distribution
:
distribution
:
-
ee
-
ee
tier
:
tier
:
...
...
ee/lib/ee/gitlab/usage_data.rb
View file @
764e56d7
...
@@ -72,7 +72,7 @@ module EE
...
@@ -72,7 +72,7 @@ module EE
def
features_usage_data_ee
def
features_usage_data_ee
{
{
elasticsearch_enabled:
alt_usage_data
(
fallback:
nil
)
{
::
Gitlab
::
CurrentSettings
.
elasticsearch_search?
},
elasticsearch_enabled:
alt_usage_data
(
fallback:
nil
)
{
::
Gitlab
::
CurrentSettings
.
elasticsearch_search?
},
license_trial_ends_on:
a
lt_usage_data
(
fallback:
nil
)
{
add_metric
(
"LicenseMetric"
,
options:
{
attribute: :trial_ends_on
})
}
,
license_trial_ends_on:
a
dd_metric
(
"LicenseMetric"
,
options:
{
attribute:
"trial_ends_on"
})
,
geo_enabled:
alt_usage_data
(
fallback:
nil
)
{
::
Gitlab
::
Geo
.
enabled?
},
geo_enabled:
alt_usage_data
(
fallback:
nil
)
{
::
Gitlab
::
Geo
.
enabled?
},
user_cap_feature_enabled:
add_metric
(
'UserCapSettingEnabledMetric'
,
time_frame:
'none'
)
user_cap_feature_enabled:
add_metric
(
'UserCapSettingEnabledMetric'
,
time_frame:
'none'
)
}
}
...
@@ -90,7 +90,7 @@ module EE
...
@@ -90,7 +90,7 @@ module EE
end
end
if
license
if
license
usage_data
[
:license_md5
]
=
add_metric
(
"LicenseM
dFiveMetric"
)
usage_data
[
:license_md5
]
=
add_metric
(
"LicenseM
etric"
,
options:
{
attribute:
'md5'
}
)
usage_data
[
:license_id
]
=
license
.
license_id
usage_data
[
:license_id
]
=
license
.
license_id
# rubocop: disable UsageData/LargeTable
# rubocop: disable UsageData/LargeTable
usage_data
[
:historical_max_users
]
=
add_metric
(
"HistoricalMaxUsersMetric"
)
usage_data
[
:historical_max_users
]
=
add_metric
(
"HistoricalMaxUsersMetric"
)
...
@@ -103,7 +103,7 @@ module EE
...
@@ -103,7 +103,7 @@ module EE
usage_data
[
:license_plan
]
=
license
.
plan
usage_data
[
:license_plan
]
=
license
.
plan
usage_data
[
:license_add_ons
]
=
license
.
add_ons
usage_data
[
:license_add_ons
]
=
license
.
add_ons
usage_data
[
:license_trial
]
=
license
.
trial?
usage_data
[
:license_trial
]
=
license
.
trial?
usage_data
[
:license_subscription_id
]
=
alt_usage_data
(
fallback:
nil
)
{
license
.
subscription_id
}
usage_data
[
:license_subscription_id
]
=
license
.
subscription_id
end
end
usage_data
usage_data
...
...
ee/lib/gitlab/usage/metrics/instrumentations/license_md_five_metric.rb
deleted
100644 → 0
View file @
229b520f
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
LicenseMdFiveMetric
<
::
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
GenericMetric
value
do
::
License
.
current
.
md5
end
end
end
end
end
end
ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb
View file @
764e56d7
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
# attribute: md5
# attribute: md5
# end
# end
ALLOWED_ATTRIBUTES
=
%
i
(md5
ALLOWED_ATTRIBUTES
=
%
w
(md5
id
id
plan
plan
trial
trial
...
@@ -27,18 +27,23 @@ module Gitlab
...
@@ -27,18 +27,23 @@ module Gitlab
super
super
raise
ArgumentError
,
"License options attribute are required"
unless
license_attribute
.
present?
raise
ArgumentError
,
"License options attribute are required"
unless
license_attribute
.
present?
raise
ArgumentError
,
"attribute should one allowed"
unless
license_attribute
.
in?
(
ALLOWED_ATTRIBUTES
)
raise
ArgumentError
,
"Attribute:
#{
license_attribute
}
it not allowed"
unless
license_attribute
.
in?
(
ALLOWED_ATTRIBUTES
)
end
def
license_attribute
options
[
:attribute
]
end
end
def
value
def
value
alt_usage_data
(
fallback:
-
1
)
do
return
::
License
.
trial_ends_on
if
license_attribute
==
"trial_ends_on"
::
Licese
.
current
.
send
(
license_attribute
)
alt_usage_data
(
fallback:
nil
)
do
# license_attribute is checked in the constructor, so it's safe
::
License
.
current
.
send
(
license_attribute
)
# rubocop: disable GitlabSecurity/PublicSend
end
end
end
end
private
def
license_attribute
options
[
:attribute
]
end
end
end
end
end
end
end
...
...
ee/lib/gitlab/usage/metrics/instrumentations/zuora_subscription_id_metric.rb
deleted
100644 → 0
View file @
229b520f
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
ZuoraSubscriptionIdMetric
<
::
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
GenericMetric
value
do
::
License
.
current
.
subscription_id
end
end
end
end
end
end
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
764e56d7
...
@@ -187,6 +187,10 @@ RSpec.describe Gitlab::UsageData do
...
@@ -187,6 +187,10 @@ RSpec.describe Gitlab::UsageData do
describe
'.features_usage_data_ee'
do
describe
'.features_usage_data_ee'
do
subject
{
described_class
.
features_usage_data_ee
}
subject
{
described_class
.
features_usage_data_ee
}
before
do
stub_feature_flags
(
usage_data_instrumentation:
false
)
end
it
'gathers feature usage data of EE'
do
it
'gathers feature usage data of EE'
do
expect
(
subject
[
:elasticsearch_enabled
]).
to
eq
(
Gitlab
::
CurrentSettings
.
elasticsearch_search?
)
expect
(
subject
[
:elasticsearch_enabled
]).
to
eq
(
Gitlab
::
CurrentSettings
.
elasticsearch_search?
)
expect
(
subject
[
:geo_enabled
]).
to
eq
(
Gitlab
::
Geo
.
enabled?
)
expect
(
subject
[
:geo_enabled
]).
to
eq
(
Gitlab
::
Geo
.
enabled?
)
...
...
ee/spec/lib/gitlab/usage/metrics/instrumentations/license_md_five_metric_spec.rb
deleted
100644 → 0
View file @
229b520f
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
LicenseMdFiveMetric
do
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'none'
,
data_source:
'ruby'
}
do
let
(
:expected_value
)
{
Digest
::
MD5
.
hexdigest
(
::
License
.
current
.
data
)
}
end
end
ee/spec/lib/gitlab/usage/metrics/instrumentations/zuora_subscription_id_metric_spec.rb
deleted
100644 → 0
View file @
229b520f
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
ZuoraSubscriptionIdMetric
do
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'none'
,
data_source:
'ruby'
}
do
let
(
:expected_value
)
{
::
License
.
current
.
subscription_id
}
end
end
lib/gitlab/usage/metrics/names_suggestions/generator.rb
View file @
764e56d7
...
@@ -10,10 +10,10 @@ module Gitlab
...
@@ -10,10 +10,10 @@ module Gitlab
uncached_data
.
deep_stringify_keys
.
dig
(
*
key_path
.
split
(
'.'
))
uncached_data
.
deep_stringify_keys
.
dig
(
*
key_path
.
split
(
'.'
))
end
end
def
add_metric
(
metric
,
time_frame:
'none'
)
def
add_metric
(
metric
,
time_frame:
'none'
,
options:
{}
)
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
.
new
(
time_frame:
time_frame
).
suggested_name
metric_class
.
new
(
time_frame:
time_frame
,
options:
options
).
suggested_name
end
end
private
private
...
...
lib/gitlab/usage_data_non_sql_metrics.rb
View file @
764e56d7
...
@@ -12,10 +12,10 @@ module Gitlab
...
@@ -12,10 +12,10 @@ module Gitlab
super
.
with_indifferent_access
.
deep_merge
(
instrumentation_metrics
.
with_indifferent_access
)
super
.
with_indifferent_access
.
deep_merge
(
instrumentation_metrics
.
with_indifferent_access
)
end
end
def
add_metric
(
metric
,
time_frame:
'none'
)
def
add_metric
(
metric
,
time_frame:
'none'
,
options:
{}
)
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
.
new
(
time_frame:
time_frame
).
instrumentation
metric_class
.
new
(
time_frame:
time_frame
,
options:
options
).
instrumentation
end
end
def
count
(
relation
,
column
=
nil
,
batch:
true
,
batch_size:
nil
,
start:
nil
,
finish:
nil
)
def
count
(
relation
,
column
=
nil
,
batch:
true
,
batch_size:
nil
,
start:
nil
,
finish:
nil
)
...
...
lib/gitlab/usage_data_queries.rb
View file @
764e56d7
...
@@ -12,10 +12,10 @@ module Gitlab
...
@@ -12,10 +12,10 @@ module Gitlab
super
.
with_indifferent_access
.
deep_merge
(
instrumentation_metrics
.
with_indifferent_access
)
super
.
with_indifferent_access
.
deep_merge
(
instrumentation_metrics
.
with_indifferent_access
)
end
end
def
add_metric
(
metric
,
time_frame:
'none'
)
def
add_metric
(
metric
,
time_frame:
'none'
,
options:
{}
)
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
.
new
(
time_frame:
time_frame
).
instrumentation
metric_class
.
new
(
time_frame:
time_frame
,
options:
options
).
instrumentation
end
end
def
count
(
relation
,
column
=
nil
,
*
args
,
**
kwargs
)
def
count
(
relation
,
column
=
nil
,
*
args
,
**
kwargs
)
...
...
lib/gitlab/utils/usage_data.rb
View file @
764e56d7
...
@@ -49,6 +49,7 @@ module Gitlab
...
@@ -49,6 +49,7 @@ module Gitlab
# Results of this method should be overwritten by instrumentation class values
# Results of this method should be overwritten by instrumentation class values
# -100 indicates the metric was not properly merged.
# -100 indicates the metric was not properly merged.
return
INSTRUMENTATION_CLASS_FALLBACK
if
Feature
.
enabled?
(
:usage_data_instrumentation
)
return
INSTRUMENTATION_CLASS_FALLBACK
if
Feature
.
enabled?
(
:usage_data_instrumentation
)
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
=
"Gitlab::Usage::Metrics::Instrumentations::
#{
metric
}
"
.
constantize
metric_class
.
new
(
time_frame:
time_frame
,
options:
options
).
value
metric_class
.
new
(
time_frame:
time_frame
,
options:
options
).
value
...
...
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