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
dd3927e3
Commit
dd3927e3
authored
Jun 04, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calculate recorded_at before other usage data
Ensures recorded_at is set before any other usage data calculation
parent
4af72bc5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-3
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+5
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+11
-0
No files found.
ee/lib/ee/gitlab/usage_data.rb
View file @
dd3927e3
...
...
@@ -39,11 +39,9 @@ module EE
override
:uncached_data
def
uncached_data
usage_activity_by_stage_monthly
=
usage_activity_by_stage
(
:usage_activity_by_stage_monthly
,
default_time_period
)
super
.
merge
(
usage_activity_by_stage
)
.
merge
(
usage_activity_by_stage
_monthly
)
.
merge
(
usage_activity_by_stage
(
:usage_activity_by_stage_monthly
,
default_time_period
)
)
.
merge
(
recording_ee_finish_data
)
end
...
...
lib/gitlab/usage_data.rb
View file @
dd3927e3
...
...
@@ -45,7 +45,7 @@ module Gitlab
def
license_usage_data
{
recorded_at:
Time
.
now
,
# should be calculated very first
recorded_at:
recorded_at
,
uuid:
alt_usage_data
{
Gitlab
::
CurrentSettings
.
uuid
},
hostname:
alt_usage_data
{
Gitlab
.
config
.
gitlab
.
host
},
version:
alt_usage_data
{
Gitlab
::
VERSION
},
...
...
@@ -55,6 +55,10 @@ module Gitlab
}
end
def
recorded_at
Time
.
now
end
def
recording_ce_finish_data
{
recording_ce_finished_at:
Time
.
now
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
dd3927e3
...
...
@@ -10,6 +10,17 @@ describe Gitlab::UsageData, :aggregate_failures do
stub_object_store_settings
end
describe
'#uncached_data'
do
it
'ensures recorded_at is set before any other usage data calculation'
do
%i(alt_usage_data redis_usage_data distinct_count count)
.
each
do
|
method
|
expect
(
described_class
).
not_to
receive
(
method
)
end
expect
(
described_class
).
to
receive
(
:recorded_at
).
and_raise
(
Exception
.
new
(
'Stopped calculating recorded_at'
))
expect
{
described_class
.
uncached_data
}.
to
raise_error
(
'Stopped calculating recorded_at'
)
end
end
describe
'#data'
do
let!
(
:ud
)
{
build
(
:usage_data
)
}
...
...
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