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
5ccf6e7f
Commit
5ccf6e7f
authored
Sep 06, 2021
by
Luis Mejia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ci_templates_total_unique metrics
Add CATEGORIES_FOR_TOTALS for explicit validation Changelog: removed
parent
f596700d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
7 deletions
+26
-7
config/metrics/counts_28d/20210216184559_ci_templates_total_unique_counts_monthly.yml
...210216184559_ci_templates_total_unique_counts_monthly.yml
+2
-1
config/metrics/counts_7d/20210216184557_ci_templates_total_unique_counts_weekly.yml
...0210216184557_ci_templates_total_unique_counts_weekly.yml
+2
-1
lib/gitlab/usage_data_counters/hll_redis_counter.rb
lib/gitlab/usage_data_counters/hll_redis_counter.rb
+19
-1
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
.../lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
+2
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-4
No files found.
config/metrics/counts_28d/20210216184559_ci_templates_total_unique_counts_monthly.yml
View file @
5ccf6e7f
...
...
@@ -7,7 +7,8 @@ product_stage: configure
product_group
:
group::configure
product_category
:
infrastructure_as_code
value_type
:
number
status
:
broken
status
:
removed
milestone_removed
:
'
14.3'
repair_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/332466
time_frame
:
28d
data_source
:
redis_hll
...
...
config/metrics/counts_7d/20210216184557_ci_templates_total_unique_counts_weekly.yml
View file @
5ccf6e7f
...
...
@@ -7,7 +7,8 @@ product_stage: configure
product_group
:
group::configure
product_category
:
infrastructure_as_code
value_type
:
number
status
:
broken
status
:
removed
milestone_removed
:
'
14.3'
repair_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/332466
time_frame
:
7d
data_source
:
redis_hll
...
...
lib/gitlab/usage_data_counters/hll_redis_counter.rb
View file @
5ccf6e7f
...
...
@@ -18,6 +18,24 @@ module Gitlab
KNOWN_EVENTS_PATH
=
File
.
expand_path
(
'known_events/*.yml'
,
__dir__
)
ALLOWED_AGGREGATIONS
=
%i(daily weekly)
.
freeze
CATEGORIES_FOR_TOTALS
=
%w[
analytics
code_review
compliance
deploy_token_packages
ecosystem
epic_boards_usage
epics_usage
ide_edit
incident_management
issues_edit
pipeline_authoring
quickactions
search
testing
user_packages
]
.
freeze
# Track event on entity_id
# Increment a Redis HLL counter for unique event_name and entity_id
#
...
...
@@ -90,7 +108,7 @@ module Gitlab
hash
[
"
#{
event
}
_monthly"
]
=
unique_events
(
**
monthly_time_range
.
merge
(
event_names:
[
event
]))
end
if
eligible_for_totals?
(
events_names
)
if
eligible_for_totals?
(
events_names
)
&&
CATEGORIES_FOR_TOTALS
.
include?
(
category
)
event_results
[
"
#{
category
}
_total_unique_counts_weekly"
]
=
unique_events
(
**
weekly_time_range
.
merge
(
event_names:
events_names
))
event_results
[
"
#{
category
}
_total_unique_counts_monthly"
]
=
unique_events
(
**
monthly_time_range
.
merge
(
event_names:
events_names
))
end
...
...
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
View file @
5ccf6e7f
...
...
@@ -462,6 +462,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
allow
(
described_class
).
to
receive
(
:known_events
).
and_return
(
known_events
)
allow
(
described_class
).
to
receive
(
:categories
).
and_return
(
%w(category1 category2)
)
stub_const
(
'Gitlab::UsageDataCounters::HLLRedisCounter::CATEGORIES_FOR_TOTALS'
,
%w(category1 category2)
)
described_class
.
track_event
(
'event1_slot'
,
values:
entity1
,
time:
2
.
days
.
ago
)
described_class
.
track_event
(
'event2_slot'
,
values:
entity2
,
time:
2
.
days
.
ago
)
described_class
.
track_event
(
'event2_slot'
,
values:
entity3
,
time:
2
.
weeks
.
ago
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
5ccf6e7f
...
...
@@ -1279,9 +1279,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject
{
described_class
.
redis_hll_counters
}
let
(
:categories
)
{
::
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
categories
}
let
(
:ineligible_total_categories
)
do
%w[source_code ci_secrets_management incident_management_alerts snippets terraform incident_management_oncall secure network_policies]
end
context
'with redis_hll_tracking feature enabled'
do
it
'has all known_events'
do
...
...
@@ -1296,7 +1293,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
metrics
=
keys
.
map
{
|
key
|
"
#{
key
}
_weekly"
}
+
keys
.
map
{
|
key
|
"
#{
key
}
_monthly"
}
if
ineligible_total_categories
.
ex
clude?
(
category
)
if
::
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
::
CATEGORIES_FOR_TOTALS
.
in
clude?
(
category
)
metrics
.
append
(
"
#{
category
}
_total_unique_counts_weekly"
,
"
#{
category
}
_total_unique_counts_monthly"
)
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