lib/opentelemetry/exporter/otlp/exporter.rb in opentelemetry-exporter-otlp-0.20.0 vs lib/opentelemetry/exporter/otlp/exporter.rb in opentelemetry-exporter-otlp-0.20.1
- old
+ new
@@ -340,10 +340,11 @@
end
def as_otlp_key_value(key, value)
Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value(value))
rescue Encoding::UndefinedConversionError => e
- OpenTelemetry.handle_error(exception: e, message: "encoding error for key #{key} and value #{value}")
+ encoded_value = value.encode('UTF-8', invalid: :replace, undef: :replace, replace: '�')
+ OpenTelemetry.handle_error(exception: e, message: "encoding error for key #{key} and value #{encoded_value}")
Opentelemetry::Proto::Common::V1::KeyValue.new(key: key, value: as_otlp_any_value('Encoding Error'))
end
def as_otlp_any_value(value)
result = Opentelemetry::Proto::Common::V1::AnyValue.new