Ensure that `gitlab_standard` comes first in the list of contexts
What does this MR do?
As raised in https://gitlab.com/gitlab-data/analytics/-/issues/8099, the order of Snowplow contexts matters when we are parsing/flattening events.
To make the order consistent between frontend and backend, this MR changes the backend tracking module to always place gitlab_standard
(represented in code as StandardContext
) first in the list of contexts.
Based on discussion in this slack thread: https://gitlab.slack.com/archives/CL3A7GFPF/p1614977560157100?thread_ts=1614677571.084500&cid=CL3A7GFPF
Looking at this, it seems like we have an inconsistent ordering of contexts between BE and FE. On the frontend, gitlab_standard goes first:
const contexts = [STANDARD_CONTEXT]; if (data.context) { contexts.push(data.context); }
Whereas on the backend, gitlab_standard is added last:
context += [Tracking::StandardContext.new(project: project, user: user, namespace: namespace).to_context]
I think having gitlab_standard first makes sense, so I will make the appropriate change on the backend.
Screenshots
A good
event with multiple contexts tested locally:
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because this is not a user facing change.
-
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team