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
4689069a
Commit
4689069a
authored
Sep 22, 2020
by
Alper Akgun
Committed by
Adam Hegyi
Sep 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify time_period for last 28 days
Aims is to improve batch counting performance
parent
202c6aa0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
10 deletions
+16
-10
changelogs/unreleased/251048-modify-time-period-for-batch-counting-performance-of-the-last-port.yml
...eriod-for-batch-counting-performance-of-the-last-port.yml
+5
-0
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+4
-3
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+1
-1
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+4
-4
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-1
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+1
-1
No files found.
changelogs/unreleased/251048-modify-time-period-for-batch-counting-performance-of-the-last-port.yml
0 → 100644
View file @
4689069a
---
title
:
Modify time_period for last 28 days to improve batch counting performance
merge_request
:
42972
author
:
type
:
performance
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
4689069a
...
@@ -478,9 +478,10 @@ RSpec.describe Gitlab::UsageData do
...
@@ -478,9 +478,10 @@ RSpec.describe Gitlab::UsageData do
end
end
describe
'usage_activity_by_stage_secure'
do
describe
'usage_activity_by_stage_secure'
do
let_it_be
(
:user
)
{
create
(
:user
,
group_view: :security_dashboard
)
}
let_it_be
(
:days_ago_within_monthly_time_period
)
{
3
.
days
.
ago
}
let_it_be
(
:user2
)
{
create
(
:user
,
group_view: :security_dashboard
)
}
let_it_be
(
:user
)
{
create
(
:user
,
group_view: :security_dashboard
,
created_at:
days_ago_within_monthly_time_period
)
}
let_it_be
(
:user3
)
{
create
(
:user
,
group_view: :security_dashboard
)
}
let_it_be
(
:user2
)
{
create
(
:user
,
group_view: :security_dashboard
,
created_at:
days_ago_within_monthly_time_period
)
}
let_it_be
(
:user3
)
{
create
(
:user
,
group_view: :security_dashboard
,
created_at:
days_ago_within_monthly_time_period
)
}
before
do
before
do
for_defined_days_back
do
for_defined_days_back
do
...
...
lib/gitlab/usage_data.rb
View file @
4689069a
...
@@ -473,7 +473,7 @@ module Gitlab
...
@@ -473,7 +473,7 @@ module Gitlab
end
end
def
last_28_days_time_period
(
column: :created_at
)
def
last_28_days_time_period
(
column: :created_at
)
{
column
=>
28
.
days
.
ago
..
Time
.
current
}
{
column
=>
30
.
days
.
ago
..
2
.
days
.
ago
}
end
end
# Source: https://gitlab.com/gitlab-data/analytics/blob/master/transform/snowflake-dbt/data/ping_metrics_to_stage_mapping_data.csv
# Source: https://gitlab.com/gitlab-data/analytics/blob/master/transform/snowflake-dbt/data/ping_metrics_to_stage_mapping_data.csv
...
...
spec/factories/usage_data.rb
View file @
4689069a
...
@@ -97,9 +97,9 @@ FactoryBot.define do
...
@@ -97,9 +97,9 @@ FactoryBot.define do
create
(
:grafana_integration
,
project:
projects
[
1
],
enabled:
true
)
create
(
:grafana_integration
,
project:
projects
[
1
],
enabled:
true
)
create
(
:grafana_integration
,
project:
projects
[
2
],
enabled:
false
)
create
(
:grafana_integration
,
project:
projects
[
2
],
enabled:
false
)
create
(
:package
,
project:
projects
[
0
])
create
(
:package
,
project:
projects
[
0
]
,
created_at:
3
.
days
.
ago
)
create
(
:package
,
project:
projects
[
0
])
create
(
:package
,
project:
projects
[
0
]
,
created_at:
3
.
days
.
ago
)
create
(
:package
,
project:
projects
[
1
])
create
(
:package
,
project:
projects
[
1
]
,
created_at:
3
.
days
.
ago
)
create
(
:package
,
created_at:
2
.
months
.
ago
,
project:
projects
[
1
])
create
(
:package
,
created_at:
2
.
months
.
ago
,
project:
projects
[
1
])
# User Preferences
# User Preferences
...
@@ -109,7 +109,7 @@ FactoryBot.define do
...
@@ -109,7 +109,7 @@ FactoryBot.define do
# Create fresh & a month (28-days SMAU) old data
# Create fresh & a month (28-days SMAU) old data
env
=
create
(
:environment
,
project:
projects
[
3
])
env
=
create
(
:environment
,
project:
projects
[
3
])
[
2
,
29
].
each
do
|
n
|
[
3
,
31
].
each
do
|
n
|
deployment_options
=
{
created_at:
n
.
days
.
ago
,
project:
env
.
project
,
environment:
env
}
deployment_options
=
{
created_at:
n
.
days
.
ago
,
project:
env
.
project
,
environment:
env
}
create
(
:deployment
,
:failed
,
deployment_options
)
create
(
:deployment
,
:failed
,
deployment_options
)
create
(
:deployment
,
:success
,
deployment_options
)
create
(
:deployment
,
:success
,
deployment_options
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
4689069a
...
@@ -1020,7 +1020,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
...
@@ -1020,7 +1020,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end
end
end
end
def
for_defined_days_back
(
days:
[
29
,
2
])
def
for_defined_days_back
(
days:
[
31
,
3
])
days
.
each
do
|
n
|
days
.
each
do
|
n
|
Timecop
.
travel
(
n
.
days
.
ago
)
do
Timecop
.
travel
(
n
.
days
.
ago
)
do
yield
yield
...
...
spec/support/helpers/usage_data_helpers.rb
View file @
4689069a
...
@@ -229,7 +229,7 @@ module UsageDataHelpers
...
@@ -229,7 +229,7 @@ module UsageDataHelpers
receive_matchers
.
each
{
|
m
|
expect
(
prometheus_client
).
to
m
}
receive_matchers
.
each
{
|
m
|
expect
(
prometheus_client
).
to
m
}
end
end
def
for_defined_days_back
(
days:
[
29
,
2
])
def
for_defined_days_back
(
days:
[
31
,
3
])
days
.
each
do
|
n
|
days
.
each
do
|
n
|
Timecop
.
travel
(
n
.
days
.
ago
)
do
Timecop
.
travel
(
n
.
days
.
ago
)
do
yield
yield
...
...
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