Skip to content

Commit

Permalink
Allow use of OTLP over gRPC, not just over HTTP. JIRA: CXX-13654.
Browse files Browse the repository at this point in the history
git-svn-id: https://anonsvn.ncbi.nlm.nih.gov/repos/v1/trunk/c++@102666 78c7ea69-d796-4a43-9a09-de51944f1b03
  • Loading branch information
ucko committed Jun 24, 2024
1 parent 16d9eb2 commit decf699
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/build-system/cmake/CMake.NCBIComponentsUNIXex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,8 @@ NCBIcomponent_report(JAEGER)
#############################################################################
# OPENTELEMETRY
NCBI_define_Xcomponent(NAME OPENTELEMETRY CMAKE_PACKAGE opentelemetry-cpp
CMAKE_LIB otlp_http_exporter ostream_span_exporter metrics)
CMAKE_LIB otlp_grpc_exporter otlp_http_exporter ostream_span_exporter
metrics)
NCBIcomponent_report(OPENTELEMETRY)

#############################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/build-system/cmake/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def configure(self):
# Not looking to use Jaeger, but the recipe might not provide
# the option and catching e.g. AttributeError won't work.
# self.options["opentelemetry-cpp"+_s].with_jaeger = False
self.options["opentelemetry-cpp"+_s].with_otlp_grpc = False
self.options["opentelemetry-cpp"+_s].with_otlp_grpc = True
# otlp-http is already on by default
# self.options["opentelemetry-cpp"+_s].with_otlp_http = True
self.options["opentelemetry-cpp"+_s].with_zipkin = False
Expand Down
22 changes: 13 additions & 9 deletions src/build-system/configure
Original file line number Diff line number Diff line change
Expand Up @@ -37118,34 +37118,38 @@ if test "$with_opentelemetry" != "no"; then
OPENTELEMETRY_LIBPATH="${ncbi_rp_L_flags}${ncbi_rp_R_flags}"
fi
fi
OPENTELEMETRY_LIBS="$OPENTELEMETRY_LIBPATH -lopentelemetry_exporter_otlp_http -lopentelemetry_exporter_otlp_http_client -lopentelemetry_otlp_recordable \
OPENTELEMETRY_LIBS="$OPENTELEMETRY_LIBPATH -lopentelemetry_exporter_otlp_grpc -lopentelemetry_exporter_otlp_grpc_client -lopentelemetry_proto_grpc \
-lopentelemetry_exporter_otlp_http \
-lopentelemetry_exporter_otlp_http_client -lopentelemetry_otlp_recordable \
-lopentelemetry_exporter_ostream_span -lopentelemetry_trace \
-lopentelemetry_proto -lopentelemetry_http_client_curl \
-lopentelemetry_logs -lopentelemetry_metrics \
-lopentelemetry_resources -lopentelemetry_common"
else
OPENTELEMETRY_INCLUDE=""
OPENTELEMETRY_LIBS="-lopentelemetry_exporter_otlp_http -lopentelemetry_exporter_otlp_http_client -lopentelemetry_otlp_recordable \
OPENTELEMETRY_LIBS="-lopentelemetry_exporter_otlp_grpc -lopentelemetry_exporter_otlp_grpc_client -lopentelemetry_proto_grpc \
-lopentelemetry_exporter_otlp_http \
-lopentelemetry_exporter_otlp_http_client -lopentelemetry_otlp_recordable \
-lopentelemetry_exporter_ostream_span -lopentelemetry_trace \
-lopentelemetry_proto -lopentelemetry_http_client_curl \
-lopentelemetry_logs -lopentelemetry_metrics \
-lopentelemetry_resources -lopentelemetry_common"
in_path=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libopentelemetry_exporter_otlp_http$in_path" >&5
$as_echo_n "checking for libopentelemetry_exporter_otlp_http$in_path... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libopentelemetry_exporter_otlp_grpc$in_path" >&5
$as_echo_n "checking for libopentelemetry_exporter_otlp_grpc$in_path... " >&6; }
if ${ncbi_cv_lib_opentelemetry+:} false; then :
$as_echo_n "(cached) " >&6
else
CPPFLAGS="$PROTOBUF_INCLUDE $OPENTELEMETRY_INCLUDE $orig_CPPFLAGS"
LIBS="$OPENTELEMETRY_LIBS $PROTOBUF_LIBS $CURL_LIBS $orig_LIBS"
CPPFLAGS="$GRPC_INCLUDE $OPENTELEMETRY_INCLUDE $orig_CPPFLAGS"
LIBS="$OPENTELEMETRY_LIBS $GRPC_LIBS $PROTOBUF_LIBS $CURL_LIBS $orig_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <opentelemetry/exporters/otlp/otlp_http_exporter.h>
#include <opentelemetry/exporters/otlp/otlp_grpc_exporter.h>
int
main ()
{
opentelemetry::exporter::otlp::OtlpHttpExporter exporter;
opentelemetry::exporter::otlp::OtlpGrpcExporter exporter;
;
return 0;
}
Expand All @@ -37172,7 +37176,7 @@ $as_echo "$ncbi_cv_lib_opentelemetry" >&6; }
OPENTELEMETRY_LIBS=
else
WithPackages="$WithPackages${WithPackagesSep}OPENTELEMETRY"; WithPackagesSep=" "
OPENTELEMETRY_INCLUDE="$PROTOBUF_INCLUDE $OPENTELEMETRY_INCLUDE"
OPENTELEMETRY_INCLUDE="$GRPC_INCLUDE $OPENTELEMETRY_INCLUDE"

$as_echo "#define HAVE_LIBOPENTELEMETRY 1" >>confdefs.h

Expand Down
12 changes: 7 additions & 5 deletions src/build-system/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -9422,15 +9422,17 @@ if test -d "$OPENTELEMETRY_PATH"; then
fi
# Not bothering with pkg-config, whose coverage is too limited.
NCBI_CHECK_THIRD_PARTY_LIB_EX(opentelemetry, OPENTELEMETRY,
opentelemetry_exporter_otlp_http,
[AC_LANG_PROGRAM([[@%:@include <opentelemetry/exporters/otlp/otlp_http_exporter.h>]],
[[opentelemetry::exporter::otlp::OtlpHttpExporter exporter;]])],
[-lopentelemetry_exporter_otlp_http_client -lopentelemetry_otlp_recordable \
opentelemetry_exporter_otlp_grpc,
[AC_LANG_PROGRAM([[@%:@include <opentelemetry/exporters/otlp/otlp_grpc_exporter.h>]],
[[opentelemetry::exporter::otlp::OtlpGrpcExporter exporter;]])],
[-lopentelemetry_exporter_otlp_grpc_client -lopentelemetry_proto_grpc \
-lopentelemetry_exporter_otlp_http \
-lopentelemetry_exporter_otlp_http_client -lopentelemetry_otlp_recordable \
-lopentelemetry_exporter_ostream_span -lopentelemetry_trace \
-lopentelemetry_proto -lopentelemetry_http_client_curl \
-lopentelemetry_logs -lopentelemetry_metrics \
-lopentelemetry_resources -lopentelemetry_common],
[$PROTOBUF_LIBS $CURL_LIBS], [$PROTOBUF_INCLUDE])
[$GRPC_LIBS $PROTOBUF_LIBS $CURL_LIBS], [$GRPC_INCLUDE])
OPENTELEMETRY_LIBS=`echo "$OPENTELEMETRY_LIBS" | sed -e 's/ */ /g'`
if test "$with_opentelemetry" != no \
-a -f "$OPENTELEMETRY_PATH/lib/libopentelemetry_proto-static.a"; then
Expand Down

0 comments on commit decf699

Please sign in to comment.
-