Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] protobuf config search mode #1385

Closed
wants to merge 4 commits into from

Conversation

esigo
Copy link
Member

@esigo esigo commented May 8, 2022

Fixes #1384 (issue)

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@esigo esigo requested a review from a team May 8, 2022 18:15
@codecov
Copy link

codecov bot commented May 8, 2022

Codecov Report

Merging #1385 (4246901) into main (02630e0) will increase coverage by 0.42%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1385      +/-   ##
==========================================
+ Coverage   85.36%   85.77%   +0.42%     
==========================================
  Files         151      151              
  Lines        4362     4362              
==========================================
+ Hits         3723     3741      +18     
+ Misses        639      621      -18     
Impacted Files Coverage Δ
sdk/src/metrics/metric_reader.cc 63.89% <0.00%> (+8.34%) ⬆️
...metrics/export/periodic_exporting_metric_reader.cc 77.28% <0.00%> (+34.10%) ⬆️

@esigo esigo changed the title protobuf config search mode [WIP] protobuf config search mode May 8, 2022
@@ -292,10 +292,10 @@ endif()

if(WITH_OTLP)
set(protobuf_MODULE_COMPATIBLE ON)
find_package(Protobuf)
find_package(Protobuf PATHS ${EXTERNAL_PROTOBUF_DIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this? External protobuf and grpc can be found by add installation path into CMAKE_FIND_ROOT_PATH and CMAKE_MODULE_PATH ,or by setting Protobuf_DIR/Protobuf_ROOT and gRPC_DIR/gRPC_ROOT ?

See https://cmake.org/cmake/help/latest/command/find_package.html#id4 for details

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @owent, I used your suggestion on the issue, and it works without my changes.
I have another issue now. The files for this library

add_library(
opentelemetry_proto STATIC
${COMMON_PB_CPP_FILE}
${RESOURCE_PB_CPP_FILE}
${TRACE_PB_CPP_FILE}
${LOGS_PB_CPP_FILE}
${METRICS_PB_CPP_FILE}
${TRACE_SERVICE_PB_CPP_FILE}
${TRACE_SERVICE_GRPC_PB_CPP_FILE}
${LOGS_SERVICE_PB_CPP_FILE}
${LOGS_SERVICE_GRPC_PB_CPP_FILE}
${METRICS_SERVICE_PB_CPP_FILE}
${METRICS_SERVICE_GRPC_PB_CPP_FILE})
are not available when calling make, so the first make try fails and if I repeat it the build goes through. Do you have any suggestion to solve this issue?
otherwise I have to close this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't really get the point about the files are not available when calling make. These files are generated by add_custom_command(OUTPUT [files] above.


This command should run when OUTPUT files are expired or not found and when they are depended to build any target.
If you are writing a standalone Makefile, I think it's required to write a similar TARGET of Makefile to generate these files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that, the files are not there and custome_command is ran on build time not config time. on build time when I use 16 cores to build most of the times the PB files are not generated before the compile of proto library. I think this can be solved by using execute_process.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need the generated files at config time?If we want a standalone target to just generate these files, but not compile them. I think the better way is adding a custom target by add_custom_target(generate_opentelemetry_proto SOURCES [source files...]) and run cmake --build . --target generate_opentelemetry_proto after configure is done.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @owent. I'm going to close this PR.

if(WITH_OTLP_GRPC OR (NOT DEFINED WITH_OTLP_GRPC AND NOT DEFINED
CACHE{WITH_OTLP_GRPC}))
find_package(gRPC)
find_package(gRPC PATHS ${EXTERNAL_GRPC_DIR})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't seen where ${EXTERNAL_GRPC_DIR} is defined?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was not defined. I' going to close the PR as the changes are not needed.

@esigo
Copy link
Member Author

esigo commented May 16, 2022

Closing the PR as no change is needed here.

@esigo esigo closed this May 16, 2022
@esigo esigo deleted the opentelemetry-super-build branch May 16, 2022 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenTelemetry-cpp superbuild
3 participants