Class: Karafka::Web::Tracking::Sampler

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/web/tracking/sampler.rb

Overview

Base sampler with some basic info collectors This sampler should store only collectors that can be used for producers, consumers and the Web-UI itself. All specific to a given aspect of operations should be moved out.

Direct Known Subclasses

Consumers::Sampler, Producers::Sampler

Instance Method Summary collapse

Instance Method Details

#karafka_core_versionString

Returns Karafka::Core version.

Returns:

  • (String)

    Karafka::Core version



41
42
43
# File 'lib/karafka/web/tracking/sampler.rb', line 41

def karafka_core_version
  ::Karafka::Core::VERSION
end

#karafka_versionString

Returns Karafka version.

Returns:

  • (String)

    Karafka version



31
32
33
# File 'lib/karafka/web/tracking/sampler.rb', line 31

def karafka_version
  ::Karafka::VERSION
end

#karafka_web_versionString

Returns Karafka Web UI version.

Returns:

  • (String)

    Karafka Web UI version



36
37
38
# File 'lib/karafka/web/tracking/sampler.rb', line 36

def karafka_web_version
  ::Karafka::Web::VERSION
end

#librdkafka_versionString

Returns librdkafka version.

Returns:

  • (String)

    librdkafka version



51
52
53
# File 'lib/karafka/web/tracking/sampler.rb', line 51

def librdkafka_version
  ::Rdkafka::LIBRDKAFKA_VERSION
end

#process_idString

Returns Unique process identifier.

Returns:

  • (String)

    Unique process identifier



11
12
13
# File 'lib/karafka/web/tracking/sampler.rb', line 11

def process_id
  @process_id ||= "#{Socket.gethostname}:#{::Process.pid}:#{SecureRandom.hex(6)}"
end

#rdkafka_versionString

Returns rdkafka version.

Returns:

  • (String)

    rdkafka version



46
47
48
# File 'lib/karafka/web/tracking/sampler.rb', line 46

def rdkafka_version
  ::Rdkafka::VERSION
end

#ruby_versionString

Returns currently used ruby version with details.

Returns:

  • (String)

    currently used ruby version with details



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/karafka/web/tracking/sampler.rb', line 16

def ruby_version
  return @ruby_version if @ruby_version

  if defined?(JRUBY_VERSION)
    revision = JRUBY_REVISION.to_s
    version = JRUBY_VERSION
  else
    revision = RUBY_REVISION.to_s
    version = RUBY_ENGINE_VERSION
  end

  @ruby_version = "#{RUBY_ENGINE} #{version}-#{RUBY_PATCHLEVEL} #{revision[0..5]}"
end

#waterdrop_versionString

Returns WaterDrop version.

Returns:

  • (String)

    WaterDrop version



56
57
58
# File 'lib/karafka/web/tracking/sampler.rb', line 56

def waterdrop_version
  ::WaterDrop::VERSION
end