Class: Langfuse::Types::SpanAttributes
- Inherits:
-
Object
- Object
- Langfuse::Types::SpanAttributes
- Defined in:
- lib/langfuse/types.rb
Overview
Attributes for Langfuse span observations
Spans are used to track operations, functions, or logical units of work. They can contain other spans, generations, or events as children.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#environment ⇒ String?
Environment where the operation is running (e.g., ‘production’, ‘staging’).
-
#input ⇒ Object?
Input data for the operation being tracked.
-
#level ⇒ String?
Severity level of the observation (DEBUG, DEFAULT, WARNING, ERROR).
-
#metadata ⇒ Hash?
Additional metadata as key-value pairs.
-
#output ⇒ Object?
Output data from the operation.
-
#status_message ⇒ String?
Human-readable status message.
-
#version ⇒ String?
Version identifier for the code/model being tracked.
Instance Method Summary collapse
-
#initialize(input: nil, output: nil, metadata: nil, level: nil, status_message: nil, version: nil, environment: nil) ⇒ SpanAttributes
constructor
Initialize a new SpanAttributes instance.
-
#to_h ⇒ Hash
Convert attributes to a hash representation.
Constructor Details
#initialize(input: nil, output: nil, metadata: nil, level: nil, status_message: nil, version: nil, environment: nil) ⇒ SpanAttributes
Initialize a new SpanAttributes instance
rubocop:disable Metrics/ParameterLists
118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/langfuse/types.rb', line 118 def initialize(input: nil, output: nil, metadata: nil, level: nil, status_message: nil, version: nil, environment: nil) # rubocop:enable Metrics/ParameterLists @input = input @output = output @metadata = @level = level @status_message = @version = version @environment = environment end |
Instance Attribute Details
#environment ⇒ String?
Returns Environment where the operation is running (e.g., ‘production’, ‘staging’).
106 107 108 |
# File 'lib/langfuse/types.rb', line 106 def environment @environment end |
#input ⇒ Object?
Returns Input data for the operation being tracked.
88 89 90 |
# File 'lib/langfuse/types.rb', line 88 def input @input end |
#level ⇒ String?
Returns Severity level of the observation (DEBUG, DEFAULT, WARNING, ERROR).
97 98 99 |
# File 'lib/langfuse/types.rb', line 97 def level @level end |
#metadata ⇒ Hash?
Returns Additional metadata as key-value pairs.
94 95 96 |
# File 'lib/langfuse/types.rb', line 94 def @metadata end |
#output ⇒ Object?
Returns Output data from the operation.
91 92 93 |
# File 'lib/langfuse/types.rb', line 91 def output @output end |
#status_message ⇒ String?
Returns Human-readable status message.
100 101 102 |
# File 'lib/langfuse/types.rb', line 100 def @status_message end |
#version ⇒ String?
Returns Version identifier for the code/model being tracked.
103 104 105 |
# File 'lib/langfuse/types.rb', line 103 def version @version end |
Instance Method Details
#to_h ⇒ Hash
Convert attributes to a hash representation
Returns a hash with all non-nil attributes. Nil values are excluded.
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/langfuse/types.rb', line 135 def to_h { input: @input, output: @output, metadata: @metadata, level: @level, status_message: @status_message, version: @version, environment: @environment }.compact end |