Module: PlatformSdk::Observability::Langfuse::Coercions
- Defined in:
- lib/platform_sdk/observability/langfuse/coercions.rb
Overview
Shared coercion helpers used by Configuration, Recorder, and the Traceable PerformWrapper. Extracted to a single home so the OpenTelemetry attribute-validator workaround (‘String.new` to produce a plain String rather than a subclass) lives in one place.
Class Method Summary collapse
-
.coerce_string(value) ⇒ Object
Returns ‘nil` for nil; otherwise a plain `String` (not a subclass).
Class Method Details
.coerce_string(value) ⇒ Object
Returns ‘nil` for nil; otherwise a plain `String` (not a subclass). OTel’s attribute validator uses ‘instance_of?(String)` — subclasses like `ActiveSupport::SafeBuffer` fail validation and crash `Resource.create`.
17 18 19 20 21 |
# File 'lib/platform_sdk/observability/langfuse/coercions.rb', line 17 def coerce_string(value) return nil if value.nil? String.new(value.to_s) end |