MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cpp-samples / main

Function main

pubsub-open-telemetry/publisher.cc:43–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43int main(int argc, char* argv[]) try {
44 auto args = ParseArguments(argc, argv);
45 if (args.project_id.empty() && args.topic_id.empty()) {
46 return 1;
47 }
48 std::cout << "Using project `" << args.project_id << "` and topic `"
49 << args.topic_id << "`\n";
50
51 // Automatically call `Cleanup()` before returning from `main()`.
52 std::shared_ptr<void> cleanup(nullptr, [](void*) { Cleanup(); });
53
54 ConfigureCloudTraceTracer(args);
55
56 auto publisher = CreatePublisher(args);
57
58 Publish(publisher, args);
59
60 return 0;
61} catch (google::cloud::Status const& status) {
62 std::cerr << "google::cloud::Status thrown: " << status << "\n";
63 return 1;
64}

Callers

nothing calls this directly

Calls 5

CreatePublisherFunction · 0.85
ParseArgumentsFunction · 0.70
CleanupFunction · 0.70
PublishFunction · 0.70

Tested by

no test coverage detected