Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@bmoyles0117
Copy link
Contributor

No description provided.

@qingling128
Copy link

Is there a link to the original PR that removes it? It would be nice to compare them.

@dhrupadb
Copy link
Contributor

Yes. #49 . Specifically commit#: 744963c

Copy link

@qingling128 qingling128 left a comment

Choose a reason for hiding this comment

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

Thanks @dhrupadb! LGTM.

Copy link
Contributor

@supriyagarg supriyagarg left a 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.

const std::string docker_id =
container_status->Get<json::String>("containerID");
if (docker_id.compare(0, docker_prefix_end, kDockerIdPrefix) != 0) {
LOG(ERROR) << "ContainerID "
Copy link
Contributor

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

};

if (container_status) {
std::size_t docker_prefix_end = sizeof(kDockerIdPrefix) - 1;
Copy link
Contributor

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.

Copy link
Contributor

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...

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@bmoyles0117 bmoyles0117 removed the request for review from dhrupadb February 2, 2018 16:38
@igorpeshansky igorpeshansky changed the title Restore docker container local resource ID when present. Restore container_id local resource ID when present. Feb 2, 2018
Copy link
Contributor

@igorpeshansky igorpeshansky left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

@bmoyles0117 bmoyles0117 merged commit 4cc3dd6 into master Feb 2, 2018
@bmoyles0117 bmoyles0117 deleted the bmoyles0117-add-kubernetes-container-id branch February 2, 2018 18:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants