Sha256: 5a90b14d626e8aa7fb5e7e14a3f9f2581c4cde3a8df87b0e17c718a2f7c97655

Contents?: true

Size: 1005 Bytes

Versions: 4

Compression:

Stored size: 1005 Bytes

Contents

# typed: true

require 'ddtrace/transport/http/api/spec'

module Datadog
  module Profiling
    module Transport
      module HTTP
        module API
          # API specification for profiling
          class Spec < Datadog::Transport::HTTP::API::Spec
            attr_accessor \
              :profiles

            def send_profiling_flush(env, &block)
              raise NoProfilesEndpointDefinedError, self if profiles.nil?

              profiles.call(env, &block)
            end

            def encoder
              profiles.encoder
            end

            # Raised when profiles sent but no profiles endpoint is defined
            class NoProfilesEndpointDefinedError < StandardError
              attr_reader :spec

              def initialize(spec)
                @spec = spec
              end

              def message
                'No profiles endpoint is defined for API specification!'
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddtrace-1.2.0 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.1.0 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.0.0 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.0.0.beta2 lib/datadog/profiling/transport/http/api/spec.rb