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

Conversation

@igorpeshansky
Copy link
Contributor

Also remove the unused container_id.

Copy link
Contributor

@dhrupadb dhrupadb left a comment

Choose a reason for hiding this comment

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

LGTM 👌

for (const json::value& c_spec : *container_specs) {
if (config_.VerboseLogging()) {
LOG(INFO) << "Container: " << *c_status;
LOG(INFO) << "Container: " << *c_spec;
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming the spec has a lot more in it than just the status -- might this make it too chatty?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the comment, however, this is only being displayed if verbose logging is enabled, so I'm ok with keeping it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh, the status object isn't that small either. At some point the code logged both, so I figured I was just changing the order, but I guess the logging of the spec got lost.
Just pushed a commit that also logs the status. The config option says "verbose logging", so some chattiness should be expected, and it's helpful in debugging the processing of the incoming JSON.

result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, container_status, container_spec,
GetContainerMetadata(pod, container_spec, container_status,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: generally not sure why you reversed the args here, but whatever the order ends up being, it'd be nice if it lined up with the definitions above. That way the code reads consistently throughout. Either reverse the order of the params, or the order of the definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, though -- container_spec is now declared in the loop header, and container_status is retrieved by name later. What am I missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't zoom out and realize this is being invoked inside of the loop. This looks good now that I better understand.

continue;
const json::Object* container_spec = c_spec->As<json::Object>();
const std::string name = container_spec->Get<json::String>("name");
auto status_it = container_status_by_name.find(name);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "_it" mean here? "is there"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Short for "iterator". Fairly standard C++ convention.

Copy link
Contributor

Choose a reason for hiding this comment

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

SG

for (const json::value& c_spec : *container_specs) {
if (config_.VerboseLogging()) {
LOG(INFO) << "Container: " << *c_status;
LOG(INFO) << "Container: " << *c_spec;
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the comment, however, this is only being displayed if verbose logging is enabled, so I'm ok with keeping it.

Copy link
Contributor

@bmoyles0117 bmoyles0117 left a comment

Choose a reason for hiding this comment

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

Forgot to request changes.

Copy link
Contributor Author

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

PTAL.

continue;
const json::Object* container_spec = c_spec->As<json::Object>();
const std::string name = container_spec->Get<json::String>("name");
auto status_it = container_status_by_name.find(name);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Short for "iterator". Fairly standard C++ convention.

result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, container_status, container_spec,
GetContainerMetadata(pod, container_spec, container_status,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, though -- container_spec is now declared in the loop header, and container_status is retrieved by name later. What am I missing?

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.

LGTM

Copy link
Contributor

@bmoyles0117 bmoyles0117 left a comment

Choose a reason for hiding this comment

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

LGTM

continue;
const json::Object* container_spec = c_spec->As<json::Object>();
const std::string name = container_spec->Get<json::String>("name");
auto status_it = container_status_by_name.find(name);
Copy link
Contributor

Choose a reason for hiding this comment

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

SG

result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, container_status, container_spec,
GetContainerMetadata(pod, container_spec, container_status,
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't zoom out and realize this is being invoked inside of the loop. This looks good now that I better understand.

@igorpeshansky igorpeshansky merged commit 1522909 into master Jan 12, 2018
@igorpeshansky igorpeshansky deleted the igorp-missing-container-statuses branch January 12, 2018 23:42
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.

4 participants