Module: Gitlab::Tracking
- Included in:
- ProfilesController, UserSettings::ProfilesController
- Defined in:
- lib/gitlab/tracking.rb,
lib/gitlab/tracking/helpers.rb,
lib/gitlab/tracking/ai_tracking.rb,
lib/gitlab/tracking/event_validator.rb,
lib/gitlab/tracking/event_definition.rb,
lib/gitlab/tracking/standard_context.rb,
lib/gitlab/tracking/destinations/base.rb,
lib/gitlab/tracking/incident_management.rb,
lib/gitlab/tracking/service_ping_context.rb,
lib/gitlab/tracking/destinations/snowplow.rb,
lib/gitlab/tracking/event_definition_validator.rb,
lib/gitlab/tracking/destinations/snowplow_micro.rb,
lib/gitlab/tracking/helpers/weak_password_error_event.rb
Defined Under Namespace
Modules: Destinations, Helpers, IncidentManagement Classes: AiTracking, EventDefinition, EventDefinitionValidator, EventValidator, ServicePingContext, StandardContext
Constant Summary collapse
- InvalidEventError =
Class.new(RuntimeError)
Class Method Summary collapse
- .collector_hostname ⇒ Object
- .enabled? ⇒ Boolean
-
.event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- .micro_verification_enabled? ⇒ Boolean
- .options(group) ⇒ Object
- .snowplow_micro_enabled? ⇒ Boolean
- .tracker ⇒ Object
Class Method Details
.collector_hostname ⇒ Object
40 41 42 |
# File 'lib/gitlab/tracking.rb', line 40 def collector_hostname tracker.hostname end |
.enabled? ⇒ Boolean
11 12 13 |
# File 'lib/gitlab/tracking.rb', line 11 def enabled? tracker.enabled? end |
.event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra) ⇒ Object
rubocop:disable Metrics/ParameterLists
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gitlab/tracking.rb', line 19 def event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra) # rubocop:disable Metrics/ParameterLists action = action.to_s project_id = project.is_a?(Integer) ? project : project&.id contexts = [ Tracking::StandardContext.new( namespace_id: namespace&.id, plan_name: namespace&.actual_plan_name, project_id: project_id, user: user, **extra).to_context, *context ] track_struct_event(tracker, category, action, label: label, property: property, value: value, contexts: contexts) end |
.micro_verification_enabled? ⇒ Boolean
15 16 17 |
# File 'lib/gitlab/tracking.rb', line 15 def micro_verification_enabled? Gitlab::Utils.to_boolean(ENV['VERIFY_TRACKING'], default: false) end |
.options(group) ⇒ Object
36 37 38 |
# File 'lib/gitlab/tracking.rb', line 36 def (group) tracker.(group) end |
.snowplow_micro_enabled? ⇒ Boolean
44 45 46 |
# File 'lib/gitlab/tracking.rb', line 44 def snowplow_micro_enabled? Rails.env.development? || micro_verification_enabled? end |
.tracker ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/gitlab/tracking.rb', line 48 def tracker @tracker ||= if snowplow_micro_enabled? Gitlab::Tracking::Destinations::SnowplowMicro.new else Gitlab::Tracking::Destinations::Snowplow.new end end |