Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: pubsub-otel #291

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pubsub-open-telemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ cmake --build .build --target quickstart
#### Run the quickstart

```shell
.build/quickstart [project-name] [topic-id]
alevenberg marked this conversation as resolved.
Show resolved Hide resolved
.build/quickstart ${GOOGLE_CLOUD_PROJECT} ${GOOGLE_CLOUD_TOPIC}
```

## Build and run using Bazel
Expand All @@ -139,13 +139,14 @@ bazel build //:quickstart
#### Run the quickstart

```shell
bazel run //:quickstart [project-name] [topic-id]
bazel run //:quickstart -- ${GOOGLE_CLOUD_PROJECT} ${GOOGLE_CLOUD_TOPIC}
```

#### Run with a local version of google-cloud-cpp

```shell
bazel run //:quickstart --override_repository=google_cloud_cpp=$HOME/your-path-to-the-repo/google-cloud-cpp -- [project-name] [topic-id]
bazel run --override_repository=google_cloud_cpp=$HOME/your-path-to-the-repo/google-cloud-cpp \
//:quickstart -- ${GOOGLE_CLOUD_PROJECT} ${GOOGLE_CLOUD_TOPIC}
```

## Cleanup
Expand Down
12 changes: 6 additions & 6 deletions pubsub-open-telemetry/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@
#include <utility>
#include <vector>

// Create a few namespace aliases to make the code easier to read.
namespace gc = ::google::cloud;
namespace pubsub = gc::pubsub;
namespace otel = gc::otel;

int main(int argc, char* argv[]) try {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " <project-id> <topic-id>\n";
return 1;
}
std::string const project_id = argv[1];
std::string const topic_id = argv[2];
auto project = gc::Project(project_id);

//! [START pubsub_publish_otel_tracing]
// Create a few namespace aliases to make the code easier to read.
namespace gc = ::google::cloud;
namespace otel = gc::otel;
namespace pubsub = gc::pubsub;

// This example uses a simple wrapper to export (upload) OTel tracing data
// to Google Cloud Trace. More complex applications may use different
// authentication, or configure their own OTel exporter.
auto project = gc::Project(project_id);
auto configuration = otel::ConfigureBasicTracing(project);

auto publisher = pubsub::Publisher(pubsub::MakePublisherConnection(
Expand Down