mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-04 15:28:40 +00:00
With --batch-mtp the proposals are checked in the slot windows and were counted only in the engine's totals and its log, so every response of a batch-path request read timings.draft_n = 0 and draft_n_accepted = 0 (and last_timings) while /metrics and the log showed real drafting; users read it as "MTP is off". Each batch slot now counts the proposals its windows checked and kept (both the serial and the pipelined group path), and its BDONE line ends with ` drafts=<checked>:<kept>` (nothing is added for a slot that checked none; an older server ignores the key). The server's _apply_bdone adds them to the admission's DONE counters, which feed the response and the per-request record. Tests: terminal/serve/test_parallel.py BatchDraftCounters (fake engine with --drafts: the response record reads them; without the key it reads as before), engine/src/program/bdone_drafts_test.cpp (the text).
22 lines
1.1 KiB
C++
22 lines
1.1 KiB
C++
// include/strata/program/bdone_drafts.hpp - the draft counters of a --batch slot in its BDONE line (#5890).
|
|
//
|
|
// With --batch-mtp the proposals are checked in the slot windows, and the engine counted them only in its totals ("strata batch: MTP proposals accepted N of M") and the
|
|
// log, so a response of a batch-path request read draft_n = 0 and draft_n_accepted = 0 while /metrics moved. The slot now keeps its own counters (proposals checked, proposals
|
|
// kept since the admission) and its BDONE line carries them as ` drafts=<checked>:<kept>`; the server reads them like `read=<ms>`. A slot that checked no proposal adds
|
|
// nothing (the line stays as it was, and an older server ignores a key it does not know). Pure: no GPU.
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace strata::program {
|
|
|
|
inline std::string bdone_drafts_text(int64_t checked, int64_t kept) {
|
|
if (checked <= 0) return std::string();
|
|
if (kept < 0) kept = 0;
|
|
if (kept > checked) kept = checked;
|
|
return " drafts=" + std::to_string((long long) checked) + ":" + std::to_string((long long) kept);
|
|
}
|
|
|
|
} // namespace strata::program
|