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
7d5fb818
Commit
7d5fb818
authored
Oct 01, 2021
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate promoted_issues metric
parent
f3a8f0da
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
5 additions
and
86 deletions
+5
-86
app/models/product_analytics_event.rb
app/models/product_analytics_event.rb
+0
-2
config/metrics/counts_28d/20210916080405_promoted_issues.yml
config/metrics/counts_28d/20210916080405_promoted_issues.yml
+1
-1
doc/development/service_ping/implement.md
doc/development/service_ping/implement.md
+0
-1
ee/spec/config/metrics/every_metric_definition_spec.rb
ee/spec/config/metrics/every_metric_definition_spec.rb
+0
-1
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+3
-25
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-45
spec/models/product_analytics_event_spec.rb
spec/models/product_analytics_event_spec.rb
+0
-11
No files found.
app/models/product_analytics_event.rb
View file @
7d5fb818
...
...
@@ -20,8 +20,6 @@ class ProductAnalyticsEvent < ApplicationRecord
where
(
'collector_tstamp BETWEEN ? AND ? '
,
today
-
duration
+
1
,
today
+
1
)
}
scope
:by_category_and_action
,
->
(
category
,
action
)
{
where
(
se_category:
category
,
se_action:
action
)
}
def
self
.
count_by_graph
(
graph
,
days
)
group
(
graph
).
timerange
(
days
).
count
end
...
...
config/metrics/counts_28d/20210916080405_promoted_issues.yml
View file @
7d5fb818
...
...
@@ -7,7 +7,7 @@ product_stage: growth
product_group
:
group::product intelligence
product_category
:
collection
value_type
:
number
status
:
active
status
:
deprecated
milestone
:
"
14.3"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70485
time_frame
:
28d
...
...
doc/development/service_ping/implement.md
View file @
7d5fb818
...
...
@@ -942,7 +942,6 @@ Aggregated metrics collected in `7d` and `28d` time frames are added into Servic
:packages
=>
155
,
:personal_snippets
=>
2106
,
:project_snippets
=>
407
,
:promoted_issues
=>
719
,
:aggregated_metrics
=>
{
:example_metrics_union
=>
7
,
:example_metrics_intersection
=>
2
...
...
ee/spec/config/metrics/every_metric_definition_spec.rb
View file @
7d5fb818
...
...
@@ -27,7 +27,6 @@ RSpec.describe 'Every metric definition' do
mock_ci
mock_monitoring
user_auth_by_provider
promoted_issues
groups_gitlab_slack_application_active
projects_gitlab_slack_application_active
instances_gitlab_slack_application_active
...
...
lib/gitlab/usage_data.rb
View file @
7d5fb818
...
...
@@ -203,19 +203,6 @@ module Gitlab
}
end
def
snowplow_event_counts
(
time_period
)
return
{}
unless
report_snowplow_events?
{
promoted_issues:
count
(
self_monitoring_project
.
product_analytics_events
.
by_category_and_action
(
'epics'
,
'promote'
)
.
where
(
time_period
)
)
}
end
def
system_usage_data_monthly
{
counts_monthly:
{
...
...
@@ -228,10 +215,9 @@ module Gitlab
packages:
count
(
::
Packages
::
Package
.
where
(
monthly_time_range_db_params
)),
personal_snippets:
count
(
PersonalSnippet
.
where
(
monthly_time_range_db_params
)),
project_snippets:
count
(
ProjectSnippet
.
where
(
monthly_time_range_db_params
)),
projects_with_alerts_created:
distinct_count
(
::
AlertManagement
::
Alert
.
where
(
monthly_time_range_db_params
),
:project_id
)
}.
merge
(
snowplow_event_counts
(
monthly_time_range_db_params
(
column: :collector_tstamp
))
).
tap
do
|
data
|
projects_with_alerts_created:
distinct_count
(
::
AlertManagement
::
Alert
.
where
(
monthly_time_range_db_params
),
:project_id
),
promoted_issues:
DEPRECATED_VALUE
}.
tap
do
|
data
|
data
[
:snippets
]
=
add
(
data
[
:personal_snippets
],
data
[
:project_snippets
])
end
}
...
...
@@ -787,10 +773,6 @@ module Gitlab
}
end
def
report_snowplow_events?
self_monitoring_project
&&
Feature
.
enabled?
(
:product_analytics_tracking
,
type: :ops
)
end
def
distinct_count_service_desk_enabled_projects
(
time_period
)
project_creator_id_start
=
minimum_id
(
User
)
project_creator_id_finish
=
maximum_id
(
User
)
...
...
@@ -851,10 +833,6 @@ module Gitlab
count
(
::
Issue
.
with_prometheus_alert_events
,
start:
minimum_id
(
Issue
),
finish:
maximum_id
(
Issue
))
end
def
self_monitoring_project
Gitlab
::
CurrentSettings
.
self_monitoring_project
end
def
clear_memoized
CE_MEMOIZED_VALUES
.
each
{
|
v
|
clear_memoization
(
v
)
}
end
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
7d5fb818
...
...
@@ -724,7 +724,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
counts_monthly
[
:projects_with_alerts_created
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:projects
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:packages
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:promoted_issues
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:promoted_issues
]).
to
eq
(
Gitlab
::
UsageData
::
DEPRECATED_VALUE
)
end
end
...
...
@@ -1419,48 +1419,4 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end
end
end
describe
'.snowplow_event_counts'
do
let_it_be
(
:time_period
)
{
{
collector_tstamp:
8
.
days
.
ago
..
1
.
day
.
ago
}
}
context
'when self-monitoring project exists'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
before
do
stub_application_setting
(
self_monitoring_project:
project
)
end
context
'and product_analytics FF is enabled for it'
do
before
do
stub_feature_flags
(
product_analytics_tracking:
true
)
create
(
:product_analytics_event
,
project:
project
,
se_category:
'epics'
,
se_action:
'promote'
)
create
(
:product_analytics_event
,
project:
project
,
se_category:
'epics'
,
se_action:
'promote'
,
collector_tstamp:
2
.
days
.
ago
)
create
(
:product_analytics_event
,
project:
project
,
se_category:
'epics'
,
se_action:
'promote'
,
collector_tstamp:
9
.
days
.
ago
)
create
(
:product_analytics_event
,
project:
project
,
se_category:
'foo'
,
se_action:
'bar'
,
collector_tstamp:
2
.
days
.
ago
)
end
it
'returns promoted_issues for the time period'
do
expect
(
described_class
.
snowplow_event_counts
(
time_period
)[
:promoted_issues
]).
to
eq
(
1
)
end
end
context
'and product_analytics FF is disabled'
do
before
do
stub_feature_flags
(
product_analytics_tracking:
false
)
end
it
'returns an empty hash'
do
expect
(
described_class
.
snowplow_event_counts
(
time_period
)).
to
eq
({})
end
end
end
context
'when self-monitoring project does not exist'
do
it
'returns an empty hash'
do
expect
(
described_class
.
snowplow_event_counts
(
time_period
)).
to
eq
({})
end
end
end
end
spec/models/product_analytics_event_spec.rb
View file @
7d5fb818
...
...
@@ -36,17 +36,6 @@ RSpec.describe ProductAnalyticsEvent, type: :model do
it
{
expect
(
described_class
.
count_by_graph
(
'platform'
,
30
.
days
)).
to
eq
({
'app'
=>
1
,
'mobile'
=>
1
,
'web'
=>
2
})
}
end
describe
'.by_category_and_action'
do
let_it_be
(
:event
)
{
create
(
:product_analytics_event
,
se_category:
'catA'
,
se_action:
'actA'
)
}
before
do
create
(
:product_analytics_event
,
se_category:
'catA'
,
se_action:
'actB'
)
create
(
:product_analytics_event
,
se_category:
'catB'
,
se_action:
'actA'
)
end
it
{
expect
(
described_class
.
by_category_and_action
(
'catA'
,
'actA'
)).
to
match_array
([
event
])
}
end
describe
'.count_collector_tstamp_by_day'
do
let_it_be
(
:time_now
)
{
Time
.
zone
.
now
}
let_it_be
(
:time_ago
)
{
Time
.
zone
.
now
-
5
.
days
}
...
...
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