Module: OneApm::Transaction::TransactionFinishAppend

Included in:
OneApm::Transaction
Defined in:
lib/one_apm/transaction/transaction_finish_append.rb

Instance Method Summary collapse

Instance Method Details

#append_apdex_perf_zone(duration, payload) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 29

def append_apdex_perf_zone(duration, payload)
  return unless recording_web_transaction?

  bucket = apdex_bucket(duration)
  bucket_str = case bucket
  when :apdex_s then Transaction::OA_APDEX_S
  when :apdex_t then Transaction::OA_APDEX_T
  when :apdex_f then Transaction::OA_APDEX_F
  else nil
  end
  payload[:apdex_perf_zone] = bucket_str if bucket_str
end

#append_cat_info(state, duration, payload) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 7

def append_cat_info(state, duration, payload)
  return unless include_guid?(state, duration)
  payload[:guid] = guid

  return unless state.is_cross_app?
  trip_id             = cat_trip_id(state)
  path_hash           = cat_path_hash(state)
  referring_path_hash = cat_referring_path_hash(state)

  payload[:cat_trip_id]             = trip_id             if trip_id
  payload[:cat_referring_path_hash] = referring_path_hash if referring_path_hash

  if path_hash
    payload[:cat_path_hash] = path_hash

    alternate_path_hashes = cat_path_hashes - [path_hash]
    unless alternate_path_hashes.empty?
      payload[:cat_alternate_path_hashes] = alternate_path_hashes
    end
  end
end

#append_http_response_code(payload) ⇒ Object



49
50
51
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 49

def append_http_response_code(payload)
  payload[:http_response_code] = http_response_code if http_response_code
end

#append_metric_ids_to(payload) ⇒ Object



61
62
63
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 61

def append_metric_ids_to(payload)
  payload[:metric_ids] = agent.service.metric_id_cache if agent.service
end

#append_referring_transaction_guid_to(state, payload) ⇒ Object



42
43
44
45
46
47
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 42

def append_referring_transaction_guid_to(state, payload)
  referring_guid = OneApm::Manager.agent.cross_app_monitor.client_referring_transaction_guid(state)
  if referring_guid
    payload[:referring_transaction_guid] = referring_guid
  end
end

#append_synthetics_to(state, payload) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 53

def append_synthetics_to(state, payload)
  return unless is_synthetics_request?

  payload[:synthetics_resource_id] = synthetics_resource_id
  payload[:synthetics_job_id]      = synthetics_job_id
  payload[:synthetics_monitor_id]  = synthetics_monitor_id
end

#include_guid?(state, duration) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/one_apm/transaction/transaction_finish_append.rb', line 65

def include_guid?(state, duration)
  state.is_cross_app? || is_synthetics_request?
end