Skip to content

Add script_time and total_time latency metrics to aiohttp main loop - #256

Open
artinn wants to merge 1 commit into
mainfrom
feature/aiohttp-latency-metrics
Open

artinn wants to merge 1 commit into
mainfrom
feature/aiohttp-latency-metrics

Conversation

@artinn

@artinn artinn commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

The aiohttp main loop must emit latency metrics for skill requests. process_message already sampled the load/save stages, but script time was never sampled here (sampling_script_time was only called from the Kafka loop) and there was no total request timer.

  • monitoring: add sampling_total_time() -> {app}_total_time histogram.
  • main_loop_async_http: sample script time around model.answer/_generate_answers; wrap the whole processing (load -> script -> save -> postprocess) in a total timer and sample it; add "Total time" to the "timings" log record.
  • Kept the existing {app}_load_time/{app}_save_time names instead of the task's {app}_loading_time/{app}_saving_time: same stages, renaming would break existing dashboards (agreed with the task owner).

Verified in Docker on general_base_cloud: after 4 real MESSAGE_TO_SKILL mocks, /metrics shows general_base_{load,script,save,total}_time count=4, total ~= load+script+save.

The aiohttp main loop must emit latency metrics for skill requests.
process_message already sampled the load/save stages, but script time was
never sampled here (sampling_script_time was only called from the Kafka
loop) and there was no total request timer.

- monitoring: add sampling_total_time() -> {app}_total_time histogram.
- main_loop_async_http: sample script time around
  model.answer/_generate_answers; wrap the whole processing
  (load -> script -> save -> postprocess) in a total timer and sample it;
  add "Total time" to the "timings" log record.
- Kept the existing {app}_load_time/{app}_save_time names instead of the
  task's {app}_loading_time/{app}_saving_time: same stages, renaming would
  break existing dashboards (agreed with the task owner).

Verified in Docker on general_base_cloud: after 4 real MESSAGE_TO_SKILL
mocks, /metrics shows general_base_{load,script,save,total}_time count=4,
total ~= load+script+save.
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