Sha256: 705c99b81e7db6fa7acb2c63d959575aabb2ddeaddeedf61d38c0c6879287343

Contents?: true

Size: 896 Bytes

Versions: 40

Compression:

Stored size: 896 Bytes

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

            "#{endpoint.options[:for]} [#{method}] #{path}"
          end

      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
skylight-1.7.2 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.7.1 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.7.0 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.6.1 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.6.0 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.5.1 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.5.0 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.4 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.3 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.2 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.1 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.0 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.0.beta.2 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.4.0.beta lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.3.1 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.3.0 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.2.2 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.2.1 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.2.0 lib/skylight/normalizers/grape/endpoint_run.rb
skylight-1.1.0 lib/skylight/normalizers/grape/endpoint_run.rb