is_recording()

Signature

1is_recording() -> bool

Returns True if there is an active span that is recording, False otherwise.

Example

1from respan import Respan, task, get_client
2
3respan = Respan(api_key="your-api-key")
4
5@task(name="guarded_task")
6def guarded_task():
7 client = get_client()
8 if client.is_recording():
9 client.add_event("task_running")
10 return "done"
11
12guarded_task()