mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4490] [Engine] conversation-cache stats: unlocked log scraping, park/restore ms never recorded, nothing in Prometheus #2013
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2013
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @coryjett on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4490
Area
Engine
Desktop app, Terminal or source?
Terminal (Linux release 0.2.7, Control 0.1.52); the same code is on
mainat46c152a1.What happened
Conversation-cache statistics are scraped from the engine log without a lock, lose events, and never reach Prometheus.
serve/server.pyConvCacheLog(~764-818): park and restore counts come from re-reading the engine log, and only when/metricsor/v1/telemetryis called (poll()~781, called frommetrics()~4776). The server is aThreadingHTTPServer(~7913) andpoll()takes no lock, so two concurrent scrapes (Grafana plus the Monitor tab) can read the same span of the log and count the same parks twice (unconfirmed static analysis: the race is read from the code, not observed).READ_MAXis 1 MiB (~771): when the log grows more than that between scrapes, events are skipped. TheEVENTregex captures tokens, parked count and bytes but not the milliseconds the engine prints ("parked 68955 tokens in 4027.6 ms"), so park and restore time is never recorded; "skipped" events are matched but not counted (~811).serve/prometheus.pyexports none ofconversation_cache(0 occurrences), although docs/DETAILS.md (~30) says thestrata:metrics are named after their JSON keys.For an agent workload (three agents on one slot, 56 parks / 102 s in 3 hours) the park and restore time is the number that matters, and it is only in the log.
Suggested: count events in the server as they are logged (or lock
poll()), addpark_ms_total,restore_ms_total,skippedandsuperseded, and export them asstrata:conversation_cache_*. Happy to send a PR.Smallest steps or command that reproduce it
Scrape
/metricsfrom two clients at once while agents park and restore; compareconversation_cache.parksagainstgrep -c "conversation cache: parked" <engine log>.Reproduction status
Reproduced by reading the code; the missing milliseconds and the missing Prometheus export are visible in any
/metricsoutput.Strata version
0.2.7 (engine 0.1.52, Control 0.1.52); code checked on
main46c152a1.Graphics card, memory and system
2x RTX 3090 24 GB (PCIe 3.0 x16, one per socket), 2x Xeon E5-2620 v3, 256 GB, Ubuntu 26.10.
Model, size and settings
Flash-Next IQ3_S, layer split 25 with --trim-stage-weights, conversation cache 40 GiB / 16 slots; the full profile is in #4468.
Logs
Engine log lines as quoted above.
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.