module NewRelic::Agent::TransactionErrorPrimitive
Constants
- CAT_GUID_KEY
- CAT_REFERRING_TRANSACTION_GUID_KEY
- DURATION_KEY
- ERROR_CLASS_KEY
- ERROR_EXPECTED_KEY
- ERROR_MESSAGE_KEY
- GUID_KEY
- NAME_KEY
- PORT_KEY
- PRIORITY_KEY
- SAMPLED_KEY
- SAMPLE_TYPE
- SPAN_ID_KEY
- SYNTHETICS_INITIATOR_KEY
- SYNTHETICS_JOB_ID_KEY
- SYNTHETICS_KEY_PREFIX
- SYNTHETICS_MONITOR_ID_KEY
- SYNTHETICS_PAYLOAD_EXPECTED
- SYNTHETICS_RESOURCE_ID_KEY
- SYNTHETICS_TYPE_KEY
- TIMESTAMP_KEY
- TYPE_KEY
Public Instance Methods
append_cat(payload, sample)
click to toggle source
# File lib/new_relic/agent/transaction_error_primitive.rb, line 99 def append_cat(payload, sample) sample[CAT_GUID_KEY] = payload[:guid] if payload[:guid] sample[CAT_REFERRING_TRANSACTION_GUID_KEY] = payload[:referring_transaction_guid] if payload[:referring_transaction_guid] end
append_synthetics(payload, sample)
click to toggle source
# File lib/new_relic/agent/transaction_error_primitive.rb, line 82 def append_synthetics(payload, sample) return unless payload[:synthetics_job_id] sample[SYNTHETICS_RESOURCE_ID_KEY] = payload[:synthetics_resource_id] if payload[:synthetics_resource_id] sample[SYNTHETICS_JOB_ID_KEY] = payload[:synthetics_job_id] if payload[:synthetics_job_id] sample[SYNTHETICS_MONITOR_ID_KEY] = payload[:synthetics_monitor_id] if payload[:synthetics_monitor_id] sample[SYNTHETICS_TYPE_KEY] = payload[:synthetics_type] if payload[:synthetics_type] sample[SYNTHETICS_INITIATOR_KEY] = payload[:synthetics_initiator] if payload[:synthetics_initiator] payload.each do |k, v| next unless k.to_s.start_with?('synthetics_') && !SYNTHETICS_PAYLOAD_EXPECTED.include?(k) new_key = SYNTHETICS_KEY_PREFIX + NewRelic::LanguageSupport.camelize(k.to_s.gsub('synthetics_', '')) sample[new_key] = v end end
create(noticed_error, payload, span_id)
click to toggle source
# File lib/new_relic/agent/transaction_error_primitive.rb, line 43 def create(noticed_error, payload, span_id) [ intrinsic_attributes_for(noticed_error, payload, span_id), noticed_error.custom_attributes, noticed_error.agent_attributes ] end
intrinsic_attributes_for(noticed_error, payload, span_id)
click to toggle source
# File lib/new_relic/agent/transaction_error_primitive.rb, line 51 def intrinsic_attributes_for(noticed_error, payload, span_id) attrs = { TYPE_KEY => SAMPLE_TYPE, ERROR_CLASS_KEY => noticed_error.exception_class_name, ERROR_MESSAGE_KEY => noticed_error.message, ERROR_EXPECTED_KEY => noticed_error.expected, TIMESTAMP_KEY => noticed_error.timestamp.to_f } attrs[SPAN_ID_KEY] = span_id if span_id # don't use safe navigation - leave off keys with missing values # instead of using nil attrs[PORT_KEY] = noticed_error.request_port if noticed_error.request_port attrs[GUID_KEY] = noticed_error.transaction_id if noticed_error.transaction_id if payload attrs[NAME_KEY] = payload[:name] attrs[DURATION_KEY] = payload[:duration] attrs[SAMPLED_KEY] = payload[:sampled] if payload.key?(:sampled) attrs[PRIORITY_KEY] = payload[:priority] append_synthetics(payload, attrs) append_cat(payload, attrs) DistributedTraceAttributes.copy_to_hash(payload, attrs) PayloadMetricMapping.append_mapped_metrics(payload[:metrics], attrs) else attrs[PRIORITY_KEY] = rand.round(NewRelic::PRIORITY_PRECISION) end attrs end