You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+9-12
Original file line number
Diff line number
Diff line change
@@ -14,44 +14,41 @@ Run the following command::
14
14
Getting started
15
15
===============
16
16
17
-
Please see the examples directory. Overall, basic usage requires that a tracer gets set, an Engine (or Connection) is registered, and statements get their parent spans assigned (if any):
17
+
Please see the examples directory. Overall, basic usage requires that a tracer gets set, and statements get their parent spans assigned (if any):
18
18
19
19
.. code-block:: python
20
20
21
21
import sqlalchemy_opentracing
22
22
23
23
sqlalchemy_opentracing.init_tracing(tracer) # A OpenTracing compatible tracer.
24
-
sqlalchemy_opentracing.register_engine(engine) # A valid SQLAlchemy Engine object.
By default, only statements marked to be traced are taken into account (explicitly through set_traced() or implicitly when registering its parent span through set_parent_span()). Alternatively, you can enable tracing of all queries under the registered Engine:
30
+
By default, all statements in all engines are traced. Alternatively, you can enable tracing of all queries under a specific Engine by specifying that not all engines are registered, and register the Engine yourself:
#this statement will be traced too (without a parent span, though)
37
+
#Only queries under `engine` will be traced.
39
38
with engine.begin() as conn:
40
39
sel = select([users])
41
40
conn.execute(sel)
42
41
43
-
It is also possible to have all engines being registered automatically (independently of the `trace_all_queries` flag, which can be enabled or disabled):
42
+
It is also possible to prevent tracing of all queries automatically (independently of whether all engines are traced or not), and have them marked explicitly (with or without a parent span):
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.
0 commit comments