Repository navigation
fix(observability): export bounded cache counters through PromExporter - #345
Conversation
必须处理项评审基于 本轮未发现需要阻断合并的新增缺陷。 已核对生产调用点、导出 helper、四份官方配置、测试和文档:指标名及 repo/outcome 白名单与实际调用一致,最多九组标签;非法数值、额外标签、错误 collector 类型/顺序不会创建导出序列;日志和导出分别隔离失败;启动前不进行会触发断言的模板插件查询。新增测试通过现有 gtest 源码收集与发现机制接入。 当前 head 的三平台、ASan+UBSan、SDK smoke 及文档构建均成功。缺少自定义 collector 时不导出但不影响认证是明确设计,并已在文档说明,未将其当成静默错误要求改变。严格 coverage gate/nightly TSan 未运行,本轮也未本地重编或重跑真实服务。 |
建议处理项评审基于 1. 将真实 adapter → PromExporter → HTTP 的验证固化为自动化回归位置:DrogonMetrics.cc:51–62、CacheCounterTest.cc:98–129。 现有并发/标签测试直接调用私有 helper;唯一调用生产 DrogonMetrics 的用例明确处于 server 尚未启动状态,因此跳过本次新增的插件查找及导出分支。PR 中已有真实 此测试应放在服务端集成测试层,不要在约定无事件循环的 adapter gtest 进程内启动服务。现有手工证据使其可作为非阻断覆盖建议。 |
1269a49 to
4f83771
Compare
Register the cache counter in the four official profiles, keep export failures separate from legacy INFO logging, and bound labels and values. Preserve optional exporter behavior and pre-start adapter safety; clarify the log-only legacy metric events and custom collector configuration. Refs #343
4f83771 to
e998a04
Compare
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Prevent optional cache collectors from being dynamically registered or modified as Gauge families. Add a running-adapter regression for bounded routing and generic metric export, with missing and malformed collector profiles. Refs #345
Prevent optional cache collectors from being dynamically registered or modified as Gauge families. Add a running-adapter regression for bounded routing and generic metric export, with missing and malformed collector profiles. Refs #345
Prevent optional cache collectors from being dynamically registered or modified as Gauge families. Add a running-adapter regression for bounded routing and generic metric export, with missing and malformed collector profiles. Refs #345
…uge (#367) * fix(observability): reserve cache counter name in gauge API Prevent optional cache collectors from being dynamically registered or modified as Gauge families. Add a running-adapter regression for bounded routing and generic metric export, with missing and malformed collector profiles. Refs #345 * fix(observability): reject the reserved cache family in the Gauge API setGauge() previously created a Gauge collector on first use, so a deployment missing the configured fulla_cache_total Counter would get a Gauge family with arbitrary labels under the same name, and the prometheus scrape would silently change shape. Move the gauge apply path into detail::setGaugeSample(), which rejects the reserved name before any lookup: missing collectors are never registered and an existing collector of any type is never mutated. The label-name/value helpers move next to the cache whitelist so both paths share one implementation. * test(observability): pin gauge-API rejection for the reserved family Cover the three collector states the reserved family can be in (missing, counter, misconfigured gauge) plus the generic-gauge and wrong-type paths. The missing-collector case is the regression pin: with the reserved-name check removed, the test registers a Gauge and fails. * test(integration): exercise cache routing against the live exporter Drive the running-adapter fixture only against the configured profile: assert the real Counter schema, whitelist rejections, no-op Gauge calls for the reserved family, and fulla_test_peer counter/gauge registration, then observe the values through an actual /metrics scrape. The previous env-gated missing/reversed/gauge branches were unreachable in CI; those states are covered as unit tests instead. * docs(observability): document the reserved-family Gauge no-op State in the metric reference that setGauge() is a no-op for fulla_cache_total in every collector state, and align the changelog bullet with the coverage the tests now prove. * docs(observability): regenerate llms-full.txt for the gauge note
Summary
Cache repositories emit
fulla_cache_totalthrough IMetrics, but the default adapter only logged it and the official PromExporter configurations registered no collector. Connect this one bounded family to the existing exporter so cache hit/miss/error behavior is observable even at WARN log level.Register the collector in the four official profiles. Export only
repo={token,client,owner_status}andoutcome={hit,miss,error}, with finite nonnegative increments and matching label schema. Missing/misconfigured exporters remain optional; preserve legacy logging independently. Avoid the templated plugin lookup's pre-start assertion and static pointer cache. No public SDK/API, authorization, cache, schema or transaction changes.Correct the EN/ZH observability docs: legacy metric events are still INFO logs and require separate conversion/wiring. Custom configurations must explicitly register the cache collector. Regenerate both LLM documentation artifacts.
Refs #343
Type of change
Validation
/metricsshowed increasing cache counters after six seconds of successful client-credentials traffic. This verifies the production bridge; it is not a capacity result or proof of timestamp/introspection semantics.--smoke-seconds 6option (4 VU, 0.2-second warmup) to cross the pinned exporter's five-second HTTP snapshot cache. Actual cache reuse and cold-path ratios both passed the unchanged gates with zero cache errors. Counter deltas are not one-to-one measurement-request counts.Checklist
Functional smoke does not imply clean shutdown: abnormal server-stop outcomes are retained separately under the #300 exclusion. This is separate from #344. Registry/counter lookup adds bounded synchronization work; capacity impact remains for S07. Formal capacity, soak and fault acceptance remain blocked on persistent-space provisioning. Private fixture credentials and raw archives stay local. No merge/deployment is requested.