Judgment Labs Logo
Other

Starlette Tracing

Trace Starlette request spans with Judgment.

Starlette tracing uses the standard OpenTelemetry Starlette instrumentation and routes request spans through Judgment.

uv add judgeval starlette opentelemetry-instrumentation-starlette
pip install judgeval starlette opentelemetry-instrumentation-starlette
starlette_tracing.py
from judgeval import Tracer
from opentelemetry.instrumentation.starlette import StarletteInstrumentor
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route


async def hello(request):
    return JSONResponse({"message": "hello"})


Tracer.init(project_name="starlette_app")

app = Starlette(routes=[Route("/hello", hello)])
StarletteInstrumentor.instrument_app(app)

On this page

No Headings