---
title: JudgmentSpanExporter
seo:
  title: JudgmentSpanExporter — Python SDK
  description: >-
    Exports completed spans to the Judgment platform over OTLP/HTTP. (Python
    SDK)
description: Exports completed spans to the Judgment platform over OTLP/HTTP.
---

This is the default exporter created by `Tracer.init()`. It wraps the
OpenTelemetry `OTLPSpanExporter` and injects Judgment authentication
headers automatically.

You rarely need to instantiate this directly -- `Tracer.init()` wires
it up for you. Use it when building a custom `TracerProvider`.

```python
from judgeval.trace import JudgmentSpanExporter

exporter = JudgmentSpanExporter(
    endpoint="https://api.judgmentlabs.ai/otel/v1/traces",
    api_key="jdg_...",
    organization_id="org_123",
    project_id="proj_456",
)
```

## \_\_init\_\_()

```python
def __init__(endpoint, api_key, organization_id, project_id):
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `endpoint` | `str` | - | |
| `api_key` | `str` | - | |
| `organization_id` | `str` | - | |
| `project_id` | `str` | - | |

***

## export()

Send a batch of spans to Judgment.

```python
def export(spans) -> SpanExportResult:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `spans` | `Sequence[ReadableSpan]` | - | |

### Returns

`SpanExportResult`

***

## shutdown()

Shut down the underlying OTLP exporter and release resources.

```python
def shutdown() -> None:
```

### Returns

`None`

***

## force\_flush()

Flush any queued spans within the given timeout.

```python
def force_flush(timeout_millis=30000) -> bool:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `timeout_millis?` | `int` | `30000` | |

### Returns

`bool`
