How does Rius read OpenInference conversation id attributes?
Rius reads the OpenInference conversation id, which OpenInference carries as session.id, as the session key and groups the traces that share it into one session. Rius stores the attribute as sent, with no renaming. Set it on every span, and the traces of one conversation appear together in the console.
How it works
- The attribute name. OpenInference’s conversation key is
session.id. Rius lists it withuser.idas the OpenInference session and user family, and uses both for session and user grouping. - No renaming. Many OpenInference attributes, such as
llm.token_count.prompt, are normalized ontogen_ai.*keys at ingest.session.idis not one of them. It is stored as sent, so you search and filter onsession.id. The full contract is in the span attribute reference. - Read per span. Rius reads the session from each span, not only from the root. A span without
session.idfalls back togen_ai.conversation.id, the key the OpenTelemetry GenAI conventions use. If neither is present, the span is grouped by its trace id, so the trace becomes its own session. - Users work the same way.
user.idmarks the user a request served. When it is absent, Rius also readsenduser.id, thenenduser.pseudo.id. A span with none of them is anonymous. - Everything else is unchanged. The span kind, model, tokens and cost of the same spans are handled as described on the OpenInference page. Session grouping does not depend on them.
Set it up
- Send your OpenInference spans to the Rius ingest endpoint. This is the shared wiring from the OpenInference page, which covers it in full:
from opentelemetry.sdk.trace import SpanLimits, TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from openinference.instrumentation.openai import OpenAIInstrumentor
# Raise the attribute limit: see step 4 below.
provider = TracerProvider(span_limits=SpanLimits(max_span_attributes=4096))
provider.add_span_processor(
BatchSpanProcessor(
OTLPSpanExporter(
endpoint="https://ingest.eu.console.rius-glassflow.com/v1/traces",
headers={"Authorization": "Bearer <your API key>"},
)
)
)
OpenAIInstrumentor().instrument(tracer_provider=provider)- Give every span of a conversation the same
session.idvalue, including the root span. Wrap each turn in OpenInference’susing_session(conversation_id)fromopeninference-instrumentation, and keep the same value across every turn so the traces group together.using_sessiononly stamps spans OpenInference creates, so a root span you start from a plain OpenTelemetry tracer needssession.idset on it by hand. The trace list shows each trace under the session of its root span. If you send through the Rius SDK instead,rius.sessionin Python andwithSessionin TypeScript stamp it for you. - Add
user.idto the same spans if you want per-user views. Prefer an opaque id to an email. - Raise the span attribute limit. OpenInference writes one attribute per message field and tool field, and OpenTelemetry keeps only 128 per span by default, so a long agent loop can silently lose attributes. The code above sets it in Python. For any language you can set it through the environment:
export OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT=4096- Run two turns of the same conversation and confirm that both traces show under one session in the console. If you want the whole picture of sender options, Trace LLM calls with OpenTelemetry compares them on one page.
What you get
- Traces that share a
session.idgroup into one session, so a multi-turn conversation reads as one unit instead of separate traces. - Per-user grouping from
user.id, withenduser.idandenduser.pseudo.idas fallbacks. - A predictable fallback. Spans without
session.idusegen_ai.conversation.id, and spans with neither stay grouped by trace. - A key you can search and filter on exactly as you sent it, because
session.idis stored as sent. - The same model analytics, token usage and server-side cost on the same spans, since OpenInference’s LLM attributes are normalized onto
gen_ai.*keys at ingest.
When something else fits
- If your instrumentation follows the OpenTelemetry GenAI conventions, send
gen_ai.conversation.id. Rius reads it as the session wheneversession.idis absent. - If you want each run to stand alone, send no session key. Each trace is then its own session.
- For the complete list of attributes Rius reads and how each convention is treated, see the interoperability overview.
Related
Last updated on