Class: Gitlab::Tracking::Destinations::SnowplowMicro

Inherits:
Snowplow
  • Object
show all
Extended by:
Utils::Override
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/tracking/destinations/snowplow_micro.rb

Constant Summary collapse

DEFAULT_URI =
'http://localhost:9090'

Constants inherited from Snowplow

Gitlab::Tracking::Destinations::Snowplow::SNOWPLOW_NAMESPACE

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from Snowplow

#event

Methods inherited from Base

#event

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/gitlab/tracking/destinations/snowplow_micro.rb', line 22

def enabled?
  true
end

#hostnameObject


27
28
29
# File 'lib/gitlab/tracking/destinations/snowplow_micro.rb', line 27

def hostname
  "#{uri.host}:#{uri.port}"
end

#options(group) ⇒ Object


13
14
15
16
17
18
19
# File 'lib/gitlab/tracking/destinations/snowplow_micro.rb', line 13

def options(group)
  super.update(
    protocol: uri.scheme,
    port: uri.port,
    force_secure_tracker: false
  ).transform_keys! { |key| key.to_s.camelize(:lower).to_sym }
end

#uriObject


31
32
33
34
35
36
37
# File 'lib/gitlab/tracking/destinations/snowplow_micro.rb', line 31

def uri
  strong_memoize(:snowplow_uri) do
    uri = URI(ENV['SNOWPLOW_MICRO_URI'] || DEFAULT_URI)
    uri = URI("http://#{ENV['SNOWPLOW_MICRO_URI']}") unless %w[http https].include?(uri.scheme)
    uri
  end
end