class Mmtrix::Rack::AgentMiddleware

Attributes

category[R]
target[R]
transaction_options[R]

Public Class Methods

new(app, options={}) click to toggle source
# File lib/mmtrix/rack/agent_middleware.rb, line 16
def initialize(app, options={})
  @app = app
  @category = :middleware
  @target   = self
  @transaction_options = {
    :transaction_name => build_transaction_name
  }
end

Public Instance Methods

build_transaction_name() click to toggle source
# File lib/mmtrix/rack/agent_middleware.rb, line 25
def build_transaction_name
  prefix = ::Mmtrix::Agent::Instrumentation::ControllerInstrumentation::TransactionNamer.prefix_for_category(nil, @category)
  "#{prefix}#{self.class.name}/call"
end
capture_http_response_code(state, result) click to toggle source

If middleware tracing is disabled, we’ll still inject our agent-specific middlewares, and still trace those, but we don’t want to capture HTTP response codes, since middleware that’s outside of ours might change the response code before it goes back to the client.

# File lib/mmtrix/rack/agent_middleware.rb, line 34
def capture_http_response_code(state, result)
  return if Mmtrix::Agent.config[:disable_middleware_instrumentation]
  super
end