update_current_span()
Signature
1 update_current_span( 2 respan_params: Dict | RespanParams = None, 3 attributes: Dict = None, 4 status: Status | StatusCode = None, 5 status_description: str = None, 6 name: str = None, 7 ) -> bool
Returns True if the span was updated successfully, False otherwise.
Parameters
| Parameter | Type | Description |
|---|---|---|
respan_params | Dict | RespanParams | Respan-specific parameters: customer_identifier, customer_email, customer_name, trace_group_identifier, metadata. |
attributes | Dict | Custom OpenTelemetry span attributes. |
status | Status | StatusCode | Span status (StatusCode.OK, StatusCode.ERROR, etc.). |
status_description | str | Human-readable status description. |
name | str | Override the span display name. |
Respan params
| Key | Type | Description |
|---|---|---|
customer_identifier | str | User or customer identifier. Appears in the Respan dashboard for filtering. |
customer_email | str | Customer email address. |
customer_name | str | Customer display name. |
trace_group_identifier | str | Group related traces together (e.g., by experiment, session, or pipeline). |
metadata | Dict | Custom key-value pairs for analytics and filtering. |
Example
1 from respan import Respan, workflow, get_client 2 from opentelemetry.trace import StatusCode 3 4 respan = Respan(api_key="your-api-key") 5 6 @workflow(name="process") 7 def process(user_id: str): 8 client = get_client() 9 client.update_current_span( 10 respan_params={ 11 "customer_identifier": user_id, 12 "trace_group_identifier": "pipeline-a", 13 "metadata": {"env": "production", "version": "2.1"}, 14 }, 15 attributes={"custom.step": "validation"}, 16 status=StatusCode.OK, 17 name="process.success", 18 ) 19 return "ok" 20 21 process("user-123")