Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit fdf0f30

Browse files
authored
Print non-empty view data after waiting for the delta producer. (#155)
1 parent 836fa4e commit fdf0f30

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/helloworld/helloworld.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,18 @@ int main(int argc, char **argv) {
100100
span.AddAnnotation("Finished processing video.");
101101
span.End();
102102

103-
// Report view data.
104103
std::cout << "video_size_view definitions:" << video_size_view.DebugString()
105-
<< "\nView data:\n";
104+
<< "\n\n";
105+
106+
std::cout << "Waiting 10.1s for exporters to run...\n\n";
107+
absl::SleepFor(absl::Milliseconds(10100));
108+
109+
std::cout << "View data:\n";
106110
const auto data = view.GetData();
107111
assert(data.type() == opencensus::stats::ViewData::Type::kDistribution);
108112
for (auto &it : data.distribution_data()) {
109113
std::cout << " ";
110114
for (auto &name : it.first) std::cout << name << " : ";
111115
std::cout << it.second.DebugString() << "\n";
112116
}
113-
114-
std::cout << "\nWaiting for exporters to run...\n";
115-
absl::SleepFor(absl::Milliseconds(5100));
116117
}

0 commit comments

Comments
 (0)