Skip to content

feat(hub): 观测 counters 批2 — ws/delivery/offline/team-timeout/eventbus/admin(D 审计 G1/G2/G5/G6/G7/G10) - #1449

Merged
DeliciousBuding merged 1 commit into
masterfrom
feat/observability-counters-batch2
Jul 29, 2026
Merged

feat(hub): 观测 counters 批2 — ws/delivery/offline/team-timeout/eventbus/admin(D 审计 G1/G2/G5/G6/G7/G10)#1449
DeliciousBuding merged 1 commit into
masterfrom
feat/observability-counters-batch2

Conversation

@DeliciousBuding

Copy link
Copy Markdown
Collaborator

D 审计批2 — 6 条 S 级观测缺口

纯加观测(counter/gauge + Inc/Set),不改业务控制流、不改返回值、不改签名。对齐 #1441/#1447 nil-guard 模式。metrics.go 唯一归属。

6 条 metric

G-ID Metric Type Labels 落地点
G1 ws_delivery_failures_total CounterVec reason=marshal_error|conn_closed|conn_not_found ws/manager.go PushToConn — 4 return 前各 Inc
G2 ws_disconnects_total / ws_reconnects_total / ws_stale_close_total 3× Counter ws/manager.go Unregister / SetAuth(oldConnID) / pingAll stale close
G5 agent_dispatch_offline_push_failures_total CounterVec route=unbound_inviter_desktop|unbound_ws_miss|unbound_only|hub_relay|target_bound|redispatch agent_dispatch.go 5 处 + agent_dispatch_target_bound.go 1 处
G6 team_assignment_timeouts_total + team_assignment_state_transition_failures_total Counter + CounterVec phase=status_update|event_append agent_team_routing.go FailTimedOutAssignments
G7 eventbus_submit_failures_total Counter eventbus.go Publish pool.Submit 失败
G10 admin_server_up Gauge app/admin.go — Set 1 成功启动 / Set 0 凭据缺失或 ListenAndServe 失败

不碰

改了哪些文件

  1. hub-server/internal/metrics/metrics.go — 6 组 var + construct + MustRegister
  2. hub-server/internal/ws/manager.go — G1 (4 Inc) + G2 (3 Inc)
  3. hub-server/internal/service/agent_dispatch.go — G5 (5 routes) + import metrics
  4. hub-server/internal/service/agent_dispatch_target_bound.go — G5 (1 route) + import metrics
  5. hub-server/internal/service/agentteam/agent_team_routing.go — G6 (3 Inc)
  6. hub-server/internal/service/eventbus.go — G7 (1 Inc)
  7. hub-server/internal/app/admin.go — G10 (3 Set)

测试

go test ./internal/metrics/... ./internal/ws/... ./internal/service/... ./internal/middleware/... ./internal/app/... ./internal/handler/... -short -count=1

17 packages — all green

gofmt -w ✓ | git diff --check ✓ | nil-guard 对齐 #1441/#1447

PROGRESS.md 未提交(untracked)。

…/admin(G1/G2/G5/G6/G7/G10)

D 审计批2 6 条 S 级缺口,纯加观测(counter + Inc),不改业务控制流。

metrics.go 新增 6 组 counter/gauge(nil-guard 对齐 #1441/#1447):
- G1: ws_delivery_failures_total{reason} CounterVec
- G2: ws_disconnects_total / ws_reconnects_total / ws_stale_close_total
- G5: agent_dispatch_offline_push_failures_total{route} CounterVec
- G6: team_assignment_timeouts_total + team_assignment_state_transition_failures_total{phase}
- G7: eventbus_submit_failures_total Counter
- G10: admin_server_up Gauge
Copilot AI review requested due to automatic review settings July 29, 2026 00:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DeliciousBuding, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bb88d2c8-8662-4009-8639-ea9d17905ca3

📥 Commits

Reviewing files that changed from the base of the PR and between 4d21187 and 6539541.

📒 Files selected for processing (7)
  • hub-server/internal/app/admin.go
  • hub-server/internal/metrics/metrics.go
  • hub-server/internal/service/agent_dispatch.go
  • hub-server/internal/service/agent_dispatch_target_bound.go
  • hub-server/internal/service/agentteam/agent_team_routing.go
  • hub-server/internal/service/eventbus.go
  • hub-server/internal/ws/manager.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DeliciousBuding
DeliciousBuding merged commit 5099f3f into master Jul 29, 2026
20 checks passed
@DeliciousBuding
DeliciousBuding deleted the feat/observability-counters-batch2 branch July 29, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants