get_tracer()

Signature

get_tracer() -> Tracer

Returns the underlying OpenTelemetry Tracer instance for creating spans manually when decorators are not sufficient.

Example

from respan import Respan, get_client
respan = Respan(api_key="your-api-key")
client = get_client()
tracer = client.get_tracer()
with tracer.start_as_current_span("custom_operation") as span:
span.set_attribute("custom.key", "value")
# Your logic here
result = 42
span.set_attribute("custom.result", result)

Manual spans are exported through the same processor pipeline as decorator-created spans. Prefer decorators for standard use cases and use get_tracer() only when you need fine-grained control over span lifecycle.