Skip to content

feat(langchain): emit streaming latency span attrs - #38

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

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

Conversation

@sayonfortify

Copy link
Copy Markdown

Adds FortifyRoot streaming latency span attributes to LangChain LLM spans when LangChain emits streaming token callbacks.

  • Records fortifyroot.llm.streaming.time_to_first_token_ms on the first on_llm_new_token callback.
  • Records fortifyroot.llm.streaming.time_to_generate_ms at on_llm_end, only when a first token was observed.
  • Leaves non-streaming and empty/no-token calls without these attrs, preserving NULL/no-data behavior downstream.
  • Adds deterministic callback-level tests; no provider calls or VCR cassette.

Local validation:

  • python3 -m py_compile ...
  • PYTHONPATH=packages/opentelemetry-instrumentation-fortifyroot /Users/sayondutta/opt/anaconda3/envs/py3.12/bin/python -m pytest packages/opentelemetry-instrumentation-langchain/tests/test_streaming_latency_span_attrs.py -q -> 2 passed
  • git diff --check clean
  • secret scan clean

@sayonfortify
sayonfortify merged commit c428961 into fr-v0.52.6.x Jun 19, 2026
10 checks passed
@sayonfortify
sayonfortify deleted the feat/langchain-streaming-latency branch June 19, 2026 11:11
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