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
24e09184
Commit
24e09184
authored
Aug 07, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse and save structured event fields in snowplow collector
- Add mappings for structured event params - Update tests
parent
3f6b3993
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
lib/product_analytics/event_params.rb
lib/product_analytics/event_params.rb
+6
-1
spec/fixtures/product_analytics/event.json
spec/fixtures/product_analytics/event.json
+6
-1
spec/lib/product_analytics/event_params_spec.rb
spec/lib/product_analytics/event_params_spec.rb
+6
-1
spec/requests/product_analytics/collector_app_spec.rb
spec/requests/product_analytics/collector_app_spec.rb
+2
-18
No files found.
lib/product_analytics/event_params.rb
View file @
24e09184
...
...
@@ -40,7 +40,12 @@ module ProductAnalytics
domain_userid:
params
[
'duid'
],
user_fingerprint:
params
[
'fp'
],
page_referrer:
params
[
'refr'
],
page_url:
params
[
'url'
]
page_url:
params
[
'url'
],
se_category:
params
[
'se_ca'
],
se_action:
params
[
'se_ac'
],
se_label:
params
[
'se_la'
],
se_property:
params
[
'se_pr'
],
se_value:
params
[
'se_va'
]
}
end
...
...
spec/fixtures/product_analytics/event.json
View file @
24e09184
...
...
@@ -12,5 +12,10 @@
"lang"
:
"en-US"
,
"cookie"
:
"1"
,
"tz"
:
"America/Los_Angeles"
,
"cs"
:
"UTF-8"
"cs"
:
"UTF-8"
,
"se_ca"
:
"category"
,
"se_ac"
:
"action"
,
"se_la"
:
"label"
,
"se_pr"
:
"property"
,
"se_va"
:
12.34
}
spec/lib/product_analytics/event_params_spec.rb
View file @
24e09184
...
...
@@ -23,7 +23,12 @@ RSpec.describe ProductAnalytics::EventParams do
br_lang:
'en-US'
,
br_cookies:
true
,
os_timezone:
'America/Los_Angeles'
,
doc_charset:
'UTF-8'
doc_charset:
'UTF-8'
,
se_category:
'category'
,
se_action:
'action'
,
se_label:
'label'
,
se_property:
'property'
,
se_value:
12.34
}
expect
(
subject
).
to
include
(
expected_params
)
...
...
spec/requests/product_analytics/collector_app_spec.rb
View file @
24e09184
...
...
@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec
.
describe
'ProductAnalytics::CollectorApp'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:params
)
{
{}
}
let
(
:raw_event
)
{
Gitlab
::
Json
.
parse
(
fixture_file
(
'product_analytics/event.json'
))
}
subject
{
get
'/-/collector/i'
,
params:
params
}
...
...
@@ -17,24 +18,7 @@ RSpec.describe 'ProductAnalytics::CollectorApp' do
end
context
'correct event params'
do
let
(
:params
)
do
{
aid:
project
.
id
,
p:
'web'
,
tna:
'sp'
,
tv:
'js-2.14.0'
,
eid:
SecureRandom
.
uuid
,
duid:
SecureRandom
.
uuid
,
sid:
SecureRandom
.
uuid
,
vid:
4
,
url:
'http://example.com/products/1'
,
refr:
'http://example.com/products/1'
,
lang:
'en-US'
,
cookie:
true
,
tz:
'America/Los_Angeles'
,
cs:
'UTF-8'
}
end
let
(
:params
)
{
raw_event
.
merge
(
aid:
project
.
id
)
}
it
'repond with 200'
do
expect
{
subject
}.
to
change
{
ProductAnalyticsEvent
.
count
}.
by
(
1
)
...
...
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