-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
channelz: implement GetServer method #2537
Conversation
c860d92
to
855ba2b
Compare
@@ -155,6 +155,15 @@ func GetSocket(id int64) *SocketMetric { | |||
return db.get().GetSocket(id) | |||
} | |||
|
|||
// GetServer returns the ServerMetric for the server (identified by id). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db.get().GetServers(id, 1)
may not get the result for server with the specified id. It will get the first server with id>= specified id. I think you need to implement a new function db.get().GetServer(id)
on the channelMap
struct, which will find the server with the specified id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will get the first server with id>= specified id.
Yes, that's right. So I checks returned server matches the specified id's server.
I think you need to implement a new function
db.get().GetServer(id)
on thechannelMap
struct, which will find the server with the specified id.
OK. it's easy to understand than the current implementation. I will add the function.
friendly ping? |
855ba2b
to
51091a1
Compare
Addressed a comment. Please take a look. |
test/channelz_test.go
Outdated
|
||
ss, _ := channelz.GetServers(0, 0) | ||
if len(ss) != 1 { | ||
t.Fatalf("there should only be one servers, not %d", len(ss)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/servers/server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
51091a1
to
9f52a86
Compare
GetServer is not implemented for now.
And also fixes GetChannel, GetSubchannel, GetSocket response when requested id not found.
By gRFC spec, it should return NotFound status code, not empty message with OK.