Sha256: ae93ecccd934af29911bea7c0a574ffb17ef300aea42e3b12ed61f981783d341
Contents?: true
Size: 652 Bytes
Versions: 1
Compression:
Stored size: 652 Bytes
Contents
require 'grape' require 'active_support' module Appsignal module Grape class Middleware < ::Grape::Middleware::Base def initialize(app) @app = app end def call(env) req = ::Rack::Request.new(env) request_path = env['api.endpoint'].routes.first.route_path[1..-1].gsub(/\(\.:format\)\z/, "") metric_name = "process_action.grape" action = "#{req.request_method}::#{request_path}" ActiveSupport::Notifications.instrument(metric_name, { method: req.request_method, path: request_path, action: action } ) do |payload| @app.call(env) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-appsignal-0.0.4 | lib/grape-appsignal/middleware.rb |