Skip to content

Commit d18b7b4

Browse files
committed
Add usage instructions
1 parent 7a96b51 commit d18b7b4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/db_connection/telemetry_listener.ex

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ defmodule DbConnection.TelemetryListener do
55
It monitors connection processes and ensures that disconnection events are
66
always emitted.
77
8+
## Usage
9+
10+
Start the listener, optionally using a name, and pass it under the
11+
`:connection_listeners` option when starting DbConnection:
12+
13+
{:ok, pid} = TelemetryListener.start_link([name: MyListener])
14+
{:ok, _conn} = DBConnection.start_link(SomeModule, [connection_listeners: [MyListener]])
15+
# Using a tag, which will be sent in telemetry metadata
16+
{:ok, _conn} = DBConnection.start_link(SomeModule, [connection_listeners: {[pid], :my_tag}])
17+
818
## Telemetry events
919
1020
### Connected

0 commit comments

Comments
 (0)