Skip to content

python.missing_tracing

Observability Low

Detects code without distributed tracing instrumentation, making it difficult to understand request flow and identify bottlenecks.

Without distributed tracing:

  • Blind spots in production — Can’t see where time is spent
  • Slow debugging — No visibility into service interactions
  • Performance mysteries — Can’t identify slow dependencies
  • Incident response delays — Finding root cause takes longer
# ❌ Before (no tracing)
async def process_order(order_id: str):
order = await fetch_order(order_id)
payment = await charge_payment(order)
await send_notification(order)
return order
# ✅ After (with OpenTelemetry tracing)
from opentelemetry import trace
tracer = trace.get_tracer(__name__)
async def process_order(order_id: str):
with tracer.start_as_current_span("process_order") as span:
span.set_attribute("order_id", order_id)
with tracer.start_as_current_span("fetch_order"):
order = await fetch_order(order_id)
with tracer.start_as_current_span("charge_payment"):
payment = await charge_payment(order)
with tracer.start_as_current_span("send_notification"):
await send_notification(order)
return order
  • HTTP handlers without tracing spans
  • External service calls without child spans
  • Database operations without timing spans
  • Async task creation without trace context propagation

Unfault generates patches that add OpenTelemetry instrumentation:

from opentelemetry import trace
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
# Auto-instrument frameworks
FastAPIInstrumentor.instrument_app(app)
RequestsInstrumentor().instrument()
tracer = trace.get_tracer(__name__)
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
# Configure provider
provider = TracerProvider()
processor = BatchSpanProcessor(OTLPSpanExporter())
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)