diff --git a/doc/development/internal_analytics/internal_event_instrumentation/standard_context_fields.md b/doc/development/internal_analytics/internal_event_instrumentation/standard_context_fields.md index e57237727eb66f43b8097c17609f36152921d5e2..0868aeddca116c40861b305f0fca3ec3a9aa5b2a 100644 --- a/doc/development/internal_analytics/internal_event_instrumentation/standard_context_fields.md +++ b/doc/development/internal_analytics/internal_event_instrumentation/standard_context_fields.md @@ -59,6 +59,17 @@ Standard context, also referred to as [Cloud context](https://gitlab.com/gitlab- | `correlation_id` | string, null | Unique request ID for each request. | `uuid` | | `extra` | object, null | Additional data associated with the event, in key-value pair format. | `{"key": "value"}` | +### Adding a New Field to the Standard Context + +To add a new field to the standard context: + +1. Create a merge request in the [iglu](https://gitlab.com/gitlab-org/iglu/-/tree/master/public/schemas/com.gitlab/gitlab_standard/jsonschema?ref_type=heads) repository to update the schema. + +1. If the new field should be pseudonymized, add it to the [ATTRIBUTE_TO_PSEUDONYMISE](https://gitlab.com/gitlab-org/analytics-section/analytics-instrumentation/snowplow-pseudonymization/-/blob/main/lib/snowplow/gitlab_standard_context.rb?ref_type=heads#L9) constant in the `snowplow-pseudonymization` project. + +1. Update the `GITLAB_STANDARD_SCHEMA_URL` in [tracking/standard_context.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/tracking/standard_context.rb#L6) to match the new version from `gitlab-org/iglu`. +1. Start sending events that include the new field in Standard Context. + ### Related Links - Descriptions of Unit Primitives are documented in [cloud connector](https://gitlab.com/gitlab-org/cloud-connector/gitlab-cloud-connector/-/tree/main/config/unit_primitives).