Summary
In src/app/endpoints/responses.py, the raw string literals "success" and "failure" are passed to _record_response_inference_result in multiple places. Since src/metrics/recording.py already exports LLM_INFERENCE_RESULT_SUCCESS and LLM_INFERENCE_RESULT_FAILURE constants for exactly this purpose, the raw literals should be replaced with these constants to reduce typo risk and prevent silent metric skew.
Affected locations
- Around line 1045–1052 (streaming path — terminal event handling in
response_generator)
- Around lines 1188–1193 (non-streaming path — success recording in
handle_non_streaming_response)
- Around lines 1222–1225 (non-streaming path — failure recording in
handle_non_streaming_response)
Suggested fix
- result = "failure" if chunk.type == "response.failed" else "success"
+ result = (
+ recording.LLM_INFERENCE_RESULT_FAILURE
+ if chunk.type == "response.failed"
+ else recording.LLM_INFERENCE_RESULT_SUCCESS
+ )
Apply the same substitution to the other two occurrences where "success" and "failure" are passed directly.
References
Summary
In
src/app/endpoints/responses.py, the raw string literals"success"and"failure"are passed to_record_response_inference_resultin multiple places. Sincesrc/metrics/recording.pyalready exportsLLM_INFERENCE_RESULT_SUCCESSandLLM_INFERENCE_RESULT_FAILUREconstants for exactly this purpose, the raw literals should be replaced with these constants to reduce typo risk and prevent silent metric skew.Affected locations
response_generator)handle_non_streaming_response)handle_non_streaming_response)Suggested fix
Apply the same substitution to the other two occurrences where
"success"and"failure"are passed directly.References