module NewRelic::Agent::TransactionErrorPrimitive

Constants

DURATION_KEY
ERROR_CLASS_KEY
ERROR_MESSAGE_KEY
GUID_KEY
NAME_KEY
PORT_KEY
REFERRING_TRANSACTION_GUID_KEY
SAMPLE_TYPE
SYNTHETICS_JOB_ID_KEY
SYNTHETICS_MONITOR_ID_KEY
SYNTHETICS_RESOURCE_ID_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 65
def append_cat payload, sample
  sample[GUID_KEY] = payload[:guid] if payload[:guid]
  sample[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 59
def append_synthetics payload, sample
  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]
end
create(noticed_error, payload) click to toggle source
# File lib/new_relic/agent/transaction_error_primitive.rb, line 30
def create noticed_error, payload
  [
    intrinsic_attributes_for(noticed_error, payload),
    noticed_error.custom_attributes,
    noticed_error.agent_attributes
  ]
end
intrinsic_attributes_for(noticed_error, payload) click to toggle source
# File lib/new_relic/agent/transaction_error_primitive.rb, line 38
def intrinsic_attributes_for noticed_error, payload
  attrs = {
    TYPE_KEY => SAMPLE_TYPE,
    ERROR_CLASS_KEY => noticed_error.exception_class_name,
    ERROR_MESSAGE_KEY => noticed_error.message,
    TIMESTAMP_KEY => noticed_error.timestamp.to_f
  }

  attrs[PORT_KEY] = noticed_error.request_port if noticed_error.request_port

  if payload
    attrs[NAME_KEY] = payload[:name]
    attrs[DURATION_KEY] = payload[:duration]
    append_synthetics payload, attrs
    append_cat payload, attrs
    PayloadMetricMapping.append_mapped_metrics payload[:metrics], attrs
  end

  attrs
end