|
36 | 36 | --- |
37 | 37 | The `instrument` method accepts the following keyword args: |
38 | 38 |
|
39 | | -tracer_provider (TracerProvider) - an optional tracer provider |
40 | | -request_hook (Callable) - |
41 | | -a function with extra user-defined logic to be performed before querying mongodb |
42 | | -this function signature is: def request_hook(span: Span, event: CommandStartedEvent) -> None |
43 | | -response_hook (Callable) - |
44 | | -a function with extra user-defined logic to be performed after the query returns with a successful response |
45 | | -this function signature is: def response_hook(span: Span, event: CommandSucceededEvent) -> None |
46 | | -failed_hook (Callable) - |
47 | | -a function with extra user-defined logic to be performed after the query returns with a failed response |
48 | | -this function signature is: def failed_hook(span: Span, event: CommandFailedEvent) -> None |
49 | | -capture_statement (bool) - an optional value to enable capturing the database statement that is being executed |
| 39 | +* tracer_provider (``TracerProvider``) - an optional tracer provider |
| 40 | +* request_hook (``Callable[[Span, CommandStartedEvent], None]``) - a function with extra user-defined logic to be performed before querying mongodb |
| 41 | +* response_hook (``Callable[[Span, CommandSucceededEvent], None]``) - a function with extra user-defined logic to be performed after the query returns with a successful response |
| 42 | +* failed_hook (``Callable[[Span, CommandFailedEvent], None]``) - a function with extra user-defined logic to be performed after the query returns with a failed response |
| 43 | +* capture_statement (``bool``) - an optional value to enable capturing the database statement that is being executed |
50 | 44 |
|
51 | 45 | for example: |
52 | 46 |
|
53 | | -.. code: python |
| 47 | +.. code:: python |
54 | 48 |
|
55 | 49 | from opentelemetry.instrumentation.pymongo import PymongoInstrumentor |
56 | 50 | from pymongo import MongoClient |
|
0 commit comments