Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

admin metrics fails against RustFS 1.0.1 stable with 501 NotImplemented — wrong admin route (/metrics instead of /realtime)

未关闭 适合新手
#388 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
cli

调研方向

从 crates/s3/src/admin.rs 中的 realtime_metrics() 开始,这里 URL 是用 self.admin_url("/metrics") 构建的;将其改为 /realtime,以匹配 rustfs/src/admin/handlers/system.rs 中注册的路由。针对一台 RustFS 1.0.1 服务器,使用 rc admin metrics <alias> --json 重新构建并验证(当返回包含 samples 的 status: success 时即完成)。可选地,在同一文件中跟进版本门控辅助函数 add_known_server_capabilities / is_rustfs_beta_10,使稳定的 1.0.x 字符串被视为已知且具备能力。

由索引模型根据 Issue 内容生成。

描述

rc admin metrics fails against a RustFS 1.0.1 (stable) server with:

{
  "status": "error",
  "error": {
    "type": "unsupported_feature",
    "message": "Failed to query realtime metrics: Unsupported feature: A header you provided implies functionality that is not implemented.",
    "capability": "admin.metrics",
    "suggestion": "Upgrade RustFS to beta.10 or later."
  }
}

This happens even with no extra flags (rc admin metrics <alias> --json), not just --by-disk.

Root cause: crates/s3/src/admin.rs, realtime_metrics(), builds the request URL via:

let mut url = self.admin_url("/metrics");

which resolves to /rustfs/admin/v3/metrics. The server (rustfs/rustfs) registers this handler at a different path — see rustfs/src/admin/handlers/system.rs:

r.insert(
    Method::GET,
    format!("{}{}", ADMIN_PREFIX, "/v3/realtime").as_str(),
    AdminOperation(&realtime::MetricsHandler {}),
)?;

i.e. /rustfs/admin/v3/realtime, not /v3/metrics. The mismatched path falls through to a generic NotImplemented response instead of a 404, which is what made this confusing to diagnose.

Fix: change the one line to:

let mut url = self.admin_url("/realtime");

Confirmed: after this one-line change and rebuilding, rc admin metrics works correctly against RustFS 1.0.1 (verified against a live server, status: success, samples returned, including --by-disk).

Side note (separate, lower-priority observation): the capability-discovery version gate in the same file (add_known_server_capabilities, is_rustfs_beta_10 / is_rustfs_rc_series) only recognizes beta.10-family and rc-prerelease version strings as "known capable" — a stable 1.0.1 version string doesn't match either pattern, so rc admin capabilities likely under-reports capabilities for any stable 1.0.x+ release. Didn't turn out to be the actual cause of the bug above, but probably worth a version-gate update too.

主要语言
Rust
星标
159
派生
23
平均合并
3 天 14 小时
30 天内合并 PR
3

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rustfs/cli 的其他 Issue

查看 rustfs/cli 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。