Commit 09594af4 authored by Cameron Swords's avatar Cameron Swords

Add more properties to the snowplow event

parent 3eb13492
...@@ -29,7 +29,9 @@ module Security ...@@ -29,7 +29,9 @@ module Security
context: [context], context: [context],
idempotency_key: Digest::SHA256.hexdigest(idempotency_key), idempotency_key: Digest::SHA256.hexdigest(idempotency_key),
user: build.user_id, user: build.user_id,
project: build.project_id) project: build.project_id,
label: analyzer_id(report),
property: scan_type(report, report_type))
end end
def data_to_track(report_type, report) def data_to_track(report_type, report)
...@@ -38,7 +40,7 @@ module Security ...@@ -38,7 +40,7 @@ module Security
primary_scanner = report&.primary_scanner primary_scanner = report&.primary_scanner
{ {
analyzer: analyzer&.id, analyzer: analyzer_id(report),
analyzer_vendor: analyzer&.vendor, analyzer_vendor: analyzer&.vendor,
analyzer_version: analyzer&.version, analyzer_version: analyzer&.version,
end_time: scan&.end_time, end_time: scan&.end_time,
...@@ -55,5 +57,9 @@ module Security ...@@ -55,5 +57,9 @@ module Security
def scan_type(report, report_type) def scan_type(report, report_type)
report&.scan&.type || report_type report&.scan&.type || report_type
end end
def analyzer_id(report)
report&.analyzer&.id
end
end end
end end
...@@ -43,7 +43,9 @@ RSpec.describe Security::TrackScanService do ...@@ -43,7 +43,9 @@ RSpec.describe Security::TrackScanService do
}], }],
idempotency_key: '82fc6391e4be61e03e51fa8c5c6bfc32b3d3f0065ad2fe0a01211606952b8d82', idempotency_key: '82fc6391e4be61e03e51fa8c5c6bfc32b3d3f0065ad2fe0a01211606952b8d82',
user: user.id, user: user.id,
project: project.id) project: project.id,
label: 'gitlab-dast',
property: 'dast')
end end
end end
...@@ -78,7 +80,9 @@ RSpec.describe Security::TrackScanService do ...@@ -78,7 +80,9 @@ RSpec.describe Security::TrackScanService do
}], }],
idempotency_key: '62bc6c62686b327dbf420f8891e1418406b60f49e574b6ff22f4d6a272dbc595', idempotency_key: '62bc6c62686b327dbf420f8891e1418406b60f49e574b6ff22f4d6a272dbc595',
user: user.id, user: user.id,
project: project.id) project: project.id,
label: nil,
property: 'dast')
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment