[OTel C++] Add CMake build support (#36063)

Changes -
* Add CMake build support to `grpcpp_otel_plugin`. Currently, we are only supporting the `find_package CONFIG` method for depending on `opentelemetry-cpp`.
* Since, `grpcpp_otel_plugin` is an extension of gRPC, it will not be built by default. To enable building of this target, a new CMake option `gRPC_BUILD_GRPCPP_OTEL_PLUGIN` is being added.
* Also add `CMakeLists.txt` to the otel example.

The `otel_plugin_test` can also be built through cmake but, for the CI to work, there are some additional changes. Those will be made in an upcoming PR.

Closes #36063

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36063 from yashykt:OTelCMakeSupport 3bc783823b
PiperOrigin-RevId: 613734473
pull/36087/head
Yash Tibrewal 11 months ago committed by Copybara-Service
parent 675dcccd5e
commit 3032b5c48d
  1. 109
      CMakeLists.txt
  2. 1
      bazel/grpc_build_system.bzl
  3. 18
      build_autogenerated.yaml
  4. 44
      cmake/opentelemetry-cpp.cmake
  5. 79
      examples/cpp/otel/CMakeLists.txt
  6. 9
      examples/cpp/otel/README.md
  7. 13
      grpc.gyp
  8. 20
      templates/CMakeLists.txt.template
  9. 1
      templates/README.md
  10. 2
      test/cpp/ext/csm/metadata_exchange_test.cc
  11. 2
      test/cpp/ext/otel/otel_plugin_test.cc
  12. 2
      test/cpp/ext/otel/otel_test_library.cc
  13. 2
      test/cpp/ext/otel/otel_test_library.h
  14. 8
      tools/buildgen/extract_metadata_from_bazel_xml.py

109
CMakeLists.txt generated

@ -224,6 +224,11 @@ set(gRPC_ABSL_USED_TARGETS
absl_meta
)
# The OpenTelemetry plugin support "package" build only at present.
set(gRPC_OPENTELEMETRY_PROVIDER "package")
# set(gRPC_OPENTELEMETRY_PROVIDER "module" CACHE STRING "Provider of opentelemetry library")
# set_property(CACHE gRPC_OPENTELEMETRY_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library")
if(UNIX)
@ -348,6 +353,11 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX)
set(_gRPC_ALLTARGETS_LIBRARIES ${_gRPC_ALLTARGETS_LIBRARIES} ${_gRPC_SYSTEMD_LIBRARIES})
endif()
option(gRPC_BUILD_GRPCPP_OTEL_PLUGIN "Build grpcpp_otel_plugin" OFF)
if(gRPC_BUILD_GRPCPP_OTEL_PLUGIN)
include(cmake/opentelemetry-cpp.cmake)
endif()
# Setup external proto library at third_party/envoy-api with 2 download URLs
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/envoy-api AND gRPC_DOWNLOAD_ARCHIVES)
# Download the archive via HTTP, validate the checksum, and extract to third_party/envoy-api.
@ -1610,7 +1620,6 @@ if(gRPC_INSTALL)
endif()
add_library(gpr
src/core/lib/config/config_vars.cc
src/core/lib/config/config_vars_non_generated.cc
@ -1775,7 +1784,6 @@ if(gRPC_INSTALL)
endif()
add_library(grpc
src/core/client_channel/backup_poller.cc
src/core/client_channel/client_channel_channelz.cc
@ -2744,7 +2752,6 @@ endif()
if(gRPC_BUILD_TESTS)
add_library(grpc_test_util
test/core/event_engine/test_init.cc
test/core/util/build.cc
@ -2811,7 +2818,6 @@ endif()
endif()
if(gRPC_BUILD_TESTS)
add_library(grpc_test_util_unsecure
test/core/event_engine/test_init.cc
test/core/util/build.cc
@ -2876,7 +2882,6 @@ endif()
endif()
add_library(grpc_unsecure
src/core/client_channel/backup_poller.cc
src/core/client_channel/client_channel_channelz.cc
@ -3451,7 +3456,6 @@ endif()
if(gRPC_BUILD_TESTS)
add_library(gtest
third_party/googletest/googlemock/src/gmock-cardinalities.cc
third_party/googletest/googlemock/src/gmock-internal-utils.cc
@ -3524,7 +3528,6 @@ target_link_libraries(gtest
endif()
add_library(upb_base_lib
third_party/upb/upb/base/status.c
)
@ -3576,7 +3579,6 @@ if(gRPC_INSTALL)
endif()
add_library(upb_json_lib ${_gRPC_STATIC_WIN32}
src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.c
third_party/upb/upb/json/decode.c
@ -3664,7 +3666,6 @@ if(gRPC_INSTALL)
endif()
add_library(upb_mem_lib
third_party/upb/upb/mem/alloc.c
third_party/upb/upb/mem/arena.c
@ -3717,7 +3718,6 @@ if(gRPC_INSTALL)
endif()
add_library(upb_message_lib
third_party/upb/upb/hash/common.c
third_party/upb/upb/message/array.c
@ -3778,7 +3778,6 @@ if(gRPC_INSTALL)
endif()
add_library(upb_textformat_lib ${_gRPC_STATIC_WIN32}
src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.c
third_party/upb/upb/lex/atoi.c
@ -3865,7 +3864,6 @@ if(gRPC_INSTALL)
endif()
add_library(utf8_range_lib
third_party/utf8_range/naive.c
third_party/utf8_range/range2-neon.c
@ -3921,7 +3919,6 @@ endif()
if(gRPC_BUILD_TESTS)
if(gRPC_BUILD_CODEGEN)
add_library(benchmark_helpers ${_gRPC_STATIC_WIN32}
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.cc
@ -4004,7 +4001,6 @@ endif()
endif()
add_library(grpc++
src/core/ext/transport/binder/client/binder_connector.cc
src/core/ext/transport/binder/client/channel_create.cc
@ -4345,7 +4341,6 @@ if(gRPC_INSTALL)
endif()
add_library(grpc++_alts
src/cpp/common/alts_context.cc
src/cpp/common/alts_util.cc
@ -4419,7 +4414,6 @@ if(gRPC_INSTALL)
endif()
add_library(grpc++_error_details
src/cpp/util/error_details.cc
)
@ -4492,7 +4486,6 @@ endif()
if(gRPC_BUILD_CODEGEN)
add_library(grpc++_reflection ${_gRPC_STATIC_WIN32}
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1/reflection.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1/reflection.grpc.pb.cc
@ -4577,7 +4570,6 @@ endif()
endif()
if(gRPC_BUILD_TESTS)
add_library(grpc++_test
src/cpp/client/channel_test_peer.cc
)
@ -4651,7 +4643,6 @@ endforeach()
endif()
if(gRPC_BUILD_TESTS)
add_library(grpc++_test_config
test/cpp/util/test_config_cc.cc
)
@ -4704,7 +4695,6 @@ target_link_libraries(grpc++_test_config
endif()
if(gRPC_BUILD_TESTS)
add_library(grpc++_test_util
src/core/lib/gpr/subprocess_posix.cc
src/core/lib/gpr/subprocess_windows.cc
@ -4777,7 +4767,6 @@ target_link_libraries(grpc++_test_util
endif()
add_library(grpc++_unsecure
src/cpp/client/channel_cc.cc
src/cpp/client/client_callback.cc
@ -5086,7 +5075,6 @@ if(gRPC_INSTALL)
endif()
add_library(grpc_authorization_provider
src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c
src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.c
@ -5524,7 +5512,6 @@ if(gRPC_INSTALL)
endif()
add_library(grpc_plugin_support
src/compiler/cpp_generator.cc
src/compiler/csharp_generator.cc
@ -5599,7 +5586,6 @@ endif()
# grpcpp_channelz doesn't build with protobuf-lite
# See https://github.com/grpc/grpc/issues/19473
if(gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE)
add_library(grpcpp_channelz ${_gRPC_STATIC_WIN32}
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.cc
@ -5678,6 +5664,81 @@ if(gRPC_INSTALL AND NOT gRPC_USE_PROTO_LITE)
)
endif()
endif()
if(gRPC_BUILD_GRPCPP_OTEL_PLUGIN)
add_library(grpcpp_otel_plugin
src/cpp/ext/otel/otel_client_filter.cc
src/cpp/ext/otel/otel_plugin.cc
src/cpp/ext/otel/otel_server_call_tracer.cc
)
target_compile_features(grpcpp_otel_plugin PUBLIC cxx_std_14)
set_target_properties(grpcpp_otel_plugin PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpcpp_otel_plugin PROPERTIES COMPILE_PDB_NAME "grpcpp_otel_plugin"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(grpcpp_otel_plugin
PRIVATE
"GPR_DLL_IMPORTS"
"GRPC_DLL_IMPORTS"
"GRPCXX_DLL_IMPORTS"
)
endif()
if(gRPC_INSTALL)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpcpp_otel_plugin.pdb
DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL
)
endif()
endif()
target_include_directories(grpcpp_otel_plugin
PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_RE2_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_XXHASH_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(grpcpp_otel_plugin
${_gRPC_ALLTARGETS_LIBRARIES}
grpc++
opentelemetry-cpp::api
)
foreach(_hdr
include/grpcpp/ext/otel_plugin.h
)
string(REPLACE "include/" "" _path ${_hdr})
get_filename_component(_path ${_path} PATH)
install(FILES ${_hdr}
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
)
endforeach()
if(gRPC_INSTALL)
install(TARGETS grpcpp_otel_plugin EXPORT gRPCTargets
RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
BUNDLE DESTINATION ${gRPC_INSTALL_BINDIR}
LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
endif()
if(gRPC_BUILD_TESTS)

@ -204,7 +204,6 @@ def grpc_cc_library(
testonly = testonly,
linkopts = linkopts,
includes = [
"api/include",
"include",
"src/core/ext/upb-gen", # Once upb code-gen issue is resolved, remove this.
"src/core/ext/upbdefs-gen", # Once upb code-gen issue is resolved, remove this.

@ -5097,6 +5097,24 @@ libs:
- src/cpp/server/channelz/channelz_service_plugin.cc
deps:
- grpc++
- name: grpcpp_otel_plugin
build: plugin
language: c++
public_headers:
- include/grpcpp/ext/otel_plugin.h
headers:
- src/cpp/ext/otel/key_value_iterable.h
- src/cpp/ext/otel/otel_call_tracer.h
- src/cpp/ext/otel/otel_client_filter.h
- src/cpp/ext/otel/otel_plugin.h
- src/cpp/ext/otel/otel_server_call_tracer.h
src:
- src/cpp/ext/otel/otel_client_filter.cc
- src/cpp/ext/otel/otel_plugin.cc
- src/cpp/ext/otel/otel_server_call_tracer.cc
deps:
- grpc++
- opentelemetry-cpp::api
targets:
- name: fd_conservation_posix_test
build: test

@ -0,0 +1,44 @@
# Copyright 2024 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.
if(TARGET opentelemetry-cpp::api)
# If opentelemetry is included already, skip including it.
# OpenTelemetry does not work with "module" mode at present.
# elseif(gRPC_OPENTELEMETRY_PROVIDER STREQUAL "module")
# if(NOT OPENTELEMETRY_ROOT_DIR)
# set(OPENTELEMETRY_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-cpp)
# endif()
# set(BUILD_TESTING OFF)
# if(NOT gRPC_BUILD_TESTS)
# set(WITH_API_ONLY ON)
# endif()
# set(WITH_ABSEIL ON)
# include_directories(${OPENTELEMETRY_ROOT_DIR} "${OPENTELEMETRY_ROOT_DIR}/api/include")
# add_subdirectory(${OPENTELEMETRY_ROOT_DIR} third_party/opentelemetry-cpp)
# if(EXISTS "${OPENTELEMETRY_ROOT_DIR}/CMakeLists.txt")
# Unclear whether we should install OpenTelemetry along with gRPC
# if(gRPC_INSTALL AND _gRPC_INSTALL_SUPPORTED_FROM_MODULE)
# set(OPENTELEMETRY_INSTALL ON)
# endif()
# else()
# message(WARNING "gRPC_OPENTELEMETRY_PROVIDER is \"module\" but OPENTELEMETRY_ROOT_DIR is wrong")
# endif()
# if(gRPC_INSTALL AND NOT _gRPC_INSTALL_SUPPORTED_FROM_MODULE)
# message(WARNING "gRPC_INSTALL will be forced to FALSE because gRPC_OPENTELEMETRY_PROVIDER is \"module\" and CMake version (${CMAKE_VERSION}) is less than 3.13.")
# set(gRPC_INSTALL FALSE)
# endif()
elseif(gRPC_OPENTELEMETRY_PROVIDER STREQUAL "package")
find_package(opentelemetry-cpp CONFIG REQUIRED)
endif()
set(_gRPC_FIND_OPENTELEMETRY "if(NOT TARGET opentelemetry-cpp::opentelemetry_api)\n find_package(opentelemetry-cpp)\nendif()")

@ -0,0 +1,79 @@
# Copyright 2018 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.
#
# cmake build file for C++ gRPC OpenTelemetry example.
# Assumes absl, protobuf, prometheus-cpp, opentelemetry-cpp and gRPC (with -DgRPC_BUILD_OPENTELEMETRY_PLUGIN=ON) have been installed using cmake.
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build
# that automatically builds all the dependencies before building helloworld.
cmake_minimum_required(VERSION 3.13)
project(grpc_opentelemetry_example C CXX)
include(../cmake/common.cmake)
# Find prometheus-cpp package
find_package(prometheus-cpp CONFIG REQUIRED)
# Find opentelemetry-cpp package
find_package(opentelemetry-cpp CONFIG REQUIRED)
# Proto file
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE)
get_filename_component(hw_proto_path "${hw_proto}" PATH)
# Generated sources
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc")
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h")
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h")
add_custom_command(
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${hw_proto_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${hw_proto}"
DEPENDS "${hw_proto}")
# Include generated *.pb.h files
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
# hw_grpc_proto
add_library(hw_grpc_proto
${hw_grpc_srcs}
${hw_grpc_hdrs}
${hw_proto_srcs}
${hw_proto_hdrs})
target_link_libraries(hw_grpc_proto
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
# Targets greeter_callback_(client|server)
foreach(_target
greeter_callback_client greeter_callback_server)
add_executable(${_target} "${_target}.cc")
target_link_libraries(${_target}
hw_grpc_proto
absl::flags
absl::flags_parse
opentelemetry-cpp::metrics
opentelemetry-cpp::prometheus_exporter
${_REFLECTION}
${_GRPC_GRPCPP}
gRPC::grpcpp_otel_plugin
${_PROTOBUF_LIBPROTOBUF})
endforeach()

@ -39,6 +39,15 @@ $ curl localhost:9465/metrics
> ***NOTE:*** If the prometheus endpoint configured is overridden, please update
> the target in the above curl command.
## CMake Instructions
The following libraries need to be installed before building the example with CMake -
* absl
* protobuf
* prometheus-cpp
* opentelemetry-cpp (with the options `-DWITH_ABSEIL=ON` `-DWITH_PROMETHEUS=ON`)
* grpc (with the option `-DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON`)
You can find a complete set of instructions for building gRPC and running the
Hello World app in the [C++ Quick Start][].

13
grpc.gyp generated

@ -2363,6 +2363,19 @@
'src/cpp/server/channelz/channelz_service_plugin.cc',
],
},
{
'target_name': 'grpcpp_otel_plugin',
'type': 'static_library',
'dependencies': [
'grpc++',
'opentelemetry-cpp::api',
],
'sources': [
'src/cpp/ext/otel/otel_client_filter.cc',
'src/cpp/ext/otel/otel_plugin.cc',
'src/cpp/ext/otel/otel_server_call_tracer.cc',
],
},
{
'target_name': 'boringssl',
'type': 'static_library',

@ -200,7 +200,7 @@
def is_generate_cmake_target(lib_or_target):
"""Returns True if a cmake target should be generated for given library/target."""
# TODO(jtattermusch): extract the metadata to a centralized location.
if lib_or_target.build not in ["all", "protoc", "tool", "test", "private"]:
if lib_or_target.build not in ["all", "plugin", "protoc", "tool", "test", "private"]:
return False
if lib_or_target.boringssl:
# Don't generate target for boringssl libs or tests
@ -361,6 +361,11 @@
absl_meta
)
# The OpenTelemetry plugin support "package" build only at present.
set(gRPC_OPENTELEMETRY_PROVIDER "package")
# set(gRPC_OPENTELEMETRY_PROVIDER "module" CACHE STRING "Provider of opentelemetry library")
# set_property(CACHE gRPC_OPENTELEMETRY_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library")
if(UNIX)
@ -486,6 +491,11 @@
set(_gRPC_ALLTARGETS_LIBRARIES <%text>${_gRPC_ALLTARGETS_LIBRARIES}</%text> <%text>${_gRPC_SYSTEMD_LIBRARIES}</%text>)
endif()
option(gRPC_BUILD_GRPCPP_OTEL_PLUGIN "Build grpcpp_otel_plugin" OFF)
if(gRPC_BUILD_GRPCPP_OTEL_PLUGIN)
include(cmake/opentelemetry-cpp.cmake)
endif()
% for external_proto_library in external_proto_libraries:
% if len(external_proto_library.urls) > 1:
# Setup external proto library at ${external_proto_library.destination} with ${len(external_proto_library.urls)} download URLs
@ -727,12 +737,16 @@
if not is_generate_cmake_target(lib): continue
cmake_libs.append(lib)
%>
% for lib in cmake_libs:
% if lib.build in ["test", "private"]:
if(gRPC_BUILD_TESTS)
${cc_library(lib)}
endif()
% else:
% if lib.build in ["plugin"]:
if(gRPC_BUILD_${lib.name.upper()})
% endif
${cc_library(lib)}
% if not lib.build in ["tool"]:
% if any(proto_re.match(src) for src in lib.src):
@ -743,6 +757,9 @@
endif()
% endif
% endif
% if lib.build in ["plugin"]:
endif()
% endif
% endif
% endfor
@ -782,7 +799,6 @@
if(gRPC_BUILD_CODEGEN)
% endif
% endif
add_library(${lib.name}${lib_type_for_lib(lib.name)}
% for src in lib.src:
% if not proto_re.match(src):

@ -89,6 +89,7 @@ dll: "..." # see below.
Currently, the "`build`" tag have these meanings:
* `"all"`: library to build on `"make all"`, and install on the system.
* `"plugin"`: library to build on `"make all"`, and install, but the corresponding CMake option defaults to off. The option needs to be declared manually at present to allow depending on third-party dependencies.
* `"protoc"`: a protoc plugin to build on `"make all"` and install on the system.
* `"private"`: a library to only build for tests.
* `"test"`: a test binary to run on `"make test"`.

@ -19,10 +19,10 @@
#include "src/cpp/ext/csm/metadata_exchange.h"
#include "absl/functional/any_invocable.h"
#include "api/include/opentelemetry/metrics/provider.h"
#include "gmock/gmock.h"
#include "google/cloud/opentelemetry/resource_detector.h"
#include "gtest/gtest.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include "opentelemetry/sdk/metrics/metric_reader.h"

@ -19,9 +19,9 @@
#include "src/cpp/ext/otel/otel_plugin.h"
#include "absl/functional/any_invocable.h"
#include "api/include/opentelemetry/metrics/provider.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include "opentelemetry/sdk/metrics/metric_reader.h"

@ -19,9 +19,9 @@
#include "test/cpp/ext/otel/otel_test_library.h"
#include "absl/functional/any_invocable.h"
#include "api/include/opentelemetry/metrics/provider.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/sdk/metrics/export/metric_producer.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include "opentelemetry/sdk/metrics/metric_reader.h"

@ -20,9 +20,9 @@
#define GRPC_TEST_CPP_EXT_OTEL_OTEL_TEST_LIBRARY_H
#include "absl/functional/any_invocable.h"
#include "api/include/opentelemetry/metrics/provider.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include "opentelemetry/sdk/metrics/metric_reader.h"

@ -351,6 +351,10 @@ def _external_dep_name_from_bazel_dependency(bazel_dep: str) -> Optional[str]:
return "protobuf"
elif bazel_dep == "@com_google_protobuf//:protoc_lib":
return "protoc"
elif bazel_dep == "@io_opentelemetry_cpp//api:api":
return "opentelemetry-cpp::api"
elif bazel_dep == "@io_opentelemetry_cpp//sdk/src/metrics:metrics":
return "opentelemetry-cpp::metrics"
else:
# Two options here:
# * either this is not external dependency at all (which is fine, we will treat it as internal library)
@ -1156,6 +1160,10 @@ _BUILD_EXTRA_METADATA = {
"generate_plugin_registry": True,
},
"grpcpp_channelz": {"language": "c++", "build": "all"},
"grpcpp_otel_plugin": {
"language": "c++",
"build": "plugin",
},
"grpc++_test": {
"language": "c++",
"build": "private",

Loading…
Cancel
Save