Skip to content

Commit 7afc0e8

Browse files
committed
Please enter a commit message to explain why this merge is necessary,
2 parents 858386d + d179bd7 commit 7afc0e8

File tree

326 files changed

+18765
-2424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+18765
-2424
lines changed

.bazelrc

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Track changes in folders referenced by copy_directory
55
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
66

7-
build --features=parse_headers
7+
#build --features=parse_headers
88
#build --features=layering_check
99

1010
# Don't try to build .so and .dylib shared libs (instead of static) libs on Linux/OSX
@@ -26,8 +26,9 @@ test --test_tag_filters=-jaeger,-opentracing,-opentracing_shim
2626
build --experimental_convenience_symlinks=clean
2727

2828
build:windows --copt="/Brepro" --copt="/guard:cf" --copt="/guard:ehcont" --copt="/Z7" --copt="/JMC-" --copt="/sdl"
29-
build:windows --linkopt="/Brepro" --linkopt="/guard:cf" --linkopt="/guard:ehcont" --linkopt="/DEBUG:FULL" --linkopt="/CETCOMPAT" --linkopt="/SWAPRUN:NET,CD" --linkopt="/OPT:REF,ICF" --linkopt="/RELEASE" --linkopt="/DEBUGTYPE:CV,PDATA,FIXUP"
29+
build:windows --linkopt="/Brepro" --linkopt="/guard:cf" --linkopt="/guard:ehcont" --linkopt="/DEBUG:FULL" --linkopt="/CETCOMPAT" --linkopt="/SWAPRUN:NET,CD" --linkopt="/OPT:REF,NOICF" --linkopt="/RELEASE" --linkopt="/DEBUGTYPE:CV,PDATA,FIXUP"
3030
build:windows --copt="/Zc:strictStrings"
31+
build:windows --copt="/Gy"
3132
build:windows --host_linkopt="shell32.lib"
3233
# Requires Visual Studio 2019 Build Tools installed in default location with the latest compiler (14.29.30133) for x64
3334
build:windows --action_env=BAZEL_VC_FULL_VERSION=14.29.30133 --action_env=BAZEL_WINSDK_FULL_VERSION=10.0.22621.0
@@ -51,9 +52,9 @@ build:macos --strip=never --copt=-g --cxxopt=-g
5152
# Does not yet compoile with the Developer command-line tools, needs clang from homebrew
5253
#build:macos --action_env=/Library/Developer/CommandLineTools/usr/bin/clang
5354
#build:macos --host_action_env=/Library/Developer/CommandLineTools/usr/bin/clang
54-
build:macos --action_env=CC=/opt/homebrew/bin/clang
55-
build:macos --host_action_env=CC=/opt/homebrew/bin/clang
56-
build:macos --apple_generate_dsym --output_groups=+dsyms
55+
build:macos --action_env=CC=/opt/homebrew/opt/llvm/bin/clang
56+
build:macos --host_action_env=CC=/opt/homebrew/opt/llvm/bin/clang
57+
#build:macos --apple_generate_dsym --output_groups=+dsyms
5758

5859
# --config=asan : Address Sanitizer.
5960
common:asan --copt -DADDRESS_SANITIZER
@@ -115,10 +116,6 @@ common --incompatible_modify_execution_info_additive
115116
common --modify_execution_info=CppCompile=+supports-path-mapping
116117
common --skip_incompatible_explicit_targets
117118

118-
build --@curl//:use_mbedtls=true
119-
# build --@curl//:http_only=true
120-
121-
122119
# build --experimental_save_feature_state
123120
# saves .s and .ii files but tends to be super slow
124121
# build --save_temps
@@ -129,12 +126,12 @@ mod --lockfile_mode=refresh
129126
build:windows --config=clang-cl
130127

131128
# See MODULE.bazel where we've disabled the platform/toolchain setup, but made it back here
129+
build:clang-cl --host_copt=-Wno-dynamic-class-memaccess --copt=-Wno-dynamic-class-memaccess
130+
build:clang-cl --host_copt=-Wno-microsoft-cast --copt=-Wno-microsoft-cast
131+
build:clang-cl --host_copt=-Wno-invalid-offsetof --copt=-Wno-invalid-offsetof
132+
132133
build:clang-cl --host_platform=@otel_sdk//:x64_windows-clang-cl
133134
build:clang-cl --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
134-
build:clang-cl --per_file_copt="protobuf\\+/.*@-Wno-invalid-offsetof"
135-
build:clang-cl --host_per_file_copt="protobuf\\+/.*@-Wno-invalid-offsetof"
136-
build:clang-cl --per_file_copt="c-ares\\+/.*@-Wno-macro-redefined"
137-
build:clang-cl --host_per_file_copt="c-ares\\+/.*@-Wno-macro-redefined"
138135

139136
common --experimental_enable_android_migration_apis
140137

@@ -145,6 +142,9 @@ startup --client_debug
145142

146143
common --flag_alias=dll=@otel_sdk//:with_dll
147144

145+
# disable GRPC experiments
146+
build --define=grpc_experiments_are_final=true
147+
148148
## This is what my ../top.bazelrc contains (not in the repo as local to my machine)
149149
# build --disk_cache=f:/b/d
150150
# common --repository_cache=f:/b/r

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.1.0rc4
1+
8.2.0rc3

.clang-format

+12
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,15 @@ IndentPPDirectives: AfterHash
5959

6060
# Include blocks style
6161
IncludeBlocks: Preserve
62+
63+
AttributeMacros:
64+
- OPENTELEMETRY_UNLIKELY
65+
- OPENTELEMETRY_LIKELY
66+
- OPENTELEMETRY_MAYBE_UNUSED
67+
- OPENTELEMETRY_DEPRECATED
68+
- OPENTELEMETRY_API_SINGLETON
69+
- OPENTELEMETRY_LOCAL_SYMBOL
70+
- OPENTELEMETRY_EXPORT
71+
- OPENTELEMETRY_SANITIZER_NO_MEMORY
72+
- OPENTELEMETRY_SANITIZER_NO_THREAD
73+
- OPENTELEMETRY_SANITIZER_NO_ADDRESS

.devcontainer/Dockerfile.conan

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
FROM ubuntu:24.04
4+
5+
RUN apt update && apt install -y \
6+
build-essential \
7+
ca-certificates \
8+
wget \
9+
cmake \
10+
git \
11+
sudo \
12+
nano \
13+
pkg-config \
14+
ninja-build \
15+
clang-format \
16+
clang-tidy \
17+
autoconf \
18+
automake \
19+
libtool \
20+
python3-pip
21+
22+
RUN pip install conan --break-system-packages
23+
24+
ARG USER_UID=1000
25+
ARG USER_GID=1000
26+
ARG USER_NAME=devuser
27+
ENV USER_NAME=devuser
28+
ENV USER_UID=${USER_UID}
29+
ENV USER_GID=${USER_GID}
30+
ENV INSTALL_PACKAGES=
31+
ENV IS_CONTAINER_BUILD=true
32+
33+
COPY ./.devcontainer/customize_container.sh /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
34+
RUN /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
35+
USER devuser
36+
37+
RUN conan profile detect --force
38+
39+
ARG CONAN_FILE=conanfile_stable.txt
40+
ARG CONAN_BUILD_TYPE=Debug
41+
ARG CXX_STANDARD=17
42+
WORKDIR /home/devuser/conan
43+
COPY ./install/conan/ .
44+
45+
RUN conan install ./${CONAN_FILE} --build=missing -s build_type=${CONAN_BUILD_TYPE}
46+
ENV CMAKE_TOOLCHAIN_FILE=/home/devuser/conan/build/${CONAN_BUILD_TYPE}/generators/conan_toolchain.cmake
47+
ENV CXX_STANDARD=${CXX_STANDARD}
48+
ENV BUILD_TYPE=${CONAN_BUILD_TYPE}
49+
ENV CONAN_FILE=${CONAN_FILE}
50+
51+
WORKDIR /workspaces/opentelemetry-cpp
52+
53+
ENTRYPOINT []
54+
55+
CMD ["/bin/bash"]

.devcontainer/Dockerfile.dev

+35-5
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,56 @@
33

44
FROM otel/cpp_format_tools
55

6+
ARG USER_UID=1000
7+
ARG USER_GID=1000
8+
ARG INSTALL_PACKAGES=
9+
10+
ARG CXX_STANDARD=17
11+
ARG CMAKE_VERSION=3.31.6
12+
ARG ABSEIL_CPP_VERSION=20230125.3
13+
ARG PROTOBUF_VERSION=23.3
614
ARG GRPC_VERSION=v1.55.0
7-
ARG PROTOBUF_VERSION=23.4
8-
ARG ABSEIL_CPP_VERSION=20240116.1
915

10-
ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
16+
ENV CXX_STANDARD=${CXX_STANDARD}
17+
ENV CMAKE_VERSION=${CMAKE_VERSION}
1118
ENV ABSEIL_CPP_VERSION=${ABSEIL_CPP_VERSION}
19+
ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
20+
ENV GRPC_VERSION=${GRPC_VERSION}
1221

1322
COPY ci /opt/ci
1423

1524
RUN apt update && apt install -y wget \
1625
ninja-build \
1726
libcurl4-openssl-dev \
18-
markdownlint
27+
clang-tidy \
28+
shellcheck
1929

2030
RUN cd /opt/ci && bash setup_cmake.sh
2131
RUN cd /opt/ci && bash setup_ci_environment.sh
2232
RUN cd /opt && bash ci/setup_googletest.sh \
23-
&& bash ci/setup_grpc.sh -r ${GRPC_VERSION}
33+
&& bash ci/install_abseil.sh \
34+
&& bash ci/install_protobuf.sh \
35+
&& bash ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
2436

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

2739
RUN git config --global core.autocrlf input \
2840
&& chmod +x /usr/local/bin/bazelisk-linux-amd64
41+
42+
ENV INSTALL_PACKAGES=${INSTALL_PACKAGES}
43+
ENV USER_NAME=devuser
44+
ENV USER_UID=${USER_UID}
45+
ENV USER_GID=${USER_GID}
46+
ENV IS_CONTAINER_BUILD=true
47+
48+
COPY ./.devcontainer/customize_container.sh /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
49+
RUN /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
50+
RUN apt install -y npm && npm install -g markdownlint-cli
51+
52+
USER devuser
53+
54+
WORKDIR /workspaces/opentelemetry-cpp
55+
56+
ENTRYPOINT []
57+
58+
CMD ["/bin/bash"]

.devcontainer/README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Customizing Your Dev Container
2+
3+
Customize your dev container using build arguments (for direct Docker builds) or
4+
environment variables (for evaluation in `devcontainer.json`).
5+
6+
* **CMake version:**
7+
The version of cmake to install. (Default: 3.31.6)
8+
* Docker ARG:
9+
`CMAKE_VERSION`
10+
* Host Environment Variable:
11+
`OTEL_CPP_DEVCONTAINER_CMAKE_VERSION`
12+
13+
* **CXX standard:**
14+
This is the C++ standard to build from (eg: 17, 20, ...). (Default: 17)
15+
* Docker ARG:
16+
`CXX_STANDARD`
17+
* Host Environment Variable:
18+
`OTEL_CPP_DEVCONTAINER_CXX_STANDARD`
19+
20+
* **abseil-cpp version:**
21+
This is the version of abseil-cpp that will be used to build protobuf, gRPC,
22+
and opentelemetry-cpp.
23+
* Docker ARG:
24+
`ABSEIL_CPP_VERSION`
25+
* Host Environment Variable:
26+
`OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION`
27+
28+
* **Protobuf version:**
29+
* Docker ARG:
30+
`PROTOBUF_VERSION`
31+
* Host Environment Variable:
32+
`OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION`
33+
34+
* **gRPC version:**
35+
* Docker ARG:
36+
`GRPC_VERSION`
37+
* Host Environment Variable:
38+
`OTEL_CPP_DEVCONTAINER_GRPC_VERSION`
39+
40+
* **User ID (UID):**
41+
User ID (Default: `1000`)
42+
* Docker ARG:
43+
`USER_UID`
44+
* Host Environment Variable:
45+
`OTEL_CPP_DEVCONTAINER_USER_UID`
46+
47+
* **Group ID (GID):**
48+
User group ID (Default: `1000`)
49+
* Docker ARG:
50+
`USER_GID`
51+
* Host Environment Variable:
52+
`OTEL_CPP_DEVCONTAINER_USER_GID`
53+
54+
* **Install Packages:**
55+
These are the additional packages that will be installed via `apt install` in the devcontainer. This is a space separated list.
56+
* Docker ARG:
57+
`INSTALL_PACKAGES` (Default: ``)
58+
* Host Environment Variable:
59+
`OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES` (Default: ``)
60+
61+
## Examples
62+
63+
* `docker build --build-arg CXX_STANDARD="20" --build-arg INSTALL_PACKAGES="nano gitk"...`
64+
* `export OTEL_CPP_DEVCONTAINER_CXX_STANDARD=20`
65+
* `export OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES="nano gitk"`

.devcontainer/customize_container.sh

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Copyright The OpenTelemetry Authors
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -eu
7+
8+
if [[ $IS_CONTAINER_BUILD != "true" ]]; then
9+
echo "This script should only run inside a Docker container."
10+
exit 1
11+
fi
12+
13+
if [[ -n "$INSTALL_PACKAGES" ]]; then
14+
packages=($INSTALL_PACKAGES)
15+
for package in "${packages[@]}"; do
16+
apt install -y "$package"
17+
done
18+
fi
19+
20+
if [[ $(id "$USER_NAME" 2>/dev/null) ]]; then
21+
echo "User '$USER_NAME' already exists. Removing it."
22+
userdel -rf "$USER_NAME"
23+
elif [[ $(id -u "$USER_UID" 2>/dev/null) ]]; then
24+
OTHER_USER=$(getent passwd "$USER_UID" | cut -d: -f1)
25+
echo "User '$OTHER_USER' exists with UID $USER_UID. Removing it."
26+
userdel -rf "$OTHER_USER"
27+
fi
28+
29+
if [[ ! $(getent group "$USER_GID" 2>/dev/null) ]]; then
30+
echo "Group '$USER_GID' does not exist. Adding it."
31+
groupadd -g "$USER_GID" "$USER_NAME"
32+
fi
33+
34+
useradd -m -u "$USER_UID" -g "$USER_GID" -s /bin/bash "$USER_NAME"
35+
echo "Created user '$USER_NAME' (UID: $USER_UID, GID: $USER_GID)."
36+
37+
echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/"$USER_NAME"
38+
39+
echo "User and group setup complete."

.devcontainer/devcontainer.json

+20-11
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,28 @@
88
"context": "..",
99
"dockerfile": "Dockerfile.dev",
1010
"args": {
11-
"GRPC_VERSION": "v1.55.0",
12-
"PROTOBUF_VERSION": "23.4",
13-
"ABSEIL_CPP_VERSION":"20240116.1"
11+
"USER_UID": "${localEnv:OTEL_CPP_DEVCONTAINER_USER_UID:1000}",
12+
"USER_GID": "${localEnv:OTEL_CPP_DEVCONTAINER_USER_GID:1000}",
13+
"INSTALL_PACKAGES": "${localEnv:OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES:}",
14+
"CMAKE_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_CMAKE_VERSION:3.31.6}",
15+
"CXX_STANDARD": "${localEnv:OTEL_CPP_DEVCONTAINER_CXX_STANDARD:17}",
16+
"GRPC_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_GRPC_VERSION:v1.55.0}",
17+
"PROTOBUF_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION:23.3}",
18+
"ABSEIL_CPP_VERSION":"${localEnv:OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION:20230125.3}"
1419
}
1520
},
16-
"settings": {
17-
"terminal.integrated.shell.linux": "/bin/sh"
21+
"customizations": {
22+
"vscode": {
23+
"extensions": [
24+
"ms-vscode.cpptools",
25+
"ms-azuretools.vscode-docker",
26+
"ms-vscode.cpptools-extension-pack"
27+
],
28+
"settings": {
29+
"terminal.integrated.shell.linux": "/bin/bash",
30+
}
31+
}
1832
},
19-
"extensions": [
20-
"ms-vscode.cpptools",
21-
"ms-azuretools.vscode-docker",
22-
"ms-vscode.cpptools-extension-pack"
23-
],
2433

25-
"remoteUser": "root"
34+
"remoteUser": "devuser"
2635
}

.github/workflows/benchmark.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
name: Run OpenTelemetry-cpp benchmarks
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717
with:
1818
submodules: 'recursive'
1919
- name: Mount Bazel Cache
20-
uses: actions/cache@v4
20+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
2121
env:
2222
cache-name: bazel_cache
2323
with:
@@ -35,7 +35,7 @@ jobs:
3535
mv api-benchmark_result.json benchmarks
3636
mv sdk-benchmark_result.json benchmarks
3737
mv exporters-benchmark_result.json benchmarks
38-
- uses: actions/upload-artifact@v4
38+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3939
with:
4040
name: benchmark_results
4141
path: benchmarks
@@ -47,8 +47,8 @@ jobs:
4747
name: Store benchmark result
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v4
51-
- uses: actions/download-artifact@master
50+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
51+
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
5252
with:
5353
name: benchmark_results
5454
path: benchmarks
@@ -57,7 +57,7 @@ jobs:
5757
run: |
5858
cat benchmarks/*
5959
- name: Push benchmark result
60-
uses: benchmark-action/github-action-benchmark@v1
60+
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
6161
with:
6262
name: OpenTelemetry-cpp ${{ matrix.components }} Benchmark
6363
tool: 'googlecpp'

0 commit comments

Comments
 (0)