Skip to content

feat(google-genai): emit streaming latency span attrs - #37

Merged
sayonfortify merged 1 commit into
fr-v0.52.6.xfrom
feat/google-genai-streaming-latency
Jun 19, 2026
Merged

feat(google-genai): emit streaming latency span attrs#37
sayonfortify merged 1 commit into
fr-v0.52.6.xfrom
feat/google-genai-streaming-latency

Conversation

@sayonfortify

Copy link
Copy Markdown

Adds FortifyRoot streaming-latency span attributes to Google GenAI streaming responses.

What changed:

  • generate_content_stream sync and async paths now pass request start_time into the existing streaming delegate.
  • The streaming safety wrapper records:
    • fortifyroot.llm.streaming.time_to_first_token_ms when the first streamed item arrives.
    • fortifyroot.llm.streaming.time_to_generate_ms when the stream finalizes.
  • Empty streams intentionally leave both attributes unset so RDS nullable columns remain honest no-data.
  • Existing stream safety/finalization behavior is preserved.

Tests:

  • Added deterministic sync/async unit coverage for TTFT/STTG attrs.
  • Added empty-stream coverage proving no fake zero latency attrs are emitted.

Validation run locally:

  • python3 -m py_compile on changed source/test files.
  • PYTHONPATH=../opentelemetry-instrumentation-fortifyroot python -m pytest tests/test_safety_unit.py -q → 10 passed.
  • git diff --check clean.

No network/provider calls; no cassette changes.

@sayonfortify
sayonfortify merged commit c011bcf into fr-v0.52.6.x Jun 19, 2026
10 checks passed
@sayonfortify
sayonfortify deleted the feat/google-genai-streaming-latency branch June 19, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant