Sha256: b9f6fa9d4cf4aede5397d138b275c35315455adb80a4bc5f4a61710302edbc6a

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

# typed: true

require_relative '../../../../../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

7 entries across 7 versions & 1 rubygems

Version Path
ddtrace-1.5.2 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.5.1 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.5.0 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.4.2 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.4.1 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.4.0 lib/datadog/profiling/transport/http/api/spec.rb
ddtrace-1.3.0 lib/datadog/profiling/transport/http/api/spec.rb