Skip to content

feat(telemetry): emit gen_ai.request.* from tracing plugin (post-#1045) #1068

Open

Description

@planetf1

Problem

gen_ai.request.temperature, gen_ai.request.top_p, and related request-parameter attributes are not emitted on backend spans today.

A model_options/_REQUEST_PARAM_MAP approach was prototyped in PR #1036 but withdrawn following review from @jakelorocco and @ajbozarth:

  • No backend call site passed model_options, so the code was dead.
  • Even if wired, the values would be pre-substitution — Mellea backends mutate model_options before handing them to the SDK (defaults merged, provider-specific renames, unsupported keys stripped). The dict visible at the top of start_generate_span is not what goes over the wire.
  • Per @jakelorocco: prefer pass-through as gen_ai.model_options.<key> over a hardcoded remap to OTel-standard names, since the naming differs between providers anyway.

Approach

After #1045 lands and BackendTracingPlugin exists:

  1. Capture the final resolved model_options dict in the GENERATION_PRE_CALL hook — the point immediately before the SDK call, where values match what the provider receives.
  2. Emit each key/value as gen_ai.model_options.<key> (pass-through, not remapped), or decide at that point whether OTel-standard names (gen_ai.request.temperature etc.) are worth the remap given cross-provider naming differences.

Prerequisites

Related

Epic #444 Phase 2.
PR #1036 (where the dead-code prototype was withdrawn).

Activity

  1. added
    area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLM
    area/telemetryOTel spans, metrics, tracing, semconv
    enhancementNew feature or request
    on May 20, 2026
  2. added
    p2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.
    on Jun 18, 2026
  3. ajbozarth commented on Jul 15, 2026

    @ajbozarth
    Member

    When implementing this, adopt the target semconv names from the start rather than emitting mellea.* attrs and renaming later — #1209 tracks the alignment and calls out two items that live in the same BackendTracingPlugin request-param path:

    • S5 — emit gen_ai.request.stream (not mellea.streaming)
    • S10 — don't add mellea.streaming as a duplicate; the semconv attr supersedes it

    Doing these here avoids an add-then-rename churn on the same code. (#1209 already lists this issue as the owner of gen_ai.request.*.)

  4. self-assigned this
    on Aug 17, 2026
  5. removed their assignment
    on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMarea/telemetryOTel spans, metrics, tracing, semconvenhancementNew feature or requestp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions