Skip to content

Commit 4c79ec5

Browse files
committed
Update our README to provide more details.
1) For the raw SQL statements execution. 2) For the resulting span's operation name and tags.
1 parent 40dc11b commit 4c79ec5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ By default, only statements marked to be traced are taken into account (explicit
4040
sel = select([users])
4141
conn.execute(sel)
4242
43+
The resulting spans will have an operation name related to the sql statement (such as `create-table` or `insert`), and will include exception information (if any), the dialect/backend (such as sqlite), and a few other hints.
44+
4345
Tracing under a Connection
4446
===========================
4547

@@ -80,6 +82,21 @@ It is also possible to trace all actual SQL statements happening during a Sessio
8082
8183
Similar to what happens for Connection, either a commit or a rollback will finish its tracing, and further work on it will not be reported.
8284

85+
Tracing raw SQL statements
86+
==========================
87+
88+
Executing raw SQL statements can be done through either a Connection or a Session, through their execute() method. Since there's no way to mark each statement individually, tracing them can be done through either tracing all statements, or through tracing a Connection's transaction or Session:
89+
90+
.. code-block:: python
91+
92+
sqlalchemy_opentracing.set_parent_span(session, parent_span)
93+
94+
# this statement will be traced as part of the session's execution
95+
session.execute('INSERT INTO users VALUES (?, ?)', 1, 'John')
96+
97+
98+
Raw SQL statements will be traced having its operation name as `textclause`, to indicate their explicit text nature.
99+
83100
Manually cancel tracing
84101
=======================
85102

0 commit comments

Comments
 (0)