Class: Sentry::MetricEvent
- Inherits:
-
Object
- Object
- Sentry::MetricEvent
- Includes:
- Utils::TelemetryAttributes
- Defined in:
- lib/sentry/metric_event.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#span_id ⇒ Object
Returns the value of attribute span_id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#trace_id ⇒ Object
Returns the value of attribute trace_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, type:, value:, unit: nil, attributes: nil) ⇒ MetricEvent
constructor
A new instance of MetricEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, type:, value:, unit: nil, attributes: nil) ⇒ MetricEvent
Returns a new instance of MetricEvent.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sentry/metric_event.rb', line 12 def initialize( name:, type:, value:, unit: nil, attributes: nil ) @name = name @type = type @value = value @unit = unit @attributes = attributes || {} = Sentry.utc_now @trace_id = nil @span_id = nil end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def name @name end |
#span_id ⇒ Object
Returns the value of attribute span_id.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def span_id @span_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def end |
#trace_id ⇒ Object
Returns the value of attribute trace_id.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def trace_id @trace_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def type @type end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def unit @unit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/sentry/metric_event.rb', line 9 def value @value end |
Instance Method Details
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sentry/metric_event.rb', line 30 def to_h { name: @name, type: @type, value: @value, unit: @unit, timestamp: , trace_id: @trace_id, span_id: @span_id, attributes: serialize_attributes }.compact end |