Class: OpenTelemetry::SDK::Logs::LogRecord
- Inherits:
-
Logs::LogRecord
- Object
- Logs::LogRecord
- OpenTelemetry::SDK::Logs::LogRecord
- Defined in:
- lib/opentelemetry/sdk/logs/log_record.rb
Overview
Implementation of OpenTelemetry::Logs::LogRecord that records log events.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#body ⇒ Object
Returns the value of attribute body.
-
#instrumentation_scope ⇒ Object
Returns the value of attribute instrumentation_scope.
-
#observed_timestamp ⇒ Object
Returns the value of attribute observed_timestamp.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#severity_number ⇒ Object
Returns the value of attribute severity_number.
-
#severity_text ⇒ Object
Returns the value of attribute severity_text.
-
#span_id ⇒ Object
Returns the value of attribute span_id.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#trace_flags ⇒ Object
Returns the value of attribute trace_flags.
-
#trace_id ⇒ Object
Returns the value of attribute trace_id.
Instance Method Summary collapse
-
#initialize(timestamp: nil, observed_timestamp: nil, severity_text: nil, severity_number: nil, body: nil, attributes: nil, trace_id: nil, span_id: nil, trace_flags: nil, resource: nil, instrumentation_scope: nil, log_record_limits: nil) ⇒ LogRecord
constructor
Creates a new LogRecord.
- #to_log_record_data ⇒ Object
Constructor Details
#initialize(timestamp: nil, observed_timestamp: nil, severity_text: nil, severity_number: nil, body: nil, attributes: nil, trace_id: nil, span_id: nil, trace_flags: nil, resource: nil, instrumentation_scope: nil, log_record_limits: nil) ⇒ LogRecord
Creates a new OpenTelemetry::SDK::Logs::LogRecord.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 61 def initialize( timestamp: nil, observed_timestamp: nil, severity_text: nil, severity_number: nil, body: nil, attributes: nil, trace_id: nil, span_id: nil, trace_flags: nil, resource: nil, instrumentation_scope: nil, log_record_limits: nil ) @timestamp = @observed_timestamp = || || Time.now @severity_text = severity_text @severity_number = severity_number @body = body @attributes = attributes.nil? ? nil : Hash[attributes] # We need a mutable copy of attributes @trace_id = trace_id @span_id = span_id @trace_flags = trace_flags @resource = resource @instrumentation_scope = instrumentation_scope @log_record_limits = log_record_limits || LogRecordLimits::DEFAULT @total_recorded_attributes = @attributes&.size || 0 trim_attributes(@attributes) end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def attributes @attributes end |
#body ⇒ Object
Returns the value of attribute body.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def body @body end |
#instrumentation_scope ⇒ Object
Returns the value of attribute instrumentation_scope.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def instrumentation_scope @instrumentation_scope end |
#observed_timestamp ⇒ Object
Returns the value of attribute observed_timestamp.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def @observed_timestamp end |
#resource ⇒ Object
Returns the value of attribute resource.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def resource @resource end |
#severity_number ⇒ Object
Returns the value of attribute severity_number.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def severity_number @severity_number end |
#severity_text ⇒ Object
Returns the value of attribute severity_text.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def severity_text @severity_text end |
#span_id ⇒ Object
Returns the value of attribute span_id.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def span_id @span_id end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def @timestamp end |
#trace_flags ⇒ Object
Returns the value of attribute trace_flags.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def trace_flags @trace_flags end |
#trace_id ⇒ Object
Returns the value of attribute trace_id.
16 17 18 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 16 def trace_id @trace_id end |
Instance Method Details
#to_log_record_data ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/opentelemetry/sdk/logs/log_record.rb', line 92 def to_log_record_data LogRecordData.new( to_integer_nanoseconds(@timestamp), to_integer_nanoseconds(@observed_timestamp), @severity_text, @severity_number, @body, @attributes, @trace_id, @span_id, @trace_flags, @resource, @instrumentation_scope, @total_recorded_attributes ) end |