You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] The stats cmd is not accurate when mentioning avg speed 0ms #1266
Fixed. PR #1267 (fix/issue-1266, ready for review): #1267
Root cause:ToolStat.AvgMs was an int64 milliseconds value computed in toolStats() as int64(durSum/durCount*1000), truncating any mean under 1ms to 0 - and every renderer then printed %dms.
Fix (shared once, at the root):
internal/platform/telemetry/stats.go - AvgMs is now float64 (JSON key avg_ms unchanged, values may be fractional, which also fixes infer stats --format json), aggregation drops the truncation, and a new telemetry.FormatAvg() (next to the existing FormatFailRate) renders microseconds below 1ms (e.g. 432µs) and whole milliseconds above.
Applied it at all four ToolStat surfaces so they can't drift: infer stats (cmd/stats), the /stats shortcut markdown + vertical views (presentation/shortcuts), and the infer insights digest + report (internal/insights).
Added internal/platform/telemetry/stats_test.go: table test for FormatAvg plus a regression test that a 0.4ms mean survives aggregation un-truncated.
Checks: targeted package tests pass, full task test suite passes, task precommit:run gate passes (golangci-lint 0 issues). go vet ./... fails only in robotgo (missing X11 headers on this runner, pre-existing and unrelated); touched packages vet clean with -tags purego. The issue screenshot couldn't be downloaded (user-attachments domain blocked by the sandbox), so I worked from the issue text. Board updated to In progress then QA; follow-up [DOCS] issue filed in inference-gateway/docs#721 for the new avg formatting.
Root cause:ToolStat.AvgMs was an int64 milliseconds value computed in toolStats() as int64(durSum/durCount*1000), truncating any mean under 1ms to 0 - and every renderer then printed %dms, showing "0ms" for fast tools.
Fix (root cause, shared once):
internal/platform/telemetry/stats.go - AvgMs is now float64 (JSON key avg_ms unchanged, values may be fractional, which also fixes infer stats --format json showing 0 for sub-ms averages); aggregation drops the whole-ms truncation; new telemetry.FormatAvg() (next to the existing FormatFailRate) renders microseconds below 1ms (e.g. 432µs) and whole milliseconds above.
Applied at all four ToolStat render surfaces so they can't drift: infer stats (cmd/stats), the /stats shortcut markdown + vertical views (internal/presentation/shortcuts), and the infer insights digest + report (internal/insights).
New internal/platform/telemetry/stats_test.go: table test for FormatAvg plus a regression test that a 0.4ms mean survives aggregation un-truncated.
Checks: targeted package tests pass, full task test suite passes, task precommit:run gate passes (golangci-lint 0 issues), go vet -tags purego clean on touched packages. (go vet ./... fails only in robotgo - missing X11 headers on this runner, pre-existing and unrelated.) The issue's screenshot couldn't be downloaded (user-attachments domain blocked by the sandbox), so the fix was driven by the issue text.
Tracking: issue #1266 added to Roadmap board #7, moved to QA after the PR opened; follow-up [DOCS] issue filed in inference-gateway/docs#721; avg_ms in --format json may now be fractional (noted in the PR body). Working tree is clean and everything is pushed.
Activity
edenreich commentedon Sep 22, 2026
@infer Can you fix this? use /ponytail:ponytail /go
inference-gateway-maintainer commentedon Sep 22, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1267
✅ Infer Result: Success
Fixed. PR #1267 (
fix/issue-1266, ready for review): #1267Root cause:
ToolStat.AvgMswas anint64milliseconds value computed intoolStats()asint64(durSum/durCount*1000), truncating any mean under 1ms to 0 - and every renderer then printed%dms.Fix (shared once, at the root):
internal/platform/telemetry/stats.go-AvgMsis nowfloat64(JSON keyavg_msunchanged, values may be fractional, which also fixesinfer stats --format json), aggregation drops the truncation, and a newtelemetry.FormatAvg()(next to the existingFormatFailRate) renders microseconds below 1ms (e.g.432µs) and whole milliseconds above.ToolStatsurfaces so they can't drift:infer stats(cmd/stats), the/statsshortcut markdown + vertical views (presentation/shortcuts), and theinfer insightsdigest + report (internal/insights).internal/platform/telemetry/stats_test.go: table test forFormatAvgplus a regression test that a 0.4ms mean survives aggregation un-truncated.Checks: targeted package tests pass, full
task testsuite passes,task precommit:rungate passes (golangci-lint 0 issues).go vet ./...fails only inrobotgo(missing X11 headers on this runner, pre-existing and unrelated); touched packages vet clean with-tags purego. The issue screenshot couldn't be downloaded (user-attachments domain blocked by the sandbox), so I worked from the issue text. Board updated to In progress then QA; follow-up [DOCS] issue filed in inference-gateway/docs#721 for the new avg formatting.All work is complete and verified. Final summary:
Fixed issue #1266 - PR #1267 (
fix/issue-1266, ready for review): #1267Root cause:
ToolStat.AvgMswas anint64milliseconds value computed intoolStats()asint64(durSum/durCount*1000), truncating any mean under 1ms to 0 - and every renderer then printed%dms, showing "0ms" for fast tools.Fix (root cause, shared once):
internal/platform/telemetry/stats.go-AvgMsis nowfloat64(JSON keyavg_msunchanged, values may be fractional, which also fixesinfer stats --format jsonshowing0for sub-ms averages); aggregation drops the whole-ms truncation; newtelemetry.FormatAvg()(next to the existingFormatFailRate) renders microseconds below 1ms (e.g.432µs) and whole milliseconds above.ToolStatrender surfaces so they can't drift:infer stats(cmd/stats), the/statsshortcut markdown + vertical views (internal/presentation/shortcuts), and theinfer insightsdigest + report (internal/insights).internal/platform/telemetry/stats_test.go: table test forFormatAvgplus a regression test that a 0.4ms mean survives aggregation un-truncated.Checks: targeted package tests pass, full
task testsuite passes,task precommit:rungate passes (golangci-lint 0 issues),go vet -tags puregoclean on touched packages. (go vet ./...fails only inrobotgo- missing X11 headers on this runner, pre-existing and unrelated.) The issue's screenshot couldn't be downloaded (user-attachments domain blocked by the sandbox), so the fix was driven by the issue text.Tracking: issue #1266 added to Roadmap board #7, moved to QA after the PR opened; follow-up [DOCS] issue filed in inference-gateway/docs#721;
avg_msin--format jsonmay now be fractional (noted in the PR body). Working tree is clean and everything is pushed.Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 12m 0sTokens: 2,513,107 in · 27,581 out · 2,540,688 total (37 requests)
Tool calls: 66 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
fix(stats): keep sub-millisecond precision in avg tool duration (#1267)
inference-gateway-releaser commentedon Sep 23, 2026
🎉 This issue has been resolved in version 0.206.0 🎉
The release is available on:
Your semantic-release bot 📦🚀