diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /lib/gitlab/tracking | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'lib/gitlab/tracking')
-rw-r--r-- | lib/gitlab/tracking/destinations/snowplow.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/tracking/destinations/snowplow_micro.rb | 11 |
2 files changed, 16 insertions, 9 deletions
diff --git a/lib/gitlab/tracking/destinations/snowplow.rb b/lib/gitlab/tracking/destinations/snowplow.rb index 5596e9acd30..ddcd4693738 100644 --- a/lib/gitlab/tracking/destinations/snowplow.rb +++ b/lib/gitlab/tracking/destinations/snowplow.rb @@ -8,6 +8,8 @@ module Gitlab class Snowplow < Base extend ::Gitlab::Utils::Override + SNOWPLOW_NAMESPACE = 'gl' + override :event def event(category, action, label: nil, property: nil, value: nil, context: nil) return unless enabled? @@ -19,7 +21,7 @@ module Gitlab def options(group) additional_features = Feature.enabled?(:additional_snowplow_tracking, group, type: :ops) { - namespace: Gitlab::Tracking::SNOWPLOW_NAMESPACE, + namespace: SNOWPLOW_NAMESPACE, hostname: hostname, cookie_domain: cookie_domain, app_id: app_id, @@ -28,16 +30,16 @@ module Gitlab }.transform_keys! { |key| key.to_s.camelize(:lower).to_sym } end + def enabled? + Gitlab::CurrentSettings.snowplow_enabled? + end + def hostname Gitlab::CurrentSettings.snowplow_collector_hostname end private - def enabled? - Gitlab::Tracking.enabled? - end - def app_id Gitlab::CurrentSettings.snowplow_app_id end @@ -54,7 +56,7 @@ module Gitlab @tracker ||= SnowplowTracker::Tracker.new( emitter, SnowplowTracker::Subject.new, - Gitlab::Tracking::SNOWPLOW_NAMESPACE, + SNOWPLOW_NAMESPACE, app_id ) end diff --git a/lib/gitlab/tracking/destinations/snowplow_micro.rb b/lib/gitlab/tracking/destinations/snowplow_micro.rb index b818d349a6d..3553efba1e1 100644 --- a/lib/gitlab/tracking/destinations/snowplow_micro.rb +++ b/lib/gitlab/tracking/destinations/snowplow_micro.rb @@ -15,7 +15,12 @@ module Gitlab protocol: uri.scheme, port: uri.port, force_secure_tracker: false - ) + ).transform_keys! { |key| key.to_s.camelize(:lower).to_sym } + end + + override :enabled? + def enabled? + true end override :hostname @@ -23,8 +28,6 @@ module Gitlab "#{uri.host}:#{uri.port}" end - private - def uri strong_memoize(:snowplow_uri) do uri = URI(ENV['SNOWPLOW_MICRO_URI'] || DEFAULT_URI) @@ -33,6 +36,8 @@ module Gitlab end end + private + override :cookie_domain def cookie_domain '.gitlab.com' |