GitLab Standard Context Fields

Standard context, also referred to as Cloud context, describes all the fields available in the GitLab Standard Context schema.

Required Fields

FieldTypeDescriptionExample
environmentstringName of the source environment."production", "staging"

Optional Fields

FieldTypeDescriptionExample
project_idinteger, nullID of the associated project. This is available when tracking is done inside any project path. (example : GitLab project)12345
namespace_idinteger, nullID of the associated namespace. This is available when tracking is done inside any group path. (example : GitLab-org)67890
user_idinteger, nullID of the associated user. This gets pseudonymized in the Snowplow enricher. Refer to the metrics dictionary.longhash
global_user_idstring, nullAn anonymized user_id hash unique across instances.longhash
is_gitlab_team_memberboolean, nullIndicates if the action was triggered by a GitLab team member.true, false

Instance Information

FieldTypeDescriptionExample
instance_idstring, nullID of the GitLab instance where the request originated.instance_long_uuid
host_namestring, nullHostname of the GitLab instance."gitlab-host-id"
instance_versionstring, nullVersion of the GitLab instance."15.8.0"
realmstring, nullDeployment type of GitLab. Must be one of: "self-managed", "saas", "dedicated"."saas"

Client Information

FieldTypeDescriptionExample
client_namestring, nullName of the client sending the request."chrome", "jetbrains"
client_versionstring, nullVersion of the client."108.0.5359.124"
client_typestring, nullType of client."browser", "ide"
interfacestring, nullInterface from which the request originates."Duo Chat"

Feature and Plan Information

FieldTypeDescriptionExample
feature_categorystring, nullCategory where the specific feature belongs."duo_chat"
feature_enabled_by_namespace_idsarray, nullList of namespace IDs allowing the user to use the tracked feature.[123, 456, 789]
planstring, nullName of the subscription plan (maximum length: 32 characters)."free", "ultimate"

Tracking and Context

FieldTypeDescriptionExample
sourcestring, nullName of the source application."gitlab-rails", "gitlab-javascript"
google_analytics_idstring, nullGoogle Analytics ID from the marketing site."UA-XXXXXXXX-X"
context_generated_atstring, nullTimestamp indicating when the context was generated."2023-12-20T10:00:00Z"
correlation_idstring, nullUnique request ID for each request.uuid
extraobject, nullAdditional 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 repository to update the schema.

  2. If the new field should be pseudonymized, add it to the ATTRIBUTE_TO_PSEUDONYMISE constant in the snowplow-pseudonymization project.

  3. Update the GITLAB_STANDARD_SCHEMA_URL in tracking/standard_context.rb to match the new version from gitlab-org/iglu.

  4. Start sending events that include the new field in Standard Context.