Skip to content

Commit

Permalink
[Build] Bring your own dependency: opentelemetry-proto (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Nov 8, 2022
1 parent b89f981 commit b46ca96
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Increment the:
[#1727](https://github.com/open-telemetry/opentelemetry-cpp/pull/1727)
* [METRICS SDK] - Remove old metrics from Github CI
[#1733](https://github.com/open-telemetry/opentelemetry-cpp/pull/1733)
* [BUILD] Add CMake OTELCPP_PROTO_PATH [#1730](https://github.com/open-telemetry/opentelemetry-cpp/pull/1730)

## [1.7.0] 2022-10-28

Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ option(BUILD_W3CTRACECONTEXT_TEST "Whether to build w3c trace context" OFF)

option(OTELCPP_MAINTAINER_MODE "Build in maintainer mode (-Wall -Werror)" OFF)

set(OTELCPP_PROTO_PATH
""
CACHE PATH "Path to opentelemetry-proto")

if(WIN32)
if(BUILD_TESTING)
if(MSVC)
Expand Down
80 changes: 59 additions & 21 deletions cmake/opentelemetry-proto.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,65 @@
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)
set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#
# The dependency on opentelemetry-proto can be provided different ways.
# By order of decreasing priority, options are:
#
# 1 - Use a provided package
#
# This is useful to build opentelemetry-cpp as part of a super project.
#
# The super project provides the path to the opentelemetry-proto
# source code using variable ${OTELCPP_PROTO_PATH}
#
# 2 - Search for a opentelemetry-proto git submodule
#
# When git submodule is used,
# the opentelemetry-proto code is located in:
# third_party/opentelemetry-proto
#
# 3 - Download opentelemetry-proto from github
#
# Code from the required version is used,
# unless a specific release tag is provided
# in variable ${opentelemetry-proto}
#

if(OTELCPP_PROTO_PATH)
if(NOT EXISTS(${OTELCPP_PROTO_PATH}/opentelemetry/proto/common/v1/common.proto))
message(FATAL_ERROR "OTELCPP_PROTO_PATH does not point to a opentelemetry-proto repository")
endif()
message(STATUS "opentelemetry-proto dependency satisfied by: external path")
set(PROTO_PATH ${OTELCPP_PROTO_PATH})
set(needs_proto_download FALSE)
else()
if("${opentelemetry-proto}" STREQUAL "")
set(opentelemetry-proto "v0.19.0")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)
message(STATUS "opentelemetry-proto dependency satisfied by: git submodule")
set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
set(needs_proto_download FALSE)
else()
message(STATUS "opentelemetry-proto dependency satisfied by: github download")
if("${opentelemetry-proto}" STREQUAL "")
set(opentelemetry-proto "v0.19.0")
endif()
include(ExternalProject)
ExternalProject_Add(
opentelemetry-proto
GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-proto.git
GIT_TAG "${opentelemetry-proto}"
UPDATE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
CONFIGURE_COMMAND ""
TEST_AFTER_INSTALL 0
DOWNLOAD_NO_PROGRESS 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1)
ExternalProject_Get_Property(opentelemetry-proto INSTALL_DIR)
set(PROTO_PATH "${INSTALL_DIR}/src/opentelemetry-proto")
set(needs_proto_download TRUE)
endif()
include(ExternalProject)
ExternalProject_Add(
opentelemetry-proto
GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-proto.git
GIT_TAG "${opentelemetry-proto}"
UPDATE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
CONFIGURE_COMMAND ""
TEST_AFTER_INSTALL 0
DOWNLOAD_NO_PROGRESS 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1)
ExternalProject_Get_Property(opentelemetry-proto INSTALL_DIR)
set(PROTO_PATH "${INSTALL_DIR}/src/opentelemetry-proto")
set(needs_proto_download TRUE)
endif()

include(${PROJECT_SOURCE_DIR}/cmake/proto-options-patch.cmake)
Expand Down

2 comments on commit b46ca96

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: b46ca96 Previous: b89f981 Ratio
BM_SpinLockThrashing/1/process_time/real_time 0.5769618541680333 ms/iter 0.18101376333054464 ms/iter 3.19
BM_ProcYieldSpinLockThrashing/1/process_time/real_time 1.0086102919145064 ms/iter 0.18013379850440261 ms/iter 5.60
BM_NaiveSpinLockThrashing/1/process_time/real_time 0.7441135946773153 ms/iter 0.15960343207573538 ms/iter 4.66
BM_ThreadYieldSpinLockThrashing/1/process_time/real_time 14.71671462059021 ms/iter 6.630920228503999 ms/iter 2.22
BM_ThreadYieldSpinLockThrashing/2/process_time/real_time 40.6765341758728 ms/iter 14.279895358615452 ms/iter 2.85

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: b46ca96 Previous: b89f981 Ratio
BM_BaselineBuffer/2 10470118.522644043 ns/iter 4437555.551528931 ns/iter 2.36

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.