-
Notifications
You must be signed in to change notification settings - Fork 11
Wrap pod callback for pod and container metadata with a try/catch. #77
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1049,9 +1049,13 @@ void KubernetesReader::PodCallback( | |
| MetadataUpdater::UpdateCallback callback, | ||
| const json::Object* pod, Timestamp collected_at, bool is_deleted) const | ||
| throw(json::Exception) { | ||
| std::vector<MetadataUpdater::ResourceMetadata> result_vector = | ||
| GetPodAndContainerMetadata(pod, collected_at, is_deleted); | ||
| callback(std::move(result_vector)); | ||
| try { | ||
| std::vector<MetadataUpdater::ResourceMetadata> result_vector = | ||
| GetPodAndContainerMetadata(pod, collected_at, is_deleted); | ||
| callback(std::move(result_vector)); | ||
| } catch (const json::Exception& e) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is the right fix for the situation -- this will simply ignore a JSON error. The assumption here is that if we got an invalid hunk of JSON, the rest of the hunks will also be garbage, so we shouldn't bother with the current connection -- it's better to re-establish the watch. |
||
| LOG(ERROR) << e.what(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple of questions:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1. This should have been logged in |
||
| } | ||
|
|
||
| void KubernetesReader::WatchPods(MetadataUpdater::UpdateCallback callback) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
update the method signature - since the exception is being caught and logged, the throw(..) can be dropped.