Module: NewRelic::Agent::TransactionEventPrimitive

Extended by:
TransactionEventPrimitive
Includes:
Coerce
Included in:
TransactionEventPrimitive
Defined in:
lib/new_relic/agent/transaction_event_primitive.rb

Constant Summary collapse

COMMA =
','
SAMPLE_TYPE =

The type field of the sample

'Transaction'
TYPE_KEY =

Strings for static keys of the sample structure

'type'
TIMESTAMP_KEY =
'timestamp'
NAME_KEY =
'name'
DURATION_KEY =
'duration'
ERROR_KEY =
'error'
SAMPLED_KEY =
'sampled'
PRIORITY_KEY =
'priority'
GUID_KEY =
'nr.guid'
REFERRING_TRANSACTION_GUID_KEY =
'nr.referringTransactionGuid'
CAT_PATH_HASH_KEY =
'nr.pathHash'
CAT_REFERRING_PATH_HASH_KEY =
'nr.referringPathHash'
CAT_ALTERNATE_PATH_HASHES_KEY =
'nr.alternatePathHashes'
APDEX_PERF_ZONE_KEY =
'nr.apdexPerfZone'
SYNTHETICS_RESOURCE_ID_KEY =
'nr.syntheticsResourceId'
SYNTHETICS_JOB_ID_KEY =
'nr.syntheticsJobId'
SYNTHETICS_MONITOR_ID_KEY =
'nr.syntheticsMonitorId'
SYNTHETICS_TYPE_KEY =
'nr.syntheticsType'
SYNTHETICS_INITIATOR_KEY =
'nr.syntheticsInitiator'
SYNTHETICS_KEY_PREFIX =
'nr.synthetics'
SYNTHETICS_PAYLOAD_EXPECTED =
[:synthetics_resource_id, :synthetics_job_id, :synthetics_monitor_id, :synthetics_type, :synthetics_initiator]

Instance Method Summary collapse

Methods included from Coerce

boolean_int!, float, float!, int, int!, int_or_nil, log_failure, scalar, string, value_or_nil

Instance Method Details

#create(payload) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/new_relic/agent/transaction_event_primitive.rb', line 47

def create(payload)
  intrinsics = {
    TIMESTAMP_KEY => float(payload[:start_timestamp]),
    NAME_KEY => string(payload[:name]),
    DURATION_KEY => float(payload[:duration]),
    TYPE_KEY => SAMPLE_TYPE,
    ERROR_KEY => payload[:error],
    PRIORITY_KEY => payload[:priority]
  }

  intrinsics[SAMPLED_KEY] = payload[:sampled] if payload.key?(:sampled)

  PayloadMetricMapping.append_mapped_metrics(payload[:metrics], intrinsics)
  append_optional_attributes(intrinsics, payload)
  DistributedTraceAttributes.copy_to_hash(payload, intrinsics)

  attributes = payload[:attributes]

  [intrinsics, custom_attributes(attributes), agent_attributes(attributes)]
end