Skip to content

Commit

Permalink
mix format
Browse files Browse the repository at this point in the history
  • Loading branch information
GregMefford committed Nov 27, 2024
1 parent 14a1765 commit 407d146
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions apps/opentelemetry_api/test/open_telemetry_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ defmodule OpenTelemetryTest do
require OpenTelemetry.Ctx, as: Ctx

require Record
Record.defrecordp(:span_ctx, Record.extract(:span_ctx, from_lib: "opentelemetry_api/include/opentelemetry.hrl"))
Record.defrecordp(:status, Record.extract(:status, from_lib: "opentelemetry_api/include/opentelemetry.hrl"))

@otel_include "opentelemetry_api/include/opentelemetry.hrl"
Record.defrecordp(:span_ctx, Record.extract(:span_ctx, from_lib: @otel_include))
Record.defrecordp(:status, Record.extract(:status, from_lib: @otel_include))

setup_all do
:otel_tracer_test.set_default()
Expand Down Expand Up @@ -147,12 +149,18 @@ defmodule OpenTelemetryTest do
end

test "Span.record_exception" do
Tracer.with_span("exceptional span") do
Tracer.with_span "exceptional span" do
Tracer.record_exception(%RuntimeError{message: "too awesome"})
end

assert_received {:add_event, _span_ctx, :exception, attributes}
assert %{"exception.type": "RuntimeError", "exception.stacktrace": stacktrace, "exception.message": "too awesome"} = attributes

assert %{
"exception.type": "RuntimeError",
"exception.stacktrace": stacktrace,
"exception.message": "too awesome"
} = attributes

assert is_binary(stacktrace)
assert String.contains?(stacktrace, "\n")
end
Expand Down

0 comments on commit 407d146

Please sign in to comment.