Sha256: 09c57504c68acc7c06d5dbc9f8f06aada95934185f333ba44b31f3fa4828ba76
Contents?: true
Size: 1.06 KB
Versions: 56
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Appsignal module Rack # @api public class GrapeMiddleware < Appsignal::Rack::AbstractMiddleware # @api private def initialize(app, options = {}) options[:instrument_event_name] = "process_request.grape" options[:report_errors] = lambda { |env| !env["grape.skip_appsignal_error"] } super end private def add_transaction_metadata_after(transaction, request) endpoint = request.env["api.endpoint"] unless endpoint&.options super return end options = endpoint.options request_method = options[:method].first.to_s.upcase klass = options[:for] namespace = endpoint.namespace namespace = "" if namespace == "/" path = options[:path].first.to_s path = "/#{path}" if path[0] != "/" path = "#{namespace}#{path}" transaction.set_action_if_nil("#{request_method}::#{klass}##{path}") super transaction.set_metadata("path", path) end end end end
Version data entries
56 entries across 56 versions & 1 rubygems