Sha256: 834fe613428121ce86c5e70e1832c66734e045b503f15e396e91a693b7f273f8
Contents?: true
Size: 728 Bytes
Versions: 1
Compression:
Stored size: 728 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) method = env['REQUEST_METHOD'] metric_path = env['PATH_INFO'].nil? ? ".api" : env['PATH_INFO'].gsub("/", ".") request_path = env['api.endpoint'].routes.first.route_path[1..-1].gsub(/\(\.:format\)\z/, "") metric_name = "process_action.grape#{metric_path}" action = "#{method}#{metric_path}" ActiveSupport::Notifications.instrument(metric_name, { method: 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.1.0 | lib/grape-appsignal/middleware.rb |