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

MySQL tracing uses the standard OpenTelemetry MySQL instrumentation and routes
database spans through Judgment.

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

**uv**

```bash
uv add judgeval mysql-connector-python opentelemetry-instrumentation-mysql
```

**pip**

```bash
pip install judgeval mysql-connector-python opentelemetry-instrumentation-mysql
```

```python title="mysql_tracing.py"
from judgeval import Tracer
from opentelemetry.instrumentation.mysql import MySQLInstrumentor

Tracer.init(project_name="mysql_app")
Tracer.registerOTELInstrumentation(MySQLInstrumentor())

# Create connections normally after registration.
# connection = mysql.connector.connect(
#     host="localhost",
#     user="user",
#     password="password",
#     database="db",
# )
```
