diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-11 21:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-11 21:09:22 +0300 |
commit | 1bd9d2d9499d0d28e62254a28fcd3d913a8704af (patch) | |
tree | ea9969a5a4c3ac77858be20d69869674bed5ca43 /doc/development | |
parent | d8877c12347443fa02e0ba53ad8d5cd318f6fa28 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development')
3 files changed, 50 insertions, 1 deletions
diff --git a/doc/development/documentation/styleguide/index.md b/doc/development/documentation/styleguide/index.md index af6a536b2e2..a18b376a1cc 100644 --- a/doc/development/documentation/styleguide/index.md +++ b/doc/development/documentation/styleguide/index.md @@ -243,7 +243,7 @@ by default. Capitalize names of: - GitLab [product tiers](https://about.gitlab.com/pricing/). For example, - GitLab Free and GitLab Ultimate. (Tested in [`BadgeCapitalization.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/BadgeCapitalization.yml).) + GitLab Free and GitLab Ultimate. - Third-party organizations, software, and products. For example, Prometheus, Kubernetes, Git, and The Linux Foundation. - Methods or methodologies. For example, Continuous Integration, diff --git a/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md b/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md index 6f48f83e7ca..ae33eeb49f4 100644 --- a/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md +++ b/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md @@ -50,6 +50,53 @@ It is encouraged to fill out as many of `user`, `namespace` and `project` as pos If a `project` but no `namespace` is provided, the `project.namespace` is used as the `namespace` for the event. +#### Controller and API helpers + +There is a helper module `ProductAnalyticsTracking` for controllers you can use to track internal events for particular controller actions by calling `#track_internal_event`: + +```ruby +class Projects::PipelinesController < Projects::ApplicationController + include ProductAnalyticsTracking + + track_internal_event :charts, name: 'p_analytics_ci_cd_pipelines', conditions: -> { should_track_ci_cd_pipelines? } + + def charts + ... + end + + private + + def should_track_ci_cd_pipelines? + params[:chart].blank? || params[:chart] == 'pipelines' + end +end +``` + +You need to add these two methods to the controller body, so that the helper can get the current project and namespace for the event: + +```ruby + private + + def tracking_namespace_source + project.namespace + end + + def tracking_project_source + project + end +``` + +Also, there is an API helper: + +```ruby +track_event( + event_name, + user: current_user, + namespace_id: namespace_id, + project_id: project_id +) +``` + ### Frontend tracking Any frontend tracking call automatically passes the values `user.id`, `namespace.id`, and `project.id` from the current context of the page. diff --git a/doc/development/pipelines/internals.md b/doc/development/pipelines/internals.md index df9a9d9c4ad..16d0bfdfa30 100644 --- a/doc/development/pipelines/internals.md +++ b/doc/development/pipelines/internals.md @@ -435,6 +435,8 @@ For this scenario, you have to: - `scripts/merge-simplecov` - `spec/simplecov_env_core.rb` - `spec/simplecov_env.rb` + - `prepare-as-if-foss-env` for: + - `scripts/setup/generate-as-if-foss-env.rb` Additionally, `scripts/utils.sh` is always downloaded from the API when this pattern is used (this file contains the code for `.fast-no-clone-job`). |