Skip to Content

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 Event or the Vercel AI SDK’s ai.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_token span 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

  1. Find your streaming model calls. The attribute belongs on the span for each call that returns its answer as a stream.

  2. Set both attributes when the first content chunk arrives. Set gen_ai.response.time_to_first_chunk once, in seconds from the span start, and set gen_ai.request.stream to true on the same span:

gen_ai.request.stream: true gen_ai.response.time_to_first_chunk: 0.42

The value 0.42 is only an example. Use the measured seconds from your own span start to the first chunk.

  1. With the Rius SDK, call record_first_token() (recordFirstToken() in TypeScript). It sets the duration and gen_ai.request.stream: true together, so you do not write either attribute yourself.

  2. From OpenInference, send what you already send. The stream member of llm.invocation_parameters becomes gen_ai.request.stream, so no extra code is needed.

  3. 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.stream with 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_chunk or from your producer’s own first-chunk event.
  • The same canonical key for streaming calls that arrive through OpenInference, because Rius maps the stream member of llm.invocation_parameters onto 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.stream and gen_ai.response.time_to_first_chunk off 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.

Still stuck? Get help

Last updated on