-
Notifications
You must be signed in to change notification settings - Fork 11
Restore container_id local resource ID when present. #51
Conversation
|
Is there a link to the original PR that removes it? It would be nice to compare them. |
qingling128
left a comment
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.
Thanks @dhrupadb! LGTM.
supriyagarg
left a comment
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.
Very minor comments. Otherwise LGTM.
src/kubernetes.cc
Outdated
| const std::string docker_id = | ||
| container_status->Get<json::String>("containerID"); | ||
| if (docker_id.compare(0, docker_prefix_end, kDockerIdPrefix) != 0) { | ||
| LOG(ERROR) << "ContainerID " |
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.
ContainerID -> containerID to match the field name?
Or simply "Container 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.
Updated.
src/kubernetes.cc
Outdated
| }; | ||
|
|
||
| if (container_status) { | ||
| std::size_t docker_prefix_end = sizeof(kDockerIdPrefix) - 1; |
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.
perhaps use strlen here (instead of sizeof) so you don't have to subtract by 1.
Also, docker_prefix_end -> docker_prefix_len is easier to parse.
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.
sizeof makes it a compile-time constant... I'd declare this constexpr, anyway...
As for end vs len, "len" is an abbreviation, so maybe even "length" or "count" (see the signature of compare). I used end because it's the position of the '\0', which is the end of the C string...
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.
Should we go with docker_prefix_length? As for the constexpr request, are you just asking for me to prefix this line with that?
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.
docker_prefix_length SGTM. And yes, please prefix the variable declaration with constexpr.
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.
Updated, stayed away from constexpr due to a modification within the conditional statement.
igorpeshansky
left a comment
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.
LGTM ![]()
No description provided.