Class: MetricsAdapter::Trackers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/metrics_adapter/trackers/base.rb

Direct Known Subclasses

SlowRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/metrics_adapter/trackers/base.rb', line 11

def initialize(event)
  adapter_name = MetricsAdapter.adapter.to_s.classify
  @adapter = "MetricsAdapter::Adapters::#{adapter_name}".constantize.new(
    MetricsAdapter.adapter_options
  )
  @event = event
  @extra_attributes = ::MetricsAdapter.extra_attributes
  @logger = ::MetricsAdapter.logger
  @metric_name = self.class.name.demodulize.underscore
  @conditional = ::MetricsAdapter.conditionals[@metric_name.to_sym]
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



4
5
6
# File 'lib/metrics_adapter/trackers/base.rb', line 4

def adapter
  @adapter
end

#conditionalObject (readonly)

Returns the value of attribute conditional.



4
5
6
# File 'lib/metrics_adapter/trackers/base.rb', line 4

def conditional
  @conditional
end

#eventObject (readonly)

Returns the value of attribute event.



4
5
6
# File 'lib/metrics_adapter/trackers/base.rb', line 4

def event
  @event
end

#extra_attributesObject (readonly)

Returns the value of attribute extra_attributes.



4
5
6
# File 'lib/metrics_adapter/trackers/base.rb', line 4

def extra_attributes
  @extra_attributes
end

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/metrics_adapter/trackers/base.rb', line 4

def logger
  @logger
end

#metric_nameObject (readonly)

Returns the value of attribute metric_name.



4
5
6
# File 'lib/metrics_adapter/trackers/base.rb', line 4

def metric_name
  @metric_name
end

Instance Method Details

#callObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/metrics_adapter/trackers/base.rb', line 23

def call
  raise NotImplementedError
end