module NewRelic::Agent::TransactionEventPrimitive
Constants
- APDEX_PERF_ZONE_KEY
- CAT_ALTERNATE_PATH_HASHES_KEY
- CAT_PATH_HASH_KEY
- CAT_REFERRING_PATH_HASH_KEY
- CAT_TRIP_ID_KEY
- COMMA
- DURATION_KEY
- EMPTY_HASH
To avoid allocations when we have empty custom or agent attributes
- ERROR_KEY
- GUID_KEY
- NAME_KEY
- REFERRING_TRANSACTION_GUID_KEY
- SAMPLE_TYPE
The type field of the sample
- SYNTHETICS_JOB_ID_KEY
- SYNTHETICS_MONITOR_ID_KEY
- SYNTHETICS_RESOURCE_ID_KEY
- TIMESTAMP_KEY
- TYPE_KEY
Strings for static keys of the sample structure
Public Instance Methods
create(payload)
click to toggle source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 40 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] } NewRelic::Agent::PayloadMetricMapping.append_mapped_metrics(payload[:metrics], intrinsics) append_optional_attributes(intrinsics, payload) attributes = payload[:attributes] [intrinsics, custom_attributes(attributes), agent_attributes(attributes)] end
Private Instance Methods
agent_attributes(attributes)
click to toggle source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 95 def agent_attributes attributes if attributes result = attributes.agent_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_EVENTS) result.freeze else EMPTY_HASH end end
append_cat_alternate_path_hashes(sample, payload)
click to toggle source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 74 def append_cat_alternate_path_hashes(sample, payload) if payload.include?(:cat_alternate_path_hashes) sample[CAT_ALTERNATE_PATH_HASHES_KEY] = payload[:cat_alternate_path_hashes].sort.join(COMMA) end end
append_optional_attributes(sample, payload)
click to toggle source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 59 def append_optional_attributes(sample, payload) optionally_append(GUID_KEY, :guid, sample, payload) optionally_append(REFERRING_TRANSACTION_GUID_KEY, :referring_transaction_guid, sample, payload) optionally_append(CAT_TRIP_ID_KEY, :cat_trip_id, sample, payload) optionally_append(CAT_PATH_HASH_KEY, :cat_path_hash, sample, payload) optionally_append(CAT_REFERRING_PATH_HASH_KEY, :cat_referring_path_hash, sample, payload) optionally_append(APDEX_PERF_ZONE_KEY, :apdex_perf_zone, sample, payload) optionally_append(SYNTHETICS_RESOURCE_ID_KEY, :synthetics_resource_id, sample, payload) optionally_append(SYNTHETICS_JOB_ID_KEY, :synthetics_job_id, sample, payload) optionally_append(SYNTHETICS_MONITOR_ID_KEY, :synthetics_monitor_id, sample, payload) append_cat_alternate_path_hashes(sample, payload) end
custom_attributes(attributes)
click to toggle source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 86 def custom_attributes attributes if attributes result = attributes.custom_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_EVENTS) result.freeze else EMPTY_HASH end end
optionally_append(sample_key, payload_key, sample, payload)
click to toggle source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 80 def optionally_append(sample_key, payload_key, sample, payload) if payload.include?(payload_key) sample[sample_key] = string(payload[payload_key]) end end