设置 OpenCensus 以使用 Stackdriver

Setting up OpenCensus to work with Stackdriver

我正在尝试为我们的项目设置 OpenCensus,但我 运行 遇到 Bazel 问题。

error loading package '@com_google_googleapis//google/devtools/cloudtrace/v2': Unable to find package for @com_google_googleapis_imports//:imports.bzl: The repository '@com_google_googleapis_imports' could not be resolved. and referenced by '@io_opencensus_cpp//opencensus/exporters/trace/stackdriver:stackdriver_exporter'

尝试使用 HEAD 版本时会发生这种情况。有谁知道如何解决这一问题? Googleapis 确实似乎没有任何名为 imports.bzl.

的文件

所以对于 运行 的人来说,问题是我缺少 GoogleAPIs 存储库。这是我最终得到的最终导入。

# googleapis
http_archive(
    name = "com_google_googleapis",
    sha256 = "0744d1a1834ab350126b12ebe2b4bb1c8feb5883bd1ba0a6e876cb741d569994",
    strip_prefix = "googleapis-bcc476396e799806d3355e87246c6becf6250a70",
    urls = ["https://github.com/googleapis/googleapis/archive/bcc476396e799806d3355e87246c6becf6250a70.tar.gz"],
)

load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
switched_rules_by_language(
    name = "com_google_googleapis_imports",
    cc = True,
    grpc = True,
)

# opencensus
http_archive(
    name = "io_opencensus_cpp",
    sha256 = "193ffb4e13bd7886757fd22b61b7f7a400634412ad8e7e1071e73f57bedd7fc6",
    strip_prefix = "opencensus-cpp-04ed0211931f12b03c1a76b3907248ca4db7bc90",
    urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/04ed0211931f12b03c1a76b3907248ca4db7bc90.tar.gz"],
)

load("@io_opencensus_cpp//bazel:deps.bzl", "opencensus_cpp_deps")

opencensus_cpp_deps()