Skip to content

Commit

Permalink
More dialyzer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Sep 27, 2024
1 parent 2870a69 commit e58ffcb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/sentry/envelope.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Sentry.Envelope do

@type t() :: %__MODULE__{
event_id: UUID.t(),
items: [Event.t() | Attachment.t() | CheckIn.t(), ...]
items: [Event.t() | Attachment.t() | CheckIn.t() | Transaction.t(), ...]
}

@enforce_keys [:event_id, :items]
Expand Down
21 changes: 18 additions & 3 deletions lib/sentry/opentelemetry/span_processor.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule Sentry.Opentelemetry.SpanProcessor do
@behaviour :otel_span_processor

require Logger

alias Sentry.{Span, Transaction, Opentelemetry.SpanStorage, Opentelemetry.SpanRecord}

@impl true
Expand All @@ -24,13 +26,26 @@ defmodule Sentry.Opentelemetry.SpanProcessor do

transaction = build_transaction(root_span, child_spans)

Sentry.send_transaction(transaction)
result =
case Sentry.send_transaction(transaction) do
{:ok, _id} ->
true

:ignored ->
true

{:error, error} ->
Logger.error("Failed to send transaction to Sentry: #{inspect(error)}")
{:error, :invalid_span}
end

SpanStorage.remove_span(span_record.span_id)
SpanStorage.remove_child_spans(span_record.span_id)
end

:ok
result
else
true
end
end

@impl true
Expand Down

0 comments on commit e58ffcb

Please sign in to comment.