Class: Datadog::Core::Telemetry::V1::TelemetryRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/telemetry/v1/telemetry_request.rb

Overview

Describes attributes for telemetry API request

Constant Summary collapse

ERROR_NIL_API_VERSION_MESSAGE =
':api_version must not be nil'.freeze
ERROR_NIL_APPLICATION_MESSAGE =
':application must not be nil'.freeze
ERROR_NIL_HOST_MESSAGE =
':host must not be nil'.freeze
ERROR_NIL_PAYLOAD_MESSAGE =
':payload must not be nil'.freeze
ERROR_NIL_REQUEST_TYPE_MESSAGE =
':request_type must not be nil'.freeze
ERROR_NIL_RUNTIME_ID_MESSAGE =
':runtime_id must not be nil'.freeze
ERROR_NIL_SEQ_ID_MESSAGE =
':seq_id must not be nil'.freeze
ERROR_NIL_TRACER_TIME_MESSAGE =
':tracer_time must not be nil'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_version:, application:, host:, payload:, request_type:, runtime_id:, seq_id:, tracer_time:, debug: nil, session_id: nil) ⇒ TelemetryRequest

Returns a new instance of TelemetryRequest.

Parameters:

  • api_version (String)

    Requested API version, ‘v1`

  • application (Telemetry::V1::Application)

    Object that contains information about the environment of the application

  • host (Telemetry::V1::Host)

    Object that holds host related information

  • payload (Telemetry::V1::AppEvent)

    The payload of the request, type impacted by :request_type

  • request_type (String)

    Requested API function impacting the Payload type, ‘app-started`

  • runtime_id (String)

    V4 UUID that represents a tracer session

  • seq_id (Integer)

    Counter that should be auto incremented every time an API call is being made

  • tracer_time (Integer)

    Unix timestamp (in seconds) of when the message is being sent

  • debug (Boolean) (defaults to: nil)

    Flag that enables payload debug mode

  • session_id (String) (defaults to: nil)

    V4 UUID that represents the session of the top level tracer process, often same\ as runtime_id



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 40

def initialize(
  api_version:, application:, host:, payload:, request_type:, runtime_id:, seq_id:, tracer_time:,
  debug: nil, session_id: nil
)
  validate(
    api_version: api_version,
    application: application,
    host: host,
    payload: payload,
    request_type: request_type,
    runtime_id: runtime_id,
    seq_id: seq_id,
    tracer_time: tracer_time
  )
  @api_version = api_version
  @application = application
  @debug = debug
  @host = host
  @payload = payload
  @request_type = request_type
  @runtime_id = runtime_id
  @seq_id = seq_id
  @session_id = session_id
  @tracer_time = tracer_time
end

Instance Attribute Details

#api_versionObject (readonly)

Returns the value of attribute api_version.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def api_version
  @api_version
end

#applicationObject (readonly)

Returns the value of attribute application.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def application
  @application
end

#debugObject (readonly)

Returns the value of attribute debug.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def debug
  @debug
end

#hostObject (readonly)

Returns the value of attribute host.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def host
  @host
end

#payloadObject (readonly)

Returns the value of attribute payload.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def payload
  @payload
end

#request_typeObject (readonly)

Returns the value of attribute request_type.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def request_type
  @request_type
end

#runtime_idObject (readonly)

Returns the value of attribute runtime_id.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def runtime_id
  @runtime_id
end

#seq_idObject (readonly)

Returns the value of attribute seq_id.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def seq_id
  @seq_id
end

#session_idObject (readonly)

Returns the value of attribute session_id.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def session_id
  @session_id
end

#tracer_timeObject (readonly)

Returns the value of attribute tracer_time.



16
17
18
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 16

def tracer_time
  @tracer_time
end

Instance Method Details

#to_hObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/datadog/core/telemetry/v1/telemetry_request.rb', line 66

def to_h
  {
    api_version: @api_version,
    application: @application.to_h,
    debug: @debug,
    host: @host.to_h,
    payload: @payload.to_h,
    request_type: @request_type,
    runtime_id: @runtime_id,
    seq_id: @seq_id,
    session_id: @session_id,
    tracer_time: @tracer_time
  }
end