Skip to content

Commit

Permalink
Merge pull request #300 from open-telemetry/main
Browse files Browse the repository at this point in the history
[pull] main from open-telemetry:main
  • Loading branch information
lalitb authored May 30, 2024
2 parents 9500c12 + c42dcca commit e4d4bd7
Show file tree
Hide file tree
Showing 256 changed files with 11,929 additions and 2,492 deletions.
132 changes: 63 additions & 69 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.12.1
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

name: include-what-you-use

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
iwyu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: setup dependencies
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends --no-install-suggests \
build-essential \
iwyu \
cmake \
ninja-build \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
libgmock-dev \
libgtest-dev \
libbenchmark-dev
- name: Prepare CMake
run: |
TOPDIR=`pwd`
mkdir build && cd build
CC="clang" CXX="clang++" cmake \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \
-DBUILD_TESTING=OFF \
-DBUILD_W3CTRACECONTEXT_TEST=OFF \
..
- name: iwyu_tool
run: |
cd build
make -k 2>&1 | tee -a iwyu.log
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (include-what-you-use)
path: ./build/*.log

- name: count warnings
run: |
cd build
COUNT=`grep -c "Warning:" iwyu.log`
echo "include-what-you-use reported ${COUNT} warning(s)"
13 changes: 13 additions & 0 deletions .iwyu.imp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# include-what-you-use mapping file

[
# Work around for C++ STL
{ "include": ["<bits/chrono.h>", "private", "<chrono>", "public"] },

# Local opentelemetry-cpp

]

104 changes: 104 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,90 @@ Increment the:

## [Unreleased]

* [SDK] Update ExemplarFilter and ExemplarReservoir for spec
[#2372](https://github.com/open-telemetry/opentelemetry-cpp/pull/2372)

* [CI] Upgrade to clang-format 18
[#2684](https://github.com/open-telemetry/opentelemetry-cpp/pull/2684)

Notes on experimental features:

* [#2372](https://github.com/open-telemetry/opentelemetry-cpp/issues/2372)
introduced `MeterProvider::SetExemplar()` which accepts en
`ExemplarFilterType` enumeration with `kAlwaysOff`, `kAlwaysOn` and
`kTraceBased`.

## [1.15.0] 2024-04-21

* [EXPORTER] Change OTLP HTTP content_type default to binary
[#2564](https://github.com/open-telemetry/opentelemetry-cpp/pull/2564)
* [DOC] Fix OTLP documentation: Default endpoint is wrong for OTLP/HTTP
[#2560](https://github.com/open-telemetry/opentelemetry-cpp/pull/2560)
* [BUILD] Fix old style cast warning
[#2567](https://github.com/open-telemetry/opentelemetry-cpp/pull/2567)
* [EXPORTER] Gzip compression support for OTLP/HTTP and OTLP/gRPC exporter
[#2530](https://github.com/open-telemetry/opentelemetry-cpp/pull/2530)
* [BUILD] update vcpkg submodule to 2024.02.14
[#2575](https://github.com/open-telemetry/opentelemetry-cpp/pull/2575)
* [SDK] Support for OTEL_SERVICE_NAME
[#2577](https://github.com/open-telemetry/opentelemetry-cpp/pull/2577)
* [EXPORTER] Support URL-encoded values for `OTEL_EXPORTER_OTLP_HEADERS`
[#2579](https://github.com/open-telemetry/opentelemetry-cpp/pull/2579)
* [BUILD] CMake cleanup for message()
[#2582](https://github.com/open-telemetry/opentelemetry-cpp/pull/2582)
* [BUILD] Bump CMake minimum required version to 3.9
[#2581](https://github.com/open-telemetry/opentelemetry-cpp/pull/2581)
* [BUILD] Provide LIKELY / UNLIKELY macros
[#2580](https://github.com/open-telemetry/opentelemetry-cpp/pull/2580)
* [EXPORTER] OTLP: Fix missing ResourceMetrics SchemaURL
[#2587](https://github.com/open-telemetry/opentelemetry-cpp/pull/2587)
* [ETW] cleanup include path
[#2594](https://github.com/open-telemetry/opentelemetry-cpp/pull/2594)
* Upgrade to googletest 1.14.0
[#2596](https://github.com/open-telemetry/opentelemetry-cpp/pull/2596)
* Upgrade to nlohmann_json 3.11.3
[#2595](https://github.com/open-telemetry/opentelemetry-cpp/pull/2595)
* [BAZEL] Move -std=c++14 to .bazelrc
[#2600](https://github.com/open-telemetry/opentelemetry-cpp/pull/2600)
* [BAZEL] Fix -std=c++14 warning on Windows
[#2601](https://github.com/open-telemetry/opentelemetry-cpp/pull/2601)
* Upgrade to benchmark 1.8.3
[#2597](https://github.com/open-telemetry/opentelemetry-cpp/pull/2597)
* Upgrade to prometheus 1.2.4
[#2598](https://github.com/open-telemetry/opentelemetry-cpp/pull/2598)
* [DOC] Fix typo: Asynchronouse -> Asynchronous in meter.h
[#2604](https://github.com/open-telemetry/opentelemetry-cpp/pull/2604)
* [BUILD] Do not link prometheus-cpp::util when it doesn't exist
[#2606](https://github.com/open-telemetry/opentelemetry-cpp/pull/2606)
* [SDK] Remove unused variable
[#2609](https://github.com/open-telemetry/opentelemetry-cpp/pull/2609)
* [METRICS SDK] Remove extra OfferMeasurement call
in SyncMetricsStorage::OfferMeasurement
[#2610](https://github.com/open-telemetry/opentelemetry-cpp/pull/2610)
* [MISC] Use set -e on all shell scripts and pass shellcheck --severity=error
[#2616](https://github.com/open-telemetry/opentelemetry-cpp/pull/2616)
* [CI] Add shellcheck --severity=error as a CI step
[#2618](https://github.com/open-telemetry/opentelemetry-cpp/pull/2618)
* [CI] Upgrade to abseil 20240116.1 (CMake only)
[#2599](https://github.com/open-telemetry/opentelemetry-cpp/pull/2599)
* [CI] Benchmark, provide units with --benchmark_min_time
[#2621](https://github.com/open-telemetry/opentelemetry-cpp/pull/2621)
* [EXPORTER] OTLP file exporter
[#2540](https://github.com/open-telemetry/opentelemetry-cpp/pull/2540)
* [CI] Use platform CMake
[#2627](https://github.com/open-telemetry/opentelemetry-cpp/pull/2627)
* [PROTO] Upgrade to opentelemetry-proto 1.2.0
[#2631](https://github.com/open-telemetry/opentelemetry-cpp/pull/2631)
* [SDK] DefaultLogHandler to print errors to std::cerr, add LogLevel::None
[#2622](https://github.com/open-telemetry/opentelemetry-cpp/pull/2622)
* [SEMANTIC CONVENTIONS] Upgrade to semantic convention 1.25.0
[#2633](https://github.com/open-telemetry/opentelemetry-cpp/pull/2633)
* [DOC] Add readme and examples for OTLP FILE exporters.
[#2638](https://github.com/open-telemetry/opentelemetry-cpp/pull/2638)
* [SEMANTIC CONVENTIONS] Rework on semantic conventions 1.25.0
[#2640](https://github.com/open-telemetry/opentelemetry-cpp/pull/2640)
* [DOC] Update INSTALL.md
[#2592](https://github.com/open-telemetry/opentelemetry-cpp/pull/2592)

Important changes:

Expand All @@ -32,6 +112,30 @@ Important changes:
dependency on zlib.
* [SDK] Change OTLP HTTP content_type default to binary
[#2558](https://github.com/open-telemetry/opentelemetry-cpp/pull/2558)
* [CI] Use platform CMake
[#2627](https://github.com/open-telemetry/opentelemetry-cpp/pull/2627)
* The `CI` in github no longer install a different version of `cmake`.
* It now always use the `cmake` provided by the platform.
* As part of this change, the script `ci/setup_cmake.sh` was renamed
to `ci/setup_googletest.sh`, for clarity, now that this script
only installs googletest.
* [SDK] DefaultLogHandler to print to std::cerr, add LogLevel::None
[#2622](https://github.com/open-telemetry/opentelemetry-cpp/pull/2622)
* Change DefaultLogHandler output
* Before, the default internal logger, DefaultLogHandler,
used to print to std::cout.
* Now, DefaultLogHandler prints errors and warnings to std::cerr,
as expected, while printing info and debug messages to std::cout.
* Applications that expected to find the opentelemetry-cpp internal
error log in std::cout may need adjustments, either by looking
at std::cerr instead, or by using a custom log handler.
* Additional LogLevel::None
* LogLevel::None is a new supported log level, which does not print
any message.
* Custom log handlers may need to implement a new case, to avoid
compiler warnings.
* Numbering of log levels like OTEL_INTERNAL_LOG_LEVEL_ERROR
has changed, which requires to rebuild, as the SDK ABI differs.

## [1.14.2] 2024-02-27

Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ option(WITH_OTLP_GRPC "Whether to include the OTLP gRPC exporter in the SDK"
option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK"
OFF)

option(WITH_OTLP_FILE "Whether to include the OTLP file exporter in the SDK"
OFF)

option(
WITH_OTLP_HTTP_COMPRESSION
"Whether to include gzip compression for the OTLP http exporter in the SDK"
Expand Down Expand Up @@ -370,7 +373,9 @@ if(WITH_ABSEIL)
find_package(absl CONFIG REQUIRED)
endif()

if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
if(WITH_OTLP_GRPC
OR WITH_OTLP_HTTP
OR WITH_OTLP_FILE)
find_package(Protobuf)
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
if(NOT WITH_ABSEIL)
Expand Down Expand Up @@ -473,6 +478,7 @@ endif()
if(WITH_ELASTICSEARCH
OR WITH_ZIPKIN
OR WITH_OTLP_HTTP
OR WITH_OTLP_FILE
OR BUILD_W3CTRACECONTEXT_TEST
OR WITH_ETW)
set(USE_NLOHMANN_JSON ON)
Expand Down
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ You can link OpenTelemetry C++ SDK with libraries provided in
- `-DWITH_OTLP_GRPC=ON` : To enable building OTLP GRPC exporter.
- `-DWITH_OTLP_HTTP=ON` : To enable building OTLP HTTP exporter.
- `-DWITH_PROMETHEUS=ON` : To enable building prometheus exporter.
- `-DOPENTELEMETRY_INSTALL=ON`: To install `otel-cpp` library needed
for external code linking.

3. Once the build configuration is created, build the CMake targets - this
includes building SDKs and unittests for API and SDK. Note that since API is
Expand Down
14 changes: 12 additions & 2 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ if(WITH_ABSEIL)
target_link_libraries(
opentelemetry_api INTERFACE absl::bad_variant_access absl::any absl::base
absl::bits absl::city)
list(APPEND TARGET_DEPS "absl_bad_variant_access" "absl_any absl_base"
"absl_bits" "absl_city")
list(
APPEND
TARGET_DEPS
"absl_bad_variant_access"
"absl_any"
"absl_base"
"absl_bits"
"absl_city")
endif()

if(WITH_STL STREQUAL "OFF")
Expand Down Expand Up @@ -125,6 +131,10 @@ if(WITH_OTLP_HTTP_COMPRESSION)
INTERFACE ENABLE_OTLP_COMPRESSION_PREVIEW)
endif()

if(APPLE)
target_link_libraries(opentelemetry_api INTERFACE "-framework CoreFoundation")
endif()

include(${PROJECT_SOURCE_DIR}/cmake/pkgconfig.cmake)

if(OPENTELEMETRY_INSTALL)
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/common/kv_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class KeyValueProperties
}

// Move contructor and assignment operator
Entry(Entry &&other) = default;
Entry(Entry &&other) = default;
Entry &operator=(Entry &&other) = default;

// Creates an Entry for a given key-value pair.
Expand Down
4 changes: 2 additions & 2 deletions api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class SpinLockMutex
{
public:
SpinLockMutex() noexcept {}
~SpinLockMutex() noexcept = default;
SpinLockMutex(const SpinLockMutex &) = delete;
~SpinLockMutex() noexcept = default;
SpinLockMutex(const SpinLockMutex &) = delete;
SpinLockMutex &operator=(const SpinLockMutex &) = delete;

static inline void fast_yield() noexcept
Expand Down
6 changes: 1 addition & 5 deletions api/include/opentelemetry/logs/event_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,14 @@ class EventLogger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void EmitEvent(nostd::string_view event_name, ArgumentType &&... args)
void EmitEvent(nostd::string_view event_name, ArgumentType &&...args)
{
nostd::shared_ptr<Logger> delegate_logger = GetDelegateLogger();
if (!delegate_logger)
{
return;
}
nostd::unique_ptr<LogRecord> log_record = delegate_logger->CreateLogRecord();
if (!log_record)
{
return;
}

IgnoreTraitResult(
detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
Expand Down
20 changes: 8 additions & 12 deletions api/include/opentelemetry/logs/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void EmitLogRecord(nostd::unique_ptr<LogRecord> &&log_record, ArgumentType &&... args)
void EmitLogRecord(nostd::unique_ptr<LogRecord> &&log_record, ArgumentType &&...args)
{
if (!log_record)
{
Expand Down Expand Up @@ -97,13 +97,9 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void EmitLogRecord(ArgumentType &&... args)
void EmitLogRecord(ArgumentType &&...args)
{
nostd::unique_ptr<LogRecord> log_record = CreateLogRecord();
if (!log_record)
{
return;
}

EmitLogRecord(std::move(log_record), std::forward<ArgumentType>(args)...);
}
Expand All @@ -124,7 +120,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void Trace(ArgumentType &&... args) noexcept
void Trace(ArgumentType &&...args) noexcept
{
static_assert(
!detail::LogRecordHasType<Severity, typename std::decay<ArgumentType>::type...>::value,
Expand All @@ -148,7 +144,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void Debug(ArgumentType &&... args) noexcept
void Debug(ArgumentType &&...args) noexcept
{
static_assert(
!detail::LogRecordHasType<Severity, typename std::decay<ArgumentType>::type...>::value,
Expand All @@ -172,7 +168,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void Info(ArgumentType &&... args) noexcept
void Info(ArgumentType &&...args) noexcept
{
static_assert(
!detail::LogRecordHasType<Severity, typename std::decay<ArgumentType>::type...>::value,
Expand All @@ -196,7 +192,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void Warn(ArgumentType &&... args) noexcept
void Warn(ArgumentType &&...args) noexcept
{
static_assert(
!detail::LogRecordHasType<Severity, typename std::decay<ArgumentType>::type...>::value,
Expand All @@ -220,7 +216,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void Error(ArgumentType &&... args) noexcept
void Error(ArgumentType &&...args) noexcept
{
static_assert(
!detail::LogRecordHasType<Severity, typename std::decay<ArgumentType>::type...>::value,
Expand All @@ -244,7 +240,7 @@ class Logger
* span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)
*/
template <class... ArgumentType>
void Fatal(ArgumentType &&... args) noexcept
void Fatal(ArgumentType &&...args) noexcept
{
static_assert(
!detail::LogRecordHasType<Severity, typename std::decay<ArgumentType>::type...>::value,
Expand Down
Loading

0 comments on commit e4d4bd7

Please sign in to comment.