Class: Sentry::TransactionEvent
- Inherits:
-
Event
- Object
- Event
- Sentry::TransactionEvent
show all
- Defined in:
- lib/sentry/transaction_event.rb
Overview
TransactionEvent represents events that carry transaction data (type: “transaction”).
Constant Summary
collapse
- TYPE =
"transaction"
Constants inherited
from Event
Event::MAX_MESSAGE_SIZE_IN_BYTES, Event::SERIALIZEABLE_ATTRIBUTES, Event::SKIP_INSPECTION_ATTRIBUTES, Event::WRITER_ATTRIBUTES
Instance Attribute Summary collapse
Attributes inherited from Event
#attachments, #dynamic_sampling_context, #request
Instance Method Summary
collapse
Methods inherited from Event
#configuration, #level=, #rack_env=, #timestamp=, #to_json_compatible
Constructor Details
#initialize(transaction:, **options) ⇒ TransactionEvent
Returns a new instance of TransactionEvent.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/sentry/transaction_event.rb', line 23
def initialize(transaction:, **options)
super(**options)
self.transaction = transaction.name
self.transaction_info = { source: transaction.source }
self.contexts.merge!(transaction.contexts)
self.contexts.merge!(trace: transaction.get_trace_context)
self.timestamp = transaction.timestamp
self.start_timestamp = transaction.start_timestamp
self.tags = transaction.tags
self.dynamic_sampling_context = transaction.get_baggage.dynamic_sampling_context
self.measurements = transaction.measurements
self.metrics_summary = transaction.metrics_summary
finished_spans = transaction.span_recorder.spans.select { |span| span.timestamp && span != transaction }
self.spans = finished_spans.map(&:to_hash)
populate_profile(transaction)
end
|
Instance Attribute Details
#measurements ⇒ Hash
12
13
14
|
# File 'lib/sentry/transaction_event.rb', line 12
def measurements
@measurements
end
|
#metrics_summary ⇒ Hash?
21
22
23
|
# File 'lib/sentry/transaction_event.rb', line 21
def metrics_summary
@metrics_summary
end
|
#profile ⇒ Hash?
18
19
20
|
# File 'lib/sentry/transaction_event.rb', line 18
def profile
@profile
end
|
#spans ⇒ <Array[Span]>
9
10
11
|
# File 'lib/sentry/transaction_event.rb', line 9
def spans
@spans
end
|
#start_timestamp ⇒ Float?
15
16
17
|
# File 'lib/sentry/transaction_event.rb', line 15
def start_timestamp
@start_timestamp
end
|
Instance Method Details
#to_hash ⇒ Hash
51
52
53
54
55
56
57
58
|
# File 'lib/sentry/transaction_event.rb', line 51
def to_hash
data = super
data[:spans] = @spans.map(&:to_hash) if @spans
data[:start_timestamp] = @start_timestamp
data[:measurements] = @measurements
data[:_metrics_summary] = @metrics_summary if @metrics_summary
data
end
|