module NewRelic::Agent::TransactionEventPrimitive
Constants
- APDEX_PERF_ZONE_KEY
- CAT_ALTERNATE_PATH_HASHES_KEY
- CAT_PATH_HASH_KEY
- CAT_REFERRING_PATH_HASH_KEY
- COMMA
- DURATION_KEY
- ERROR_KEY
- GUID_KEY
- NAME_KEY
- PRIORITY_KEY
- REFERRING_TRANSACTION_GUID_KEY
- SAMPLED_KEY
- SAMPLE_TYPE
-
The type field of the sample
- 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
-
Strings for static keys of the sample structure
Public Instance Methods
Source
# 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
Private Instance Methods
Source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 117 def agent_attributes(attributes) if attributes result = attributes.agent_attributes_for(AttributeFilter::DST_TRANSACTION_EVENTS) result.freeze else NewRelic::EMPTY_HASH end end
Source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 96 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
Source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 70 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_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) optionally_append(SYNTHETICS_TYPE_KEY, :synthetics_type, sample, payload) optionally_append(SYNTHETICS_INITIATOR_KEY, :synthetics_initiator, sample, payload) append_synthetics_info_attributes(sample, payload) append_cat_alternate_path_hashes(sample, payload) end
Source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 85 def append_synthetics_info_attributes(sample, payload) return unless payload.include?(:synthetics_job_id) 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.to_s end end
Source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 108 def custom_attributes(attributes) if attributes result = attributes.custom_attributes_for(AttributeFilter::DST_TRANSACTION_EVENTS) result.freeze else NewRelic::EMPTY_HASH end end
Source
# File lib/new_relic/agent/transaction_event_primitive.rb, line 102 def optionally_append(sample_key, payload_key, sample, payload) if payload.include?(payload_key) sample[sample_key] = string(payload[payload_key]) end end