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
An optional list of functions that should be set up for performance monitoring. For each function in the list, a span will be created when the function is executed.
781
+
Functions in the list are represented as strings containing the fully qualified name of the fuction.
782
+
783
+
This is a convenient option, making it possible to have one central place for configuring what functions to trace, instead of having manual instrumentation scattered all over your code base.
784
+
785
+
To learn more, see the [Custom Instrumentation](/platforms/python/performance/instrumentation/custom-instrumentation/#define-span-creation-in-a-central-place) documentation.
Copy file name to clipboardExpand all lines: src/platforms/python/common/performance/instrumentation/custom-instrumentation.mdx
+30-1Lines changed: 30 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The Sentry SDK for Python does a very good job of auto instrumenting your applic
8
8
9
9
## Add a Transaction
10
10
11
-
Adding transactions will allow you to instrument and capture certain regions of your code.
11
+
Adding transactions will allow you to instrument and capture certain regions of your code.
12
12
13
13
<Note>
14
14
@@ -106,6 +106,35 @@ def eat_slice(slice):
106
106
swallow()
107
107
```
108
108
109
+
## Define Span Creation in a Central Place
110
+
111
+
To avoid having custom performance instrumentation code scattered all over your code base, pass a parameter <PlatformIdentifiername="functions-to-trace" /> to your `sentry_sdk.init()` call.
Now, whenever a function specified in `functions_to_trace` will be executed, a span will be created and attached as a child to the currently running span.
131
+
132
+
<Alertlevel="warning"title="Important">
133
+
134
+
To enable performance monitoring for the functions specified in `functions_to_trace`, the SDK needs to load the function modules. Be aware, there may be code being executed in modules during module loading. To avoid this, use the method described above to trace your functions.
135
+
136
+
</Alert>
137
+
109
138
## Accessing the Current Transaction
110
139
111
140
To change data in an already ongoing transaction, use `Hub.current.scope.transaction`. This property will return a transaction if there's one running, otherwise it will return `None`.
0 commit comments