---
title: "Celery Tracing"
description: "Trace Celery worker spans with Judgment."
sidebar:
  label: "Celery"
seo:
  title: "Celery Tracing with Judgment | Integration Docs"
  description: "Trace Celery spans with Judgment to connect application behavior to production AI agent monitoring and evaluation."
---

Celery tracing uses the standard OpenTelemetry Celery instrumentation and
routes worker spans through Judgment.

{/* @test-flow
  id: tracing-task-celery
  lang: python
  env: JUDGMENT_API_KEY, JUDGMENT_ORG_ID
*/}

Initialize tracing inside the worker process.

**uv**

```bash
uv add judgeval celery opentelemetry-instrumentation-celery
```

**pip**

```bash
pip install judgeval celery opentelemetry-instrumentation-celery
```

```python title="celery_tracing.py"
from celery import Celery
from celery.signals import worker_process_init
from judgeval import Tracer
from opentelemetry.instrumentation.celery import CeleryInstrumentor

app = Celery("tasks", broker="amqp://localhost")


@worker_process_init.connect(weak=False)
def init_celery_tracing(*args, **kwargs):
    Tracer.init(project_name="celery_app")
    Tracer.registerOTELInstrumentation(CeleryInstrumentor())


@app.task
def add(x, y):
    return x + y
```
