Atatus APM supports most of the standard libraries out of the box. However you might need to know how long a specific function took. Using capture span, you can measure the timing of specific function or set of lines of code.

Compatibility

Compatible with all Python agent versions.

Syntax

Option 1: Using decorator When used as a decorator, the function name will be captured as span name.
Option 2: Using context manager When used as a context manager, a name has to be provided.

Parameter

Example