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
d6ab58e1
Commit
d6ab58e1
authored
Nov 11, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove usage data cache and add spec
parent
e21aff62
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
13 deletions
+6
-13
app/workers/gitlab_usage_ping_worker.rb
app/workers/gitlab_usage_ping_worker.rb
+0
-3
config/database.yml.example
config/database.yml.example
+0
-0
lib/gitlab/grafana_embed_usage_data.rb
lib/gitlab/grafana_embed_usage_data.rb
+1
-7
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+1
-1
spec/lib/gitlab/grafana_embed_usage_data_spec.rb
spec/lib/gitlab/grafana_embed_usage_data_spec.rb
+0
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+4
-0
spec/workers/gitlab_usage_ping_worker_spec.rb
spec/workers/gitlab_usage_ping_worker_spec.rb
+0
-1
No files found.
app/workers/gitlab_usage_ping_worker.rb
View file @
d6ab58e1
...
...
@@ -18,9 +18,6 @@ class GitlabUsagePingWorker
# Splay the request over a minute to avoid thundering herd problems.
sleep
(
rand
(
0.0
..
60.0
).
round
(
3
))
# Cache to decouple long running work from the http request context
Gitlab
::
GrafanaEmbedUsageData
.
write_issue_count
SubmitUsagePingService
.
new
.
execute
end
...
...
config/database.yml.example
deleted
100644 → 0
View file @
e21aff62
lib/gitlab/grafana_embed_usage_data.rb
View file @
d6ab58e1
...
...
@@ -4,13 +4,7 @@ module Gitlab
class
GrafanaEmbedUsageData
class
<<
self
def
issue_count
Rails
.
cache
.
read
(
:grafana_embed_issue_count
)
end
def
write_issue_count
count
=
get_embed_count
Rails
.
cache
.
write
(
:grafana_embed_issue_count
,
count
)
count
get_embed_count
end
private
...
...
lib/gitlab/usage_data.rb
View file @
d6ab58e1
...
...
@@ -84,7 +84,7 @@ module Gitlab
issues:
count
(
Issue
),
issues_with_associated_zoom_link:
count
(
ZoomMeeting
.
added_to_issue
),
issues_using_zoom_quick_actions:
count
(
ZoomMeeting
.
select
(
:issue_id
).
distinct
),
issues_with_embeded_grafana_charts:
Gitlab
::
GrafanaEmbedUsageData
.
count_issues
,
issues_with_embeded_grafana_charts:
::
Gitlab
::
GrafanaEmbedUsageData
.
issue_count
,
keys:
count
(
Key
),
label_lists:
count
(
List
.
label
),
lfs_objects:
count
(
LfsObject
),
...
...
spec/lib/gitlab/grafana_embed_usage_data_spec.rb
View file @
d6ab58e1
...
...
@@ -5,7 +5,6 @@ require 'spec_helper'
describe
Gitlab
::
GrafanaEmbedUsageData
do
describe
'#issue_count'
,
:use_clean_rails_memory_store_caching
do
subject
do
described_class
.
write_issue_count
described_class
.
issue_count
end
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
d6ab58e1
...
...
@@ -53,6 +53,8 @@ describe Gitlab::UsageData do
create
(
:grafana_integration
,
project:
projects
[
1
],
enabled:
true
)
create
(
:grafana_integration
,
project:
projects
[
2
],
enabled:
false
)
allow
(
Gitlab
::
GrafanaEmbedUsageData
).
to
receive
(
:issue_count
)
{
2
}
ProjectFeature
.
first
.
update_attribute
(
'repository_access_level'
,
0
)
end
...
...
@@ -152,6 +154,7 @@ describe Gitlab::UsageData do
issues
issues_with_associated_zoom_link
issues_using_zoom_quick_actions
issues_with_embeded_grafana_charts
keys
label_lists
labels
...
...
@@ -211,6 +214,7 @@ describe Gitlab::UsageData do
expect
(
count_data
[
:projects_with_error_tracking_enabled
]).
to
eq
(
1
)
expect
(
count_data
[
:issues_with_associated_zoom_link
]).
to
eq
(
2
)
expect
(
count_data
[
:issues_using_zoom_quick_actions
]).
to
eq
(
3
)
expect
(
count_data
[
:issues_with_embeded_grafana_charts
]).
to
eq
(
2
)
expect
(
count_data
[
:clusters_enabled
]).
to
eq
(
4
)
expect
(
count_data
[
:project_clusters_enabled
]).
to
eq
(
3
)
...
...
spec/workers/gitlab_usage_ping_worker_spec.rb
View file @
d6ab58e1
...
...
@@ -8,7 +8,6 @@ describe GitlabUsagePingWorker do
it
'delegates to SubmitUsagePingService'
do
allow
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
true
)
expect
(
Gitlab
::
GrafanaEmbedUsageData
).
to
receive
(
:write_issue_count
)
expect_any_instance_of
(
SubmitUsagePingService
).
to
receive
(
:execute
)
subject
.
perform
...
...
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