> For the complete documentation index, see [llms.txt](https://rawctx.gitbook.io/rawctx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rawctx.gitbook.io/rawctx-docs/documentation/integrations/opentelemetry-trace-references.md).

# OpenTelemetry trace references

rawctx can attach selected fields from LangSmith, Langfuse, or another OpenTelemetry runtime to an answer-audit record. It does not replace the trace system or automatically synchronize its workspace.

## Ownership boundary

Keep spans, prompts, tool calls, latency, cost analysis, and trace access control in your existing observability system. Send only the identifiers, hashes, and references needed for answer review to rawctx.

## SDK path

Use `ingest_otel_trace_bundle()` when your application selects public-safe fields from an existing trace:

```python
import rawctx

rawctx.ingest_otel_trace_bundle(
    application_key="support_assistant",
    environment="production",
    trace_bundle={
        "resourceSpans": [
            {
                "resource": {
                    "attributes": [
                        {
                            "key": "service.name",
                            "value": {"stringValue": "support-assistant"},
                        }
                    ]
                },
                "scopeSpans": [],
            }
        ]
    },
    external_trace_id="4f3c2b1a0f9e8d7c6b5a493827160504",
    question={"text": "What is the refund policy?"},
    answer={"text": "Customers can request a refund within 30 days."},
    source_refs=[
        {
            "source_type": "langsmith_trace",
            "trace_id": "4f3c2b1a0f9e8d7c6b5a493827160504",
        }
    ],
)
```

## OTLP path

Collectors and gateway services may send OTLP-shaped `resourceLogs` or `resourceSpans` to:

```
POST https://<workspace-api-host>/api/answer-audit-logs/otel
```

Use the authenticated tenant registry saved by `rawctx login` or configure the collector with that workspace API host. Do not send workspace evidence to the Hub browser BFF.

The SDK example sends text so a workspace that requires platform-managed keyed hashing can derive tenant HMAC commitments. Text storage is controlled separately. A hash-only trace bundle is valid only when the workspace explicitly accepts caller-generated hashes.

Useful fields include `service.name`, `deployment.environment`, `traceId`, `spanId`, `rawctx.audit.idempotency_key`, `rawctx.audit.semantic_refs`, `rawctx.audit.source_refs`, `enduser.id_hash`, and `session.id_hash`.

## Do not send

* `LANGSMITH_API_KEY`, `LANGFUSE_SECRET_KEY`, collector tokens, or other secrets
* private trace URLs
* raw tool output or customer files by default
* prompts or answers when hashes are sufficient for the review process

A submitted trace reference proves only that rawctx bound it to the answer record. It does not prove that the trace is true or that the model used a source in its reasoning.

See the [official integrations guide](https://hub.rawctx.dev/docs/integrations) for the full field map.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rawctx.gitbook.io/rawctx-docs/documentation/integrations/opentelemetry-trace-references.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
