> ## Documentation Index
> Fetch the complete documentation index at: https://docs.responsibleailabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenTelemetry

> Full observability के लिए RAIL scores को OpenTelemetry spans के रूप में export करें।

## Installation

```bash theme={null}
pip install "rail-score-sdk[telemetry]"
```

## Setup

```python theme={null}
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from rail_score_sdk import RailScoreClient
from rail_score_sdk.telemetry import RAILTelemetry

# OTEL exporter configure करें
provider = TracerProvider()
exporter = OTLPSpanExporter(endpoint="http://localhost:4317")
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)

# RAIL telemetry enable करें
rail = RailScoreClient(api_key="YOUR_RAIL_API_KEY")
RAILTelemetry.instrument(rail)

# अब सभी eval() calls automatically spans emit करेंगी
result = rail.eval(content="Your text here", mode="basic")
```

## Span attributes

हर `rail.eval()` call इन attributes के साथ एक span emit करती है:

| Attribute                    | Type     | Description                 |
| ---------------------------- | -------- | --------------------------- |
| `rail.score`                 | `float`  | Overall RAIL score          |
| `rail.confidence`            | `float`  | Score confidence            |
| `rail.mode`                  | `string` | `basic` या `deep`           |
| `rail.credits_consumed`      | `float`  | Consume हुए credits         |
| `rail.from_cache`            | `bool`   | Result cache से आया या नहीं |
| `rail.dim.{name}.score`      | `float`  | Per-dimension score         |
| `rail.dim.{name}.confidence` | `float`  | Per-dimension confidence    |

## Traces देखें

RAIL spans किसी भी OTEL-compatible backend के साथ काम करते हैं: Jaeger, Tempo, Honeycomb, Datadog, New Relic, या Langfuse।

```bash theme={null}
# Development के लिए local Jaeger instance start करें
docker run -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one
```

Traces देखने के लिए `http://localhost:16686` open करें।
