This repository has been archived by the owner on May 17, 2024. It is now read-only.
forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grpc: move protos to a separate library
- when compiling protos into a shared library, the shared library can not be reloaded: protocolbuffers/protobuf#4126 - it is not recommended to have multiple shared libraries with protos compiled in them: protocolbuffers/protobuf#1489 Signed-off-by: László Várady <[email protected]>
- Loading branch information
Showing
10 changed files
with
125 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ set(MODULE_GRPC_LIBS | |
gRPC::grpc++ | ||
protobuf::libprotobuf) | ||
|
||
add_subdirectory(protos) | ||
add_subdirectory(otel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
include modules/grpc/protos/Makefile.am | ||
|
||
include modules/grpc/otel/Makefile.am | ||
|
||
if ENABLE_GRPC | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
set(OTEL_PROTO_SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/opentelemetry-proto") | ||
set(OTEL_PROTO_BUILDDIR "${CMAKE_CURRENT_BINARY_DIR}/opentelemetry-proto") | ||
set(OTEL_PROTO_BUILDDIR ${OTEL_PROTO_BUILDDIR} PARENT_SCOPE) | ||
|
||
set(GRPC_PROTO_SOURCES | ||
opentelemetry/proto/common/v1/common.proto | ||
opentelemetry/proto/logs/v1/logs.proto | ||
opentelemetry/proto/metrics/v1/metrics.proto | ||
opentelemetry/proto/trace/v1/trace.proto | ||
opentelemetry/proto/resource/v1/resource.proto) | ||
|
||
set(GRPC_PROTO_GRPC_SOURCES | ||
opentelemetry/proto/collector/logs/v1/logs_service.proto | ||
opentelemetry/proto/collector/metrics/v1/metrics_service.proto | ||
opentelemetry/proto/collector/trace/v1/trace_service.proto) | ||
|
||
protobuf_generate_cpp( | ||
PROTO_PATH ${OTEL_PROTO_SRCDIR} | ||
CPP_OUT ${OTEL_PROTO_BUILDDIR} | ||
OUT_SRCS GRPC_PROTO_GENERATED_SOURCES | ||
PROTOS ${GRPC_PROTO_SOURCES}) | ||
|
||
protobuf_generate_cpp_grpc( | ||
PROTO_PATH ${OTEL_PROTO_SRCDIR} | ||
CPP_OUT ${OTEL_PROTO_BUILDDIR} | ||
OUT_SRCS GRPC_PROTO_GENERATED_GRPC_SOURCES | ||
PROTOS ${GRPC_PROTO_GRPC_SOURCES}) | ||
|
||
add_module( | ||
TARGET grpc-protos | ||
SOURCES ${GRPC_PROTO_GENERATED_SOURCES} ${GRPC_PROTO_GENERATED_GRPC_SOURCES} | ||
DEPENDS ${MODULE_GRPC_LIBS} | ||
INCLUDES ${OTEL_PROTO_BUILDDIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
GRPC_PROTOS_SRCDIR = $(top_srcdir)/modules/grpc/protos | ||
GRPC_PROTOS_BUILDDIR = $(top_builddir)/modules/grpc/protos | ||
|
||
if ENABLE_GRPC | ||
|
||
OPENTELEMETRY_PROTO_SRCDIR = $(GRPC_PROTOS_SRCDIR)/opentelemetry-proto | ||
OPENTELEMETRY_PROTO_BUILDDIR = $(GRPC_PROTOS_BUILDDIR)/otlp | ||
|
||
OPENTELEMETRY_PROTO_PROTOC_FLAGS = $(PROTOC_GEN_GRPC_CPP_PLUGIN_FLAGS) --proto_path=$(OPENTELEMETRY_PROTO_SRCDIR) --cpp_out=$(OPENTELEMETRY_PROTO_BUILDDIR) | ||
|
||
modules/grpc/protos/otlp/%.grpc.pb.cc modules/grpc/protos/otlp/%.grpc.pb.h: | ||
mkdir -p $(OPENTELEMETRY_PROTO_BUILDDIR) | ||
$(PROTOC) $(OPENTELEMETRY_PROTO_PROTOC_FLAGS) --grpc-cpp_out=$(OPENTELEMETRY_PROTO_BUILDDIR) $*.proto | ||
|
||
modules/grpc/protos/otlp/%.pb.cc modules/grpc/protos/otlp/%.pb.h: | ||
mkdir -p $(OPENTELEMETRY_PROTO_BUILDDIR) | ||
$(PROTOC) $(OPENTELEMETRY_PROTO_PROTOC_FLAGS) $*.proto | ||
|
||
GRPC_PROTOS_BUILT_SOURCES = \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/common/v1/common.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/common/v1/common.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/resource/v1/resource.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/resource/v1/resource.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/logs/v1/logs.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/logs/v1/logs.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/metrics/v1/metrics.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/metrics/v1/metrics.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/trace/v1/trace.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/trace/v1/trace.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/logs/v1/logs_service.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/logs/v1/logs_service.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/metrics/v1/metrics_service.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/metrics/v1/metrics_service.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.cc \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/trace/v1/trace_service.pb.h \ | ||
$(OPENTELEMETRY_PROTO_BUILDDIR)/opentelemetry/proto/collector/trace/v1/trace_service.pb.cc | ||
|
||
lib_LTLIBRARIES += modules/grpc/protos/libgrpc-protos.la | ||
|
||
nodist_modules_grpc_protos_libgrpc_protos_la_SOURCES = $(GRPC_PROTOS_BUILT_SOURCES) | ||
|
||
modules_grpc_protos_libgrpc_protos_la_CXXFLAGS = \ | ||
$(AM_CXXFLAGS) \ | ||
$(PROTOBUF_CLFAGS) \ | ||
$(GRPCPP_CFLAGS) \ | ||
-I$(OPENTELEMETRY_PROTO_SRCDIR) \ | ||
-I$(OPENTELEMETRY_PROTO_BUILDDIR) | ||
|
||
modules_grpc_protos_libgrpc_protos_la_LIBADD = $(MODULE_DEPS_LIBS) $(PROTOBUF_LIBS) $(GRPCPP_LIBS) -lstdc++ | ||
modules_grpc_protos_libgrpc_protos_la_DEPENDENCIES = $(MODULE_DEPS_LIBS) | ||
|
||
endif | ||
|
||
CLEANFILES += \ | ||
$(GRPC_PROTOS_BUILT_SOURCES) | ||
|
||
BUILT_SOURCES += \ | ||
$(GRPC_PROTOS_BUILT_SOURCES) | ||
|
||
NODIST_BUILT_SOURCES += \ | ||
$(GRPC_PROTOS_BUILT_SOURCES) | ||
|
||
EXTRA_DIST += \ | ||
$(OPENTELEMETRY_PROTO_SRCDIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
usr/lib/syslog-ng/libgrpc-protos.so | ||
usr/lib/syslog-ng/*/libotel.so |