Class: NewRelic::TelemetrySdk::TraceClient

Inherits:
Client
  • Object
show all
Defined in:
lib/newrelic/telemetry_sdk/clients/trace_client.rb

Overview

The TraceClient sends Span data to the Trace API host endpoint.

Examples:

trace_client = NewRelic::TelemetrySdk::TraceClient.new

span = NewRelic::TelemetrySdk::Span.new(
  id: random_id(16),
  trace_id: random_id(32),
  start_time: Time.now,
  name: "Net::HTTP#get"
)
trace_client.report span

Instance Method Summary collapse

Methods inherited from Client

#add_user_agent_product, #report, #report_batch

Methods included from Logger

#clear_already_logged, #log_error, #log_once, logger, #logger, logger=, #logger=

Constructor Details

#initialize(host: trace_api_host) ⇒ TraceClient

Returns a new instance of TraceClient.



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/newrelic/telemetry_sdk/clients/trace_client.rb', line 24

def initialize host: trace_api_host
  super host: host,
        path: '/trace/v1',
        headers: {
          :'Content-Type' => 'application/json',
          :'Api-Key' => api_insert_key,
          :'Data-Format' => 'newrelic',
          :'Data-Format-Version' => '1'
        },
        payload_type: :spans
end