Skip to main content

Signature

get_tracer() -> Tracer
Returns the underlying OpenTelemetry Tracer instance for creating spans manually when decorators are not sufficient.

Example

from respan_tracing import RespanTelemetry, get_client

telemetry = RespanTelemetry(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.