Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR restructures the resource statistics API by introducing a hierarchical Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant GatewayLB as "Gateway LB"
participant Agent1 as "Agent 1"
participant Agent2 as "Agent 2"
participant AgentN as "Agent N"
participant StatsUtil as "Stats Util"
Client->>GatewayLB: ResourceStatsDetail()
GatewayLB->>GatewayLB: start trace span\ninit Details map
par broadcast
GatewayLB->>Agent1: ResourceStats() [sub-span]
Agent1->>StatsUtil: GetResourceStats(ctx)
StatsUtil-->>Agent1: stats (hostname, ip, cgroup)
Agent1-->>GatewayLB: ResourceStats response -> Details[agent1]
GatewayLB->>Agent2: ResourceStats() [sub-span]
Agent2->>StatsUtil: GetResourceStats(ctx)
StatsUtil-->>Agent2: stats
Agent2-->>GatewayLB: Details[agent2]
GatewayLB->>AgentN: ResourceStats() [sub-span]
AgentN->>StatsUtil: GetResourceStats(ctx)
StatsUtil-->>AgentN: stats
AgentN-->>GatewayLB: Details[agentN]
end
GatewayLB->>GatewayLB: aggregate Details\nrecord per-call statuses
GatewayLB-->>Client: ResourceStatsDetail{ details: map[...] }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
|
[CHATOPS:HELP] ChatOps commands.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3435 +/- ##
==========================================
+ Coverage 25.02% 25.97% +0.94%
==========================================
Files 544 572 +28
Lines 43800 50475 +6675
==========================================
+ Hits 10963 13109 +2146
- Misses 32108 36395 +4287
- Partials 729 971 +242 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c3df358 to
2df183b
Compare
Deploying vald with
|
| Latest commit: |
63e5986
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1d6d77f5.vald.pages.dev |
| Branch Preview URL: | https://feature-gateway-add-resource.vald.pages.dev |
|
/format |
|
[FORMAT] Updating license headers and formatting go codes triggered by kpango. |
Signed-off-by: Vdaas CI <vald@vdaas.org>
… IndexProperty to prevent data race
Signed-off-by: Jumpei Tanikawa <jumpei5278@gmail.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
apis/proto/v1/payload/payload.proto (1)
654-678:⚠️ Potential issue | 🟠 MajorStill unresolved: preserve
Info.ResourceStatson the v1 surface.Rehoming this message under
Info.Statsrenames the generated SDK type for the existing stats RPC (Info_ResourceStats→Info_Stats_ResourceStatsin Go), which is a source-breaking change for current v1 clients. Keep the legacy top-level message and hang the new detail shape off it instead.You can verify the generated surface change with:
#!/bin/bash set -euo pipefail rg -n -C2 'type Info_ResourceStats|type Info_Stats_ResourceStats' apis/grpc/v1/payload/payload.pb.go rg -n -C2 '\bResourceStats\b' apis/proto/v1/rpc/stats/stats.proto🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apis/proto/v1/payload/payload.proto` around lines 654 - 678, The change moved the ResourceStats protobuf message under Info.Stats which renames the generated Go type (Info_ResourceStats → Info_Stats_ResourceStats) and breaks v1 clients; restore the original top-level message name and keep the new detailed shape as a nested type. Specifically, reintroduce a top-level message ResourceStats with the same fields (cpu_limit_cores, cpu_usage_cores, memory_limit_bytes, memory_usage_bytes and the name/ip fields) so the generated type Info_ResourceStats remains, and modify Stats (or Info.Stats) to reference that top-level ResourceStats for existing usages while adding a new ResourceStatsDetail (or similar nested message) that can contain the map<string, ResourceStats> for the detailed shape.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@apis/proto/v1/payload/payload.proto`:
- Around line 654-678: The change moved the ResourceStats protobuf message under
Info.Stats which renames the generated Go type (Info_ResourceStats →
Info_Stats_ResourceStats) and breaks v1 clients; restore the original top-level
message name and keep the new detailed shape as a nested type. Specifically,
reintroduce a top-level message ResourceStats with the same fields
(cpu_limit_cores, cpu_usage_cores, memory_limit_bytes, memory_usage_bytes and
the name/ip fields) so the generated type Info_ResourceStats remains, and modify
Stats (or Info.Stats) to reference that top-level ResourceStats for existing
usages while adding a new ResourceStatsDetail (or similar nested message) that
can contain the map<string, ResourceStats> for the detailed shape.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 61a63792-cabc-46bf-a663-a296fdcccb75
⛔ Files ignored due to path filters (3)
apis/grpc/v1/payload/payload.pb.gois excluded by!**/*.pb.go,!**/*.pb.goapis/grpc/v1/payload/payload_vtproto.pb.gois excluded by!**/*.pb.go,!**/*.pb.go,!**/*_vtproto.pb.gorust/libs/proto/src/payload/v1/payload.v1.serde.rsis excluded by!**/*.serde.rs
📒 Files selected for processing (5)
apis/docs/v1/docs.mdapis/docs/v1/payload.md.tmplapis/proto/v1/payload/payload.protopkg/gateway/lb/handler/grpc/index.gorust/libs/proto/src/payload/v1/payload.v1.rs
This reverts commit 628704b.
There was a problem hiding this comment.
IndexStatistics can panic when all agent responses have Valid=false. mergeInfoIndexStatistics skips invalid entries but still indexes into empty slices.
There was a problem hiding this comment.
@Matts966
I'll fix the empty slice issue.
As a related question, I noticed we are currently dividing by len(stats) to calculate the averages at the end. Since we are skipping the invalid entries, shouldn't we use the actual number of valid entries as the denominator instead?
Please let me know if I should include this fix as well.
There was a problem hiding this comment.
@jumpei527
I think you are correct. Please use the actual number of valid entries.
Profile Report
|








Description
#3243 implemented the
ResourceStatsAPI for future resource control. This PR addsResourceStatsDetailAPI to easily aggregate ResourceStats data from all agents.What Changed:
rpc.v1.StatsDetailservice toapis/proto/v1/rpc/stats/stats.proto.ResourceStatsDetail(payload.v1.Empty) returns (payload.v1.Info.Stats.ResourceStatsDetail).Info.Statsfor detail response (ResourceStatsDetail).ResourceStatsDetailon gateway LB handler to aggregateResourceStatsfrom agents.ResourceStatsDetailon NGT/Faiss agent handlers to return self-only detail.StatsDetailservice in gateway and agent gRPC registration paths.resource_stats_detailoperation support in E2E v2 config/binding/strategy routing.stats_test.go).ResourceStatsDetailscenarios tounary_crud.yaml,stream_crud.yaml, andmulti_crud.yaml.Related Issue
#3274
Versions
Checklist
Special notes for your reviewer
Summary by CodeRabbit
New Features
Tests
Chores