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
590cfbf0
Commit
590cfbf0
authored
Jul 22, 2020
by
Pavel Shutsin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Analytics unique visits key naming
parent
48b1f532
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
doc/development/redis.md
doc/development/redis.md
+0
-1
lib/gitlab/analytics/unique_visits.rb
lib/gitlab/analytics/unique_visits.rb
+3
-1
spec/lib/gitlab/analytics/unique_visits_spec.rb
spec/lib/gitlab/analytics/unique_visits_spec.rb
+1
-1
No files found.
doc/development/redis.md
View file @
590cfbf0
...
...
@@ -50,7 +50,6 @@ project:{1}:set_b
project:{2}:set_c
```
`set_a`
and
`set_b`
are guaranteed to be held on the same Redis server, while
`set_c`
is not.
Currently, we validate this in the development and test environments
...
...
lib/gitlab/analytics/unique_visits.rb
View file @
590cfbf0
...
...
@@ -52,8 +52,10 @@ module Gitlab
def
key
(
target_id
,
time
)
raise
"Invalid target id
#{
target_id
}
"
unless
TARGET_IDS
.
include?
(
target_id
.
to_s
)
target_key
=
target_id
.
to_s
.
gsub
(
'analytics'
,
'{analytics}'
)
year_week
=
time
.
strftime
(
'%G-%V'
)
"
#{
target_id
}
-{
#{
year_week
}
}"
"
#{
target_key
}
-
#{
year_week
}
"
end
def
keys
(
targets
:,
timeframe_start
:,
weeks
:)
...
...
spec/lib/gitlab/analytics/unique_visits_spec.rb
View file @
590cfbf0
...
...
@@ -47,7 +47,7 @@ RSpec.describe Gitlab::Analytics::UniqueVisits, :clean_gitlab_redis_shared_state
unique_visits
.
track_visit
(
visitor1_id
,
target1_id
)
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
scan_each
(
match:
"
#{
target1_id
}
-*"
).
each
do
|
key
|
redis
.
scan_each
(
match:
"
{
#{
target1_id
}
}-*"
).
each
do
|
key
|
expect
(
redis
.
ttl
(
key
)).
to
be_within
(
5
.
seconds
).
of
(
12
.
weeks
)
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