Skip to content

Commit 8de3a14

Browse files
Send both cast and dump params to telemetry events (#464)
1 parent c1ba621 commit 8de3a14

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

integration_test/sql/logging.exs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,24 @@ defmodule Ecto.Integration.LoggingTest do
7272
end
7373

7474
test "cast params" do
75-
uuid = Ecto.UUID.generate()
75+
uuid_module =
76+
if TestRepo.__adapter__() == Ecto.Adapters.Tds do
77+
Tds.Ecto.UUID
78+
else
79+
Ecto.UUID
80+
end
81+
82+
uuid = uuid_module.generate()
83+
dumped_uuid = uuid_module.dump!(uuid)
7684

7785
log = fn _event_name, _measurements, metadata ->
78-
assert [uuid] == metadata.params
86+
assert [dumped_uuid] == metadata.params
87+
assert [uuid] == metadata.cast_params
7988
send(self(), :logged)
8089
end
8190

8291
Process.put(:telemetry, log)
83-
TestRepo.all(from l in Logging, where: l.uuid == ^uuid )
92+
TestRepo.all(from l in Logging, where: l.uuid == ^uuid)
8493
assert_received :logged
8594
end
8695
end

lib/ecto/adapters/sql.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,8 @@ defmodule Ecto.Adapters.SQL do
10671067
type: :ecto_sql_query,
10681068
repo: repo,
10691069
result: result,
1070-
params: log_params,
1070+
params: params,
1071+
cast_params: opts[:cast_params],
10711072
query: query,
10721073
source: source,
10731074
stacktrace: stacktrace,

0 commit comments

Comments
 (0)