Sha256: b9d549022a2b53584e49922f7e1a4c9a19fd1083f69ccbb8afdbbc8341f82ff9
Contents?: true
Size: 1.06 KB
Versions: 20
Compression:
Stored size: 1.06 KB
Contents
module Skylight module Normalizers module Grape class EndpointRun < Endpoint register "endpoint_run.grape" def normalize(trace, _name, payload) trace.endpoint = get_endpoint_name(payload[:endpoint]) if payload[:endpoint] # We don't necessarily want this to be all instrumented since it's fairly internal. # However, it is a good place to get the endpoint name. :skip end private def get_endpoint_name(endpoint) method = get_method(endpoint) path = get_path(endpoint) namespace = get_namespace(endpoint) if namespace && !namespace.empty? path = "/#{path}" if path[0] != "/" path = "#{namespace}#{path}" end "#{base_app_name(endpoint)} [#{method}] #{path}".strip end def base_app_name(endpoint) ep = endpoint.options[:for] return ep.name if ep.name ep.base.name if ep.respond_to?(:base) && ep.base.respond_to?(:name) end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems