From 8bddf4a17b537800e63555249d3507e5de69b5de Mon Sep 17 00:00:00 2001 From: Gustavo Aguiar Date: Sun, 29 Nov 2020 14:21:00 -0300 Subject: [PATCH] fixup! fixup! Add `record_exception` to Erlang --- apps/opentelemetry_api/src/otel_span.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/opentelemetry_api/src/otel_span.erl b/apps/opentelemetry_api/src/otel_span.erl index bd4d26a99..44c140e93 100644 --- a/apps/opentelemetry_api/src/otel_span.erl +++ b/apps/opentelemetry_api/src/otel_span.erl @@ -114,8 +114,8 @@ add_events(_, _) -> Stacktrace :: list(any()), Attributes :: opentelemetry:attributes(). record_exception(SpanCtx, Class, Term, Stacktrace, Attributes) -> - ExceptionAttributes = [{<<"exception.type">>, list_to_binary(io_lib:format("~p:~p", [Class, Term]))}, - {<<"exception.stacktrace">>, list_to_binary(io_lib:format("~p", [Stacktrace]))}], + ExceptionAttributes = [{<<"exception.type">>, iolist_to_binary(io_lib:format("~p:~p", [Class, Term]))}, + {<<"exception.stacktrace">>, iolist_to_binary(io_lib:format("~p", [Stacktrace]))}], add_event(SpanCtx, <<"exception">>, ExceptionAttributes ++ Attributes). -spec record_exception(SpanCtx, Class, Term, Message, Stacktrace, Attributes) -> boolean() when @@ -126,8 +126,8 @@ record_exception(SpanCtx, Class, Term, Stacktrace, Attributes) -> Stacktrace :: list(any()), Attributes :: opentelemetry:attributes(). record_exception(SpanCtx, Class, Term, Message, Stacktrace, Attributes) -> - ExceptionAttributes = [{<<"exception.type">>, list_to_binary(io_lib:format("~p:~p", [Class, Term]))}, - {<<"exception.stacktrace">>, list_to_binary(io_lib:format("~p", [Stacktrace]))}, + ExceptionAttributes = [{<<"exception.type">>, iolist_to_binary(io_lib:format("~p:~p", [Class, Term]))}, + {<<"exception.stacktrace">>, iolist_to_binary(io_lib:format("~p", [Stacktrace]))}, {<<"exception.message">>, Message}], add_event(SpanCtx, <<"exception">>, ExceptionAttributes ++ Attributes).