taoensso / telemere

Structured telemetry library for Clojure/Script
https://www.taoensso.com/telemere
Eclipse Public License 1.0
190 stars 4 forks source link

OpenTelemetry: error! fails with nil body #11

Closed leahneukirchen closed 3 months ago

leahneukirchen commented 4 months ago

Trying to log an exception using (error! ex) fails in setBody

value must not be null
  java.util.Objects/requireNonNull at Objects.java:259
  io.opentelemetry.api.incubator.logs.AnyValueString/create at AnyValueString.java:19
  io.opentelemetry.api.incubator.logs.AnyValue/of at AnyValue.java:37
  io.opentelemetry.sdk.logs.SdkLogRecordBuilder/setBody at SdkLogRecordBuilder.java:91
  io.opentelemetry.sdk.logs.SdkLogRecordBuilder/setBody at SdkLogRecordBuilder.java:24
  taoensso.telemere.open_telemetry$handler_COLON_open_telemetry_logger$a_handler_COLON_open_telemetry_logger__14233/invoke at NO_SOURCE_FILE:228
  taoensso.encore.signals$wrap_handler$handle_signal_BANG___12229$fn__12230/invoke at signals.cljc:730
  taoensso.encore.signals$wrap_handler$handle_signal_BANG___12229/invoke at signals.cljc:699

This can be avoided when .setBody is not called. But perhaps a default body should be constructed from exception.type and exception.message, as e.g. Loki will just display an empty line else.

ptaoussanis commented 4 months ago

Thanks for the report! Will be fixed in the next beta 👍

ptaoussanis commented 3 months ago

Fixed on upcoming master

ptaoussanis commented 3 months ago

This should be fixed with beta15, now on Clojars. But please ping if you're still having any issues!