Add LLM usage and retry tracking for indexing stage #2104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add comprehensive LLM usage and retry tracking for the indexing stage, providing complete performance observability.
Related Issues
[Feature Request]: Enhance LLM usage logging in indexing workflows #2103
Proposed Changes
PipelineRunStats
:total_llm_retries
: Total retry attempts across all workflowsllm_usage_by_workflow[workflow]["retries"]
: Per-workflow retry countinject_llm_context()
helper functionrun_pipeline.py
ModelManager
to all LLM models_record_retries()
common method toRetry
base classfinally
blocks to ensure both successful and failed retries are trackedSample output in stats.json:
Checklist
I've validated the functionality with end-to-end indexing runs.
Note: Both Linux and Windows smoke tests are failing with the same root cause: "ValidationError: API Key is required for chat when using api_key authentication". My changes do not affect configuration validation or authentication logic.
Additional Notes
[Add any additional notes or context that may be helpful for the reviewer(s).]