Skip to content

Commit e79db9e

Browse files
committed
fix: add telemetry start event to fix #174
1 parent 4c817b7 commit e79db9e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/mongo/mongo_db_connection.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,19 @@ defmodule Mongo.MongoDBConnection do
340340

341341
Events.notify(event, :commands)
342342

343+
metadata = %{
344+
type: :mongodb_driver,
345+
command: data,
346+
command_name: opts[:command_name] || command_name,
347+
database_name: db,
348+
request_id: state.request_id,
349+
operation_id: opts[:operation_id],
350+
connection_id: self(),
351+
options: Keyword.get(opts, :telemetry_options, [])
352+
}
353+
354+
:telemetry.execute([:mongodb_driver, :start], %{}, metadata)
355+
343356
case :timer.tc(fn -> Utils.post_request(op, state.request_id, %{state | timeout: timeout}) end) do
344357
{duration, {:ok, flags, doc}} ->
345358
state = %{state | request_id: state.request_id + 1}

0 commit comments

Comments
 (0)