Skip to content

Reasoning parameters missing from OTel span attributes #84

@turisanapo

Description

@turisanapo

Summary

The reasoning and reasoning_effort request parameters are accepted and correctly forwarded to upstream providers, but they are not emitted as OpenTelemetry span attributes in getChatRequestAttributes. This makes reasoning configuration invisible in observability dashboards.

Steps to Reproduce

  1. Send a chat completion request with reasoning configuration:
curl -X POST https://gateway.example.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3-flash-preview",
    "stream": true,
    "messages": [{"role": "user", "content": "Hello"}],
    "reasoning": {"effort": "minimal"}
  }'
  1. Open the observability dashboard (or inspect the OTel span attributes directly)
  2. Look for reasoning-related attributes in the span

Expected Behavior

The span attributes should include reasoning configuration, e.g.:

  • gen_ai.request.reasoning_effort: "minimal"
  • gen_ai.request.reasoning.enabled: true
  • gen_ai.request.reasoning.max_tokens: (if provided)

These should appear in the Raw JSON / trace detail view of any OTel-consuming dashboard.

Actual Behavior

No reasoning-related attributes are emitted on the span. The reasoning configuration is invisible in observability tools despite being correctly processed and forwarded to the upstream provider.

Root Cause

In endpoints/chat-completions/otel.js, the getChatRequestAttributes function emits various request attributes (stream, service_tier, temperature, top_p, etc.) but does not include body.reasoning or body.reasoning_effort.

Environment

  • @hebo-ai/gateway: 0.8.0
  • Model tested: google/gemini-3-flash-preview (via alias)
  • The request processing pipeline (schema validation → parseReasoningOptions → middleware → Vertex thinkingConfig) works correctly — this is purely a telemetry gap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions