Skip to content

Commit 7111b88

Browse files
committed
Unify top-level ecto transactions and ecto spans
1 parent 024edf0 commit 7111b88

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/sentry/opentelemetry/span_processor.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ defmodule Sentry.Opentelemetry.SpanProcessor do
5353
start_timestamp: root_span.start_time,
5454
timestamp: root_span.end_time,
5555
transaction_info: %{
56-
source: "db"
56+
source: "component"
5757
},
5858
contexts: %{
5959
trace: build_trace_context(root_span)
@@ -156,6 +156,7 @@ defmodule Sentry.Opentelemetry.SpanProcessor do
156156
span_id: root_span.span_id,
157157
parent_span_id: root_span.parent_span_id,
158158
op: "db.#{attributes["db.type"]}.ecto",
159+
description: attributes["db.statement"] || root_span.name,
159160
origin: root_span.origin,
160161
data: attributes
161162
}

test_integrations/phoenix_app/test/phoenix_app/repo_test.ex renamed to test_integrations/phoenix_app/test/phoenix_app/repo_test.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule PhoenixApp.RepoTest do
22
use PhoenixApp.DataCase
33

4-
alias PhoenixApp.{Repo, User}
4+
alias PhoenixApp.{Repo, Accounts.User}
55

66
import Sentry.TestHelpers
77

@@ -20,8 +20,9 @@ defmodule PhoenixApp.RepoTest do
2020

2121
assert [transaction] = transactions
2222

23-
assert transaction.transaction_info == %{source: "db"}
23+
assert transaction.transaction_info == %{source: "component"}
2424
assert transaction.contexts.trace.op == "db.sql.ecto"
25+
assert String.starts_with?(transaction.contexts.trace.description, "SELECT")
2526
assert transaction.contexts.trace.data["db.system"] == :sqlite
2627
end
2728
end

0 commit comments

Comments
 (0)