class Sidekiq::Opentsdb::Tags

Public Class Methods

new(options = {}) click to toggle source
# File lib/sidekiq/opentsdb/tags.rb, line 4
def initialize(options = {})
  @options = options
end

Public Instance Methods

to_hash() click to toggle source
# File lib/sidekiq/opentsdb/tags.rb, line 8
def to_hash
  {
    host: Socket.gethostname,
    environment: environment,
    app: app,
  }.delete_if { |k, v| v.nil? }
end

Private Instance Methods

app() click to toggle source
# File lib/sidekiq/opentsdb/tags.rb, line 22
def app
  @options[:app] || rails_app_name
end
environment() click to toggle source
# File lib/sidekiq/opentsdb/tags.rb, line 18
def environment
  @options[:environment] || ENV['RACK_ENV']
end
rails_app_name() click to toggle source
# File lib/sidekiq/opentsdb/tags.rb, line 26
def rails_app_name
  ::Rails.application.class.parent_name if defined?(::Rails)
end