Revert "Revert "[otel] Add bazel dependency"" (#33560)
Reverts grpc/grpc#33559
This commit is contained in:
parent
017153a0c5
commit
98417f3bd0
|
|
@ -72,6 +72,8 @@ def _get_external_deps(external_deps):
|
|||
ret.append("@com_google_absl//" + dep)
|
||||
elif dep.startswith("google/"):
|
||||
ret.append("@com_google_googleapis//" + dep)
|
||||
elif dep.startswith("otel/"):
|
||||
ret.append(dep.replace("otel/", "@io_opentelemetry_cpp//"))
|
||||
else:
|
||||
ret.append("//external:" + dep)
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -510,6 +510,17 @@ def grpc_deps():
|
|||
],
|
||||
)
|
||||
|
||||
if "io_opentelemetry_cpp" not in native.existing_rules():
|
||||
http_archive(
|
||||
name = "io_opentelemetry_cpp",
|
||||
sha256 = "668de24f81c8d36d75092ad9dcb02a97cd41473adbe72485ece05e336db48249",
|
||||
strip_prefix = "opentelemetry-cpp-1.9.1",
|
||||
urls = [
|
||||
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.9.1.tar.gz",
|
||||
"https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.9.1.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
grpc_python_deps()
|
||||
|
||||
# TODO: move some dependencies from "grpc_deps" here?
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
# Copyright 2023 gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
grpc_package(
|
||||
name = "test/cpp/ext/filters/otel",
|
||||
visibility = "tests",
|
||||
)
|
||||
|
||||
grpc_cc_test(
|
||||
name = "otel_plugin_test",
|
||||
srcs = [
|
||||
"otel_plugin_test.cc",
|
||||
],
|
||||
external_deps = [
|
||||
"gtest",
|
||||
"otel/api",
|
||||
"otel/sdk/src/metrics",
|
||||
],
|
||||
language = "C++",
|
||||
tags = [
|
||||
],
|
||||
deps = ["//test/core/util:grpc_test_util"],
|
||||
)
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
//
|
||||
// Copyright 2023 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
|
||||
#include "api/include/opentelemetry/metrics/provider.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "sdk/include/opentelemetry/sdk/metrics/meter_provider.h"
|
||||
|
||||
#include "test/core/util/test_config.h"
|
||||
|
||||
namespace grpc {
|
||||
namespace testing {
|
||||
namespace {
|
||||
|
||||
TEST(OTelPluginTest, ApiDependency) {
|
||||
opentelemetry::metrics::Provider::GetMeterProvider();
|
||||
}
|
||||
|
||||
TEST(OTelPluginTest, SdkDependency) {
|
||||
opentelemetry::sdk::metrics::MeterProvider();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace testing
|
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
grpc::testing::TestEnvironment env(&argc, argv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
|
@ -736,6 +736,13 @@ def _exclude_unwanted_cc_tests(tests: List[str]) -> List[str]:
|
|||
and not test.startswith("test/cpp/interop:observability_interop")
|
||||
]
|
||||
|
||||
# we have not added otel dependency outside of bazel
|
||||
tests = [
|
||||
test
|
||||
for test in tests
|
||||
if not test.startswith("test/cpp/ext/filters/otel:")
|
||||
]
|
||||
|
||||
# missing opencensus/stats/stats.h
|
||||
tests = [
|
||||
test
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ EXTERNAL_DEPS = {
|
|||
"absl/types/variant.h": "absl/types:variant",
|
||||
"absl/utility/utility.h": "absl/utility",
|
||||
"address_sorting/address_sorting.h": "address_sorting",
|
||||
"api/include/opentelemetry/metrics/provider.h": "otel/api",
|
||||
"sdk/include/opentelemetry/sdk/metrics/meter_provider.h": "otel/sdk/src/metrics",
|
||||
"ares.h": "cares",
|
||||
"fuzztest/fuzztest.h": ["fuzztest", "fuzztest_main"],
|
||||
"google/api/monitored_resource.pb.h": (
|
||||
|
|
@ -379,6 +381,7 @@ for dirname in [
|
|||
"test/core/promise",
|
||||
"test/core/resource_quota",
|
||||
"test/core/transport/chaotic_good",
|
||||
"test/cpp/ext/filters/otel",
|
||||
"fuzztest",
|
||||
"fuzztest/core/channel",
|
||||
]:
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ _GRPC_DEP_NAMES = [
|
|||
"com_google_absl",
|
||||
"com_google_fuzztest",
|
||||
"io_opencensus_cpp",
|
||||
"io_opentelemetry_cpp",
|
||||
"envoy_api",
|
||||
_BAZEL_SKYLIB_DEP_NAME,
|
||||
_BAZEL_TOOLCHAINS_DEP_NAME,
|
||||
|
|
@ -86,6 +87,7 @@ _GRPC_BAZEL_ONLY_DEPS = [
|
|||
"com_google_absl",
|
||||
"com_google_fuzztest",
|
||||
"io_opencensus_cpp",
|
||||
"io_opentelemetry_cpp",
|
||||
_BAZEL_SKYLIB_DEP_NAME,
|
||||
_BAZEL_TOOLCHAINS_DEP_NAME,
|
||||
_BAZEL_COMPDB_DEP_NAME,
|
||||
|
|
|
|||
Loading…
Reference in New Issue