What does the gen_ai.request.stream attribute mean in Rius?
In Rius, gen_ai.request.stream marks a model call as a streaming request, and you set it to true together with gen_ai.response.time_to_first_chunk. It sits on the span for the streaming model call, next to the other request parameters. Rius derives time to first token from the duration attribute, not from this flag.
How it works
The key is one of the gen_ai.request.* request parameters defined by the OpenTelemetry GenAI conventions, like gen_ai.request.temperature or gen_ai.request.max_tokens. The conventions define it as a boolean that “indicates whether the GenAI request was made in streaming mode”, at Development stability, and ask for it on inference spans when the request streams. Its registry entry links to the upstream definition. Rius stores it on the span as sent, so you search and filter on gen_ai.request.stream in trace inspection.
- Which spans carry it: the span for a streaming model call. Agent, tool and retrieval spans do not need it.
- What goes with it:
gen_ai.response.time_to_first_chunk, a number of seconds from the span start to the first content chunk. Rius derives time to first token from that duration by placing the first chunk at the span start plus the duration, never later than the span’s end. - Your producer’s own event wins: if a span carries OpenInference’s
First Token Stream Eventor the Vercel AI SDK’sai.stream.firstChunk, that event’s time is the first chunk and the duration attribute is not used for it. - No event needed: the older
gen_ai.first_tokenspan event is deprecated. Earlier Rius SDK releases wrote it, and the platform still reads it, but new instrumentation sends only the attribute. The gen_ai registry page lists it as deprecated.
Older names. OpenInference carries the flag as the stream member of llm.invocation_parameters. Rius maps that member onto gen_ai.request.stream at ingest, and the Rius SDKs apply the same OpenInference mapping in your process before export. For OpenLLMetry, the older streaming spellings move to their current keys at ingest. After normalization, filter on gen_ai.request.stream. Native gen_ai.* keys always win, and normalization only fills gaps.
Set it up
-
Find your streaming model calls. The attribute belongs on the span for each call that returns its answer as a stream.
-
Set both attributes when the first content chunk arrives. Set
gen_ai.response.time_to_first_chunkonce, in seconds from the span start, and setgen_ai.request.streamto true on the same span:
gen_ai.request.stream: true
gen_ai.response.time_to_first_chunk: 0.42The value 0.42 is only an example. Use the measured seconds from your own span start to the first chunk.
-
With the Rius SDK, call
record_first_token()(recordFirstToken()in TypeScript). It sets the duration andgen_ai.request.stream: truetogether, so you do not write either attribute yourself. -
From OpenInference, send what you already send. The
streammember ofllm.invocation_parametersbecomesgen_ai.request.stream, so no extra code is needed. -
From a vanilla OpenTelemetry SDK or a collector pipeline, set the two attributes on the span yourself. The span attribute reference covers the full contract for senders other than the Rius SDKs, and Trace LLM calls with OpenTelemetry walks through the setup.
What you get
- A streaming marker on the model-call span, stored under
gen_ai.request.streamwith the other request parameters, so you can search and filter on it. - Time to first token for the call, derived from
gen_ai.response.time_to_first_chunkor from your producer’s own first-chunk event. - The same canonical key for streaming calls that arrive through OpenInference, because Rius maps the
streammember ofllm.invocation_parametersonto it at ingest. - Nothing to send for cost. Rius computes cost from the model name and the token counts, never from this flag.
When something else fits
- If a call is not streamed, leave both
gen_ai.request.streamandgen_ai.response.time_to_first_chunkoff the span. - If your producer already records its own first-chunk event, as OpenInference and the Vercel AI SDK do, that event supplies the first-chunk time, and you do not need to send the duration for it.
- If you want the exact meaning of a key you do not recognize, check the span attribute reference, which lists what Rius reads and stores.