Sha256: 6a4b7606cecf06ec9f221686db8e33a70e99f7fece3f73f014690a91c1d875b2
Contents?: true
Size: 567 Bytes
Versions: 1
Compression:
Stored size: 567 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 = "grape.api" ActiveSupport::Notifications.instrument(metric_name, { method: req.request_method, path: request_path } ) 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.2 | lib/grape-appsignal/middleware.rb |