Class: NewRelic::Agent::CrossAppPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/distributed_tracing/cross_app_payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, transaction, transaction_info) ⇒ CrossAppPayload

Returns a new instance of CrossAppPayload.



10
11
12
13
14
15
16
17
18
19
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 10

def initialize(id, transaction, transaction_info)
  @id = id
  @transaction = transaction

  transaction_info ||= []
  @referring_guid = transaction_info[0]
  # unused_flag        = transaction_info[1]
  @referring_trip_id = string_or_false_for(transaction_info[2])
  @referring_path_hash = string_or_false_for(transaction_info[3])
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 8

def id
  @id
end

#referring_guidObject (readonly)

Returns the value of attribute referring_guid.



8
9
10
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 8

def referring_guid
  @referring_guid
end

#referring_path_hashObject (readonly)

Returns the value of attribute referring_path_hash.



8
9
10
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 8

def referring_path_hash
  @referring_path_hash
end

#referring_trip_idObject (readonly)

Returns the value of attribute referring_trip_id.



8
9
10
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 8

def referring_trip_id
  @referring_trip_id
end

#transactionObject (readonly)

Returns the value of attribute transaction.



8
9
10
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 8

def transaction
  @transaction
end

Instance Method Details

#as_json_array(content_length) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/new_relic/agent/distributed_tracing/cross_app_payload.rb', line 21

def as_json_array(content_length)
  queue_time_in_seconds = [transaction.queue_time, 0.0].max
  start_time_in_seconds = [transaction.start_time, 0.0].max
  app_time_in_seconds = Process.clock_gettime(Process::CLOCK_REALTIME) - start_time_in_seconds

  [
    NewRelic::Agent.config[:cross_process_id],
    transaction.best_name,
    queue_time_in_seconds,
    app_time_in_seconds,
    content_length,
    transaction.guid,
    false
  ]
end