get_context_value()

Signature

get_context_value(key: str) -> Any

Returns the value for the given key from the current OpenTelemetry context, or None if not found.

Example

from respan import Respan, workflow, get_client
respan = Respan(api_key="your-api-key")
@workflow(name="context_demo")
def context_demo():
client = get_client()
client.set_context_value("custom.key", "my_value")
value = client.get_context_value("custom.key")
print(value) # "my_value"
return value
context_demo()