Commit de2a0cb9 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch...

Merge branch '336665-feature-flag-rollout-of-add_actor_based_user_to_snowplow_tracking' into 'master'

[Feature flag] Rollout of: `add_actor_based_user_to_snowplow_tracking` and `add_namespace_and_project_to_snowplow_tracking`

See merge request gitlab-org/gitlab!73677
parents d204ccdf 57c88078
---
name: add_actor_based_user_to_snowplow_tracking
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71353
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338150
milestone: '14.4'
type: development
group: group::product intelligence
default_enabled: false
---
name: add_namespace_and_project_to_snowplow_tracking
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68277
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338670
milestone: '14.3'
type: development
group: group::product intelligence
default_enabled: false
......@@ -43,15 +43,8 @@ module Gitlab
environment: environment,
source: source,
plan: plan,
extra: extra
}.merge(project_and_namespace)
.merge(user_data)
end
def project_and_namespace
return {} unless ::Feature.enabled?(:add_namespace_and_project_to_snowplow_tracking, default_enabled: :yaml)
{
extra: extra,
user_id: user&.id,
namespace_id: namespace&.id,
project_id: project_id
}
......@@ -60,10 +53,6 @@ module Gitlab
def project_id
project.is_a?(Integer) ? project : project&.id
end
def user_data
::Feature.enabled?(:add_actor_based_user_to_snowplow_tracking, user) ? { user_id: user&.id } : {}
end
end
end
end
......@@ -99,25 +99,5 @@ RSpec.describe Gitlab::Tracking::StandardContext do
it 'accepts just project id as integer' do
expect { described_class.new(project: 1).to_context }.not_to raise_error
end
context 'without add_namespace_and_project_to_snowplow_tracking feature' do
before do
stub_feature_flags(add_namespace_and_project_to_snowplow_tracking: false)
end
it 'does not contain project or namespace ids' do
expect(snowplow_context.to_json[:data].keys).not_to include(:project_id, :namespace_id)
end
end
context 'without add_actor_based_user_to_snowplow_tracking feature' do
before do
stub_feature_flags(add_actor_based_user_to_snowplow_tracking: false)
end
it 'does not contain user_id' do
expect(snowplow_context.to_json[:data].keys).not_to include(:user_id)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment