Class: D13n::Rack::D13nMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/d13n/rack/d13n_middleware.rb

Direct Known Subclasses

MetricMiddleware

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ D13nMiddleware

Returns a new instance of D13nMiddleware.



6
7
8
9
10
11
12
13
# File 'lib/d13n/rack/d13n_middleware.rb', line 6

def initialize(app, options={})
  @app = app
  @category = :middleware
  @target  = self
  @stream_options = {
    :stream_name => build_stream_name
  }
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



5
6
7
# File 'lib/d13n/rack/d13n_middleware.rb', line 5

def category
  @category
end

#stream_optionsObject (readonly)

Returns the value of attribute stream_options.



5
6
7
# File 'lib/d13n/rack/d13n_middleware.rb', line 5

def stream_options
  @stream_options
end

Instance Method Details

#build_stream_nameObject



15
16
17
18
# File 'lib/d13n/rack/d13n_middleware.rb', line 15

def build_stream_name
  prefix = ::D13n::Metric::Instrumentation::ControllerInstrumentation::StreamNamer.prefix_for_category(nil, @category)
  "#{prefix}.#{self.class.name}.call"
end