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
5dce1010
Commit
5dce1010
authored
Sep 15, 2020
by
Alper Akgun
Committed by
Robert Speicher
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redis values for usage ping SQL dump rake task
Review comments
parent
1230f08e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
changelogs/unreleased/245277-handle-redis-for-usage-ping-sql-dump-rake-task.yml
...245277-handle-redis-for-usage-ping-sql-dump-rake-task.yml
+5
-0
lib/gitlab/usage_data_queries.rb
lib/gitlab/usage_data_queries.rb
+8
-0
spec/lib/gitlab/usage_data_queries_spec.rb
spec/lib/gitlab/usage_data_queries_spec.rb
+14
-0
No files found.
changelogs/unreleased/245277-handle-redis-for-usage-ping-sql-dump-rake-task.yml
0 → 100644
View file @
5dce1010
---
title
:
Updated gitlab:usage_data:dump_sql_in_yaml rake task with redis usage
merge_request
:
42189
author
:
type
:
changed
lib/gitlab/usage_data_queries.rb
View file @
5dce1010
...
...
@@ -11,6 +11,14 @@ module Gitlab
raw_sql
(
relation
,
column
,
:distinct
)
end
def
redis_usage_data
(
counter
=
nil
,
&
block
)
if
block_given?
{
redis_usage_data_block:
block
.
to_s
}
elsif
counter
.
present?
{
redis_usage_data_counter:
counter
}
end
end
private
def
raw_sql
(
relation
,
column
,
distinct
=
nil
)
...
...
spec/lib/gitlab/usage_data_queries_spec.rb
View file @
5dce1010
...
...
@@ -18,4 +18,18 @@ RSpec.describe Gitlab::UsageDataQueries do
expect
(
described_class
.
distinct_count
(
Issue
,
:author_id
)).
to
eq
(
'SELECT COUNT(DISTINCT "issues"."author_id") FROM "issues"'
)
end
end
describe
'.redis_usage_data'
do
subject
(
:redis_usage_data
)
{
described_class
.
redis_usage_data
{
42
}
}
it
'returns a class for redis_usage_data with a counter call'
do
expect
(
described_class
.
redis_usage_data
(
Gitlab
::
UsageDataCounters
::
WikiPageCounter
))
.
to
eq
(
redis_usage_data_counter:
Gitlab
::
UsageDataCounters
::
WikiPageCounter
)
end
it
'returns a stringified block for redis_usage_data with a block'
do
is_expected
.
to
include
(
:redis_usage_data_block
)
expect
(
redis_usage_data
[
:redis_usage_data_block
]).
to
start_with
(
'#<Proc:'
)
end
end
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