Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

feat(http): `/metrics` 无一个 label、无一个直方图、无成本维度——5xx 率算不出、模型烧钱看不见、BudgetExceeded 记成 success

Open
#113 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
observability

Research direction

Start from the Metrics struct at src/http/mod.rs:63-86 — thirteen bare AtomicU64s with no label carrier — and the hard-coded exposition at handlers.rs:1835-1878. Read the metrics middleware in rate_limit.rs:178-188, which only does fetch_add and never reads status or timing, then the /run path at handlers.rs:319-337 where BudgetExceeded is recorded as success. Done means /metrics exposes route/status/model/finish_reason labels, a cost counter and three histograms, and /run reports failure per finish_reason.

Written by the indexing model from the issue text.

Description

场景 gap 单(okguitar 提报)· 优先级 P1 · 依赖:无 · 验收:代码 diff 逐点核对;运行时可见性另需 Langfuse(#124)

基线 origin/main = fc29f3d4。

Summary

  • src/http/mod.rs:63-86:Metrics 为 13 个裸 AtomicU64(requests_total/active、agent_runs_、tokens_、sessions_active、rate_limits_rejected、runs_waiting/in_flight)——无 label 载体;handlers.rs:1835-1878 exposition 为硬编码纯数字;rate_limit.rs:178-188 的 metrics_middleware 只 fetch_add,不读 status、不计时。
  • 关键词缺失:① requests_total 无 status/route label → 5xx/503(准入打满)率根本不存在;② 无 model label、无 cost_usd 指标;③ 无直方图(llm_latency_ms 在 RuntimeOutcome 里有产出,HTTP 层从不消费——handlers.rs:1238 写 0);④ FinishReason 8 变体无一进指标:/run 对 BudgetExceeded 也 record_run_success + 返回 "status":"success"(handlers.rs:319-337);⑤ 无 compaction/重试/工具错误计数。

建议

引入 labels(route/status/model/finish_reason)+ recursive_cost_usd_total + 3 个直方图(LLM 延迟、admission 等待、run 步数);/run 的 status 字段按 finish_reason 区分。

Dominant language
Rust
Stars
4
Forks
0
Avg merge
5h 32m
Merged PRs (30d)
7

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jeffkit/recursive

All issues in jeffkit/recursive

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.