Class: Datadog::DataStreams::Transport::HTTP::Stats::API::Endpoint

Inherits:
Core::Transport::HTTP::API::Endpoint show all
Defined in:
lib/datadog/data_streams/transport/http/stats.rb

Overview

Endpoint for submitting DSM stats data

Instance Attribute Summary

Attributes inherited from Core::Transport::HTTP::API::Endpoint

#path, #verb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Endpoint

Returns a new instance of Endpoint.



25
26
27
# File 'lib/datadog/data_streams/transport/http/stats.rb', line 25

def initialize(path)
  super(:post, path)
end

Instance Method Details

#call(env, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/datadog/data_streams/transport/http/stats.rb', line 29

def call(env, &block)
  # Build request
  env.verb = verb
  env.path = path
  env.body = env.request.parcel.data
  if (content_type = env.request.parcel.content_type)
    env.headers['content-type'] = content_type
  end
  if (content_encoding = env.request.parcel.content_encoding)
    env.headers['content-encoding'] = content_encoding
  end

  # Send request
  http_response = yield(env)

  # Build response
  Response.new(http_response)
end

#encoderObject



48
49
50
51
# File 'lib/datadog/data_streams/transport/http/stats.rb', line 48

def encoder
  # DSM handles encoding in the transport layer
  nil
end