Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions deps/opentelemetry-cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@ IndentPPDirectives: AfterHash

# Include blocks style
IncludeBlocks: Preserve

AttributeMacros:
- OPENTELEMETRY_UNLIKELY
- OPENTELEMETRY_LIKELY
- OPENTELEMETRY_MAYBE_UNUSED
- OPENTELEMETRY_DEPRECATED
- OPENTELEMETRY_API_SINGLETON
- OPENTELEMETRY_LOCAL_SYMBOL
- OPENTELEMETRY_EXPORT
- OPENTELEMETRY_SANITIZER_NO_MEMORY
- OPENTELEMETRY_SANITIZER_NO_THREAD
- OPENTELEMETRY_SANITIZER_NO_ADDRESS
38 changes: 33 additions & 5 deletions deps/opentelemetry-cpp/.devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,54 @@

FROM otel/cpp_format_tools

ARG USER_UID=1000
ARG USER_GID=1000
ARG INSTALL_PACKAGES=

ARG CXX_STANDARD=17
ARG ABSEIL_CPP_VERSION=20230125.3
ARG PROTOBUF_VERSION=23.3
ARG GRPC_VERSION=v1.55.0
ARG PROTOBUF_VERSION=23.4
ARG ABSEIL_CPP_VERSION=20240116.1

ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
ENV CXX_STANDARD=${CXX_STANDARD}
ENV ABSEIL_CPP_VERSION=${ABSEIL_CPP_VERSION}
ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
ENV GRPC_VERSION=${GRPC_VERSION}

COPY ci /opt/ci

RUN apt update && apt install -y wget \
ninja-build \
libcurl4-openssl-dev \
markdownlint
clang-tidy \
shellcheck

RUN cd /opt/ci && bash setup_cmake.sh
RUN cd /opt/ci && bash setup_ci_environment.sh
RUN cd /opt && bash ci/setup_googletest.sh \
&& bash ci/setup_grpc.sh -r ${GRPC_VERSION}
&& bash ci/install_abseil.sh \
&& bash ci/install_protobuf.sh \
&& bash ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp

ADD https://github.com/bazelbuild/bazelisk/releases/download/v1.22.1/bazelisk-linux-amd64 /usr/local/bin

RUN git config --global core.autocrlf input \
&& chmod +x /usr/local/bin/bazelisk-linux-amd64

ENV INSTALL_PACKAGES=${INSTALL_PACKAGES}
ENV USER_NAME=devuser
ENV USER_UID=${USER_UID}
ENV USER_GID=${USER_GID}
ENV IS_CONTAINER_BUILD=true

COPY ./.devcontainer/customize_container.sh /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
RUN /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
RUN apt install -y npm && npm install -g markdownlint-cli

USER devuser

WORKDIR /workspaces/opentelemetry-cpp

ENTRYPOINT []

CMD ["/bin/bash"]
58 changes: 58 additions & 0 deletions deps/opentelemetry-cpp/.devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Customizing Your Dev Container

Customize your dev container using build arguments (for direct Docker builds) or
environment variables (for evaluation in `devcontainer.json`).

* **CXX standard:**
This is the C++ standard to build from (eg: 17, 20, ...). (Default: 17)
* Docker ARG:
`CXX_STANDARD`
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_CXX_STANDARD`

* **abseil-cpp version:**
This is the version of abseil-cpp that will be used to build protobuf, gRPC,
and opentelemetry-cpp (when WITH_ABSEIL is set).
* Docker ARG:
`ABSEIL_CPP_VERSION`
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION`

* **Protobuf version:**
* Docker ARG:
`PROTOBUF_VERSION`
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION`

* **gRPC version:**
* Docker ARG:
`GRPC_VERSION`
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_GRPC_VERSION`

* **User ID (UID):**
User ID (Default: `1000`)
* Docker ARG:
`USER_UID`
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_USER_UID`

* **Group ID (GID):**
User group ID (Default: `1000`)
* Docker ARG:
`USER_GID`
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_USER_GID`

* **Install Packages:**
These are the additional packages that will be installed via `apt install` in the devcontainer. This is a space separated list.
* Docker ARG:
`INSTALL_PACKAGES` (Default: ``)
* Host Environment Variable:
`OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES` (Default: ``)

## Examples

* `docker build --build-arg CXX_STANDARD="20" --build-arg INSTALL_PACKAGES="nano gitk"...`
* `export OTEL_CPP_DEVCONTAINER_CXX_STANDARD=20`
* `export OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES="nano gitk"`
39 changes: 39 additions & 0 deletions deps/opentelemetry-cpp/.devcontainer/customize_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

set -eu

if [[ $IS_CONTAINER_BUILD != "true" ]]; then
echo "This script should only run inside a Docker container."
exit 1
fi

if [[ -n "$INSTALL_PACKAGES" ]]; then
packages=($INSTALL_PACKAGES)
for package in "${packages[@]}"; do
apt install -y "$package"
done
fi

if [[ $(id "$USER_NAME" 2>/dev/null) ]]; then
echo "User '$USER_NAME' already exists. Removing it."
userdel -rf "$USER_NAME"
elif [[ $(id -u "$USER_UID" 2>/dev/null) ]]; then
OTHER_USER=$(getent passwd "$USER_UID" | cut -d: -f1)
echo "User '$OTHER_USER' exists with UID $USER_UID. Removing it."
userdel -rf "$OTHER_USER"
fi

if [[ ! $(getent group "$USER_GID" 2>/dev/null) ]]; then
echo "Group '$USER_GID' does not exist. Adding it."
groupadd -g "$USER_GID" "$USER_NAME"
fi

useradd -m -u "$USER_UID" -g "$USER_GID" -s /bin/bash "$USER_NAME"
echo "Created user '$USER_NAME' (UID: $USER_UID, GID: $USER_GID)."

echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/"$USER_NAME"

echo "User and group setup complete."
30 changes: 19 additions & 11 deletions deps/opentelemetry-cpp/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@
"context": "..",
"dockerfile": "Dockerfile.dev",
"args": {
"GRPC_VERSION": "v1.55.0",
"PROTOBUF_VERSION": "23.4",
"ABSEIL_CPP_VERSION":"20240116.1"
"USER_UID": "${localEnv:OTEL_CPP_DEVCONTAINER_USER_UID:1000}",
"USER_GID": "${localEnv:OTEL_CPP_DEVCONTAINER_USER_GID:1000}",
"INSTALL_PACKAGES": "${localEnv:OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES:}",
"CXX_STANDARD": "${localEnv:OTEL_CPP_DEVCONTAINER_CXX_STANDARD:17}",
"GRPC_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_GRPC_VERSION:v1.55.0}",
"PROTOBUF_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION:23.3}",
"ABSEIL_CPP_VERSION":"${localEnv:OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION:20230125.3}"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/sh"
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools-extension-pack"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
}
}
},
"extensions": [
"ms-vscode.cpptools",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools-extension-pack"
],

"remoteUser": "root"
"remoteUser": "devuser"
}
3 changes: 3 additions & 0 deletions deps/opentelemetry-cpp/.iwyu.imp
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@
# We prefer to include <gmock/gmock.h> for simplicity
{ "include": ["<gmock/gmock-function-mocker.h>", "private", "<gmock/gmock.h>", "public"] },
{ "include": ["<gmock/gmock-spec-builders.h>", "private", "<gmock/gmock.h>", "public"] },

# We prefer to include <curl/curl.h> for simplicity
{ "include": ["<curl/system.h>", "private", "<curl/curl.h>", "public"] },
]

Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
OPENTELEMETRY_BEGIN_NAMESPACE
namespace logs
{
#if OPENTELEMETRY_ABI_VERSION_NO < 2
/**
* Handles event log record creation.
**/
class EventLogger
class OPENTELEMETRY_DEPRECATED EventLogger
{
public:
virtual ~EventLogger() = default;
Expand Down Expand Up @@ -76,5 +77,6 @@ class EventLogger
void IgnoreTraitResult(ValueType &&...)
{}
};
#endif
} // namespace logs
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ namespace logs
class EventLogger;
class Logger;

#if OPENTELEMETRY_ABI_VERSION_NO < 2
/**
* Creates new EventLogger instances.
*/
class EventLoggerProvider
class OPENTELEMETRY_DEPRECATED EventLoggerProvider
{
public:
virtual ~EventLoggerProvider() = default;
Expand All @@ -31,5 +32,6 @@ class EventLoggerProvider
nostd::shared_ptr<Logger> delegate_logger,
nostd::string_view event_domain) noexcept = 0;
};
#endif
} // namespace logs
OPENTELEMETRY_END_NAMESPACE
19 changes: 17 additions & 2 deletions deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,23 @@ class Logger
return;
}

IgnoreTraitResult(detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::Set(
log_record.get(), std::forward<ArgumentType>(args))...);
//
// Keep the parameter pack unpacking order from left to right because left
// ones are usually more important like severity and event_id than the
// attributes. The left to right unpack order could pass the more important
// data to processors to avoid caching and memory allocating.
//
#if __cplusplus <= 201402L
// C++14 does not support fold expressions for parameter pack expansion.
int dummy[] = {(detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::Set(
log_record.get(), std::forward<ArgumentType>(args)),
0)...};
IgnoreTraitResult(dummy);
#else
IgnoreTraitResult((detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::Set(
log_record.get(), std::forward<ArgumentType>(args)),
...));
#endif

EmitLogRecord(std::move(log_record));
}
Expand Down
2 changes: 2 additions & 0 deletions deps/opentelemetry-cpp/api/include/opentelemetry/logs/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class NoopLoggerProvider final : public LoggerProvider
nostd::shared_ptr<Logger> logger_;
};

#if OPENTELEMETRY_ABI_VERSION_NO < 2
class NoopEventLogger final : public EventLogger
{
public:
Expand Down Expand Up @@ -124,6 +125,7 @@ class NoopEventLoggerProvider final : public EventLoggerProvider
private:
nostd::shared_ptr<EventLogger> event_logger_;
};
#endif

} // namespace logs
OPENTELEMETRY_END_NAMESPACE
13 changes: 11 additions & 2 deletions deps/opentelemetry-cpp/api/include/opentelemetry/logs/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ OPENTELEMETRY_BEGIN_NAMESPACE
namespace logs
{

#if OPENTELEMETRY_ABI_VERSION_NO < 2
class EventLoggerProvider;
#endif
class LoggerProvider;

/**
Expand Down Expand Up @@ -45,13 +47,15 @@ class OPENTELEMETRY_EXPORT Provider
GetProvider() = tp;
}

#if OPENTELEMETRY_ABI_VERSION_NO < 2
/**
* Returns the singleton EventLoggerProvider.
*
* By default, a no-op EventLoggerProvider is returned. This will never return a
* nullptr EventLoggerProvider.
*/
static nostd::shared_ptr<EventLoggerProvider> GetEventLoggerProvider() noexcept
OPENTELEMETRY_DEPRECATED static nostd::shared_ptr<EventLoggerProvider>
GetEventLoggerProvider() noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
return nostd::shared_ptr<EventLoggerProvider>(GetEventProvider());
Expand All @@ -60,11 +64,13 @@ class OPENTELEMETRY_EXPORT Provider
/**
* Changes the singleton EventLoggerProvider.
*/
static void SetEventLoggerProvider(const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
OPENTELEMETRY_DEPRECATED static void SetEventLoggerProvider(
const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetEventProvider() = tp;
}
#endif

private:
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<LoggerProvider> &GetProvider() noexcept
Expand All @@ -73,12 +79,15 @@ class OPENTELEMETRY_EXPORT Provider
return provider;
}

#if OPENTELEMETRY_ABI_VERSION_NO < 2
OPENTELEMETRY_DEPRECATED
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<EventLoggerProvider> &
GetEventProvider() noexcept
{
static nostd::shared_ptr<EventLoggerProvider> provider(new NoopEventLoggerProvider);
return provider;
}
#endif

OPENTELEMETRY_API_SINGLETON static common::SpinLockMutex &GetLock() noexcept
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <mutex>

#include "opentelemetry/common/macros.h"
#include "opentelemetry/common/spin_lock_mutex.h"
#include "opentelemetry/metrics/meter_provider.h"
#include "opentelemetry/metrics/noop.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/version.h"
Expand All @@ -15,8 +15,6 @@ OPENTELEMETRY_BEGIN_NAMESPACE
namespace metrics
{

class MeterProvider;

/**
* Stores the singleton global MeterProvider.
*/
Expand Down
Loading
Loading