Judgment Labs Logo
Other

Temporal

Trace Temporal workflow and activity spans with Judgment.

Temporal tracing uses the built-in temporalio.contrib.opentelemetry module to create spans for workflow executions, activities, and client calls, and routes them through Judgment.

uv add judgeval "temporalio[opentelemetry]"
pip install judgeval "temporalio[opentelemetry]"

Temporal uses interceptors rather than standard OpenTelemetry instrumentors. Install JudgmentTracerProvider as the global tracer provider so the TracingInterceptor picks it up automatically, then pass the interceptor when connecting the client.

temporal_tracing.py
import asyncio

from temporalio.client import Client
from temporalio.contrib.opentelemetry import TracingInterceptor

from judgeval import JudgmentTracerProvider, Tracer

Tracer.init(project_name="temporal_app")
JudgmentTracerProvider.install_as_global_tracer_provider()


async def main():
    interceptor = TracingInterceptor()
    client = await Client.connect(
        "localhost:7233", interceptors=[interceptor]
    )

    # Workers created from this client inherit the interceptor.
    # worker = Worker(client, task_queue="my-queue", workflows=[...], activities=[...])
    # await worker.run()


asyncio.run(main())

On this page

No Headings