Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-20 18:10:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-20 18:10:24 +0300
commitc70a70ea42e3f8742623e690dcd74d17c7c3b0ed (patch)
treee60d0a3728112b773e1330a9926e1a6c6d058d53 /lib/gitlab/tracking
parentb70394d26f7349ecfa4a740d7d7b115d738eff8e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/tracking')
-rw-r--r--lib/gitlab/tracking/standard_context.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/gitlab/tracking/standard_context.rb b/lib/gitlab/tracking/standard_context.rb
index 7902f96dfa6..fe5669be014 100644
--- a/lib/gitlab/tracking/standard_context.rb
+++ b/lib/gitlab/tracking/standard_context.rb
@@ -8,7 +8,8 @@ module Gitlab
def initialize(namespace: nil, project: nil, user: nil, **extra)
@namespace = namespace
- @plan = @namespace&.actual_plan_name
+ @plan = namespace&.actual_plan_name
+ @project = project
@extra = extra
end
@@ -34,14 +35,29 @@ module Gitlab
private
+ attr_accessor :namespace, :project, :extra, :plan
+
def to_h
{
environment: environment,
source: source,
- plan: @plan,
- extra: @extra
+ plan: plan,
+ extra: extra
+ }.merge(project_and_namespace)
+ end
+
+ def project_and_namespace
+ return {} unless ::Feature.enabled?(:add_namespace_and_project_to_snowplow_tracking, default_enabled: :yaml)
+
+ {
+ namespace_id: namespace&.id,
+ project_id: project_id
}
end
+
+ def project_id
+ project.is_a?(Integer) ? project : project&.id
+ end
end
end
end