Fix missing extra in database event tracking
What does this MR do and why?
This MR fixes !92079 (merged)
Database event tracking for DatabaseEventTracking model was using symbols as keys, while #attributes method returns hash with string keys That caused extra attribute not to be populated correctly. This commit modifies database tracking to be indifferent to symbols/string usage.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Enable ff and create db records via rails console with FactoryBot
::Feature.enable(:product_intelligence_database_event_tracking)
require_relative 'ee/spec/factories/analytics/cycle_analytics/group_value_streams.rb'
require_relative 'ee/spec/factories/analytics/cycle_analytics/group_stages.rb'
FactoryBot.create(:cycle_analytics_group_stage, group: Group.first)
Visit Snowplow Micro in GDK http://localhost:9091/micro/good
(see this guide for GDK configuration instructions)
Check if there are record attributes present in context
field in event json
...
"contexts": {
"schema": "iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",
"data": [
{
"schema": "iglu:com.gitlab/gitlab_standard/jsonschema/1-0-8",
"data": {
"environment": "development",
"source": "gitlab-rails",
"plan": "default",
"extra": {
"id": 5,
"created_at": "2022-07-29 09:35:53 UTC",
"updated_at": "2022-07-29 09:35:53 UTC",
"relative_position": null,
"start_event_identifier": "merge_request_created",
"end_event_identifier": "merge_request_merged",
"group_id": 22,
"start_event_label_id": null,
"end_event_label_id": null,
"hidden": false,
"custom": true,
"name": "Stage #2",
"group_value_stream_id": 5
},
"user_id": null,
"namespace_id": 22,
"project_id": null,
"context_generated_at": "2022-07-29 09:35:53 UTC"
}
}
]
},
....
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.