Skip to content

Commit 4bfadb5

Browse files
authored
Merge branch 'main' into stress-test
2 parents eead3a0 + f4897b2 commit 4bfadb5

File tree

730 files changed

+35595
-17042
lines changed

Some content is hidden

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

730 files changed

+35595
-17042
lines changed

.clang-format

Lines changed: 12 additions & 0 deletions
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

Lines changed: 55 additions & 0 deletions
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@sha256:1e622c5f073b4f6bfad6632f2616c7f59ef256e96fe78bf6a595d1dc4376ac02
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==2.15.1" --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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
FROM otel/cpp_format_tools
5+
6+
ARG USER_UID=1000
7+
ARG USER_GID=1000
8+
ARG INSTALL_PACKAGES=
9+
10+
ARG CXX_STANDARD=17
11+
12+
ENV CXX_STANDARD=${CXX_STANDARD}
13+
14+
COPY ci /opt/ci
15+
16+
RUN apt update && apt install -y wget \
17+
ninja-build \
18+
llvm-dev \
19+
libclang-dev \
20+
clang-tidy \
21+
shellcheck \
22+
sudo \
23+
cmake
24+
25+
RUN cd /opt/ci && bash setup_ci_environment.sh
26+
RUN cd /opt/ci && bash install_iwyu.sh
27+
28+
ADD https://github.com/bazelbuild/bazelisk/releases/download/v1.22.1/bazelisk-linux-amd64 /usr/local/bin
29+
30+
RUN git config --global core.autocrlf input \
31+
&& chmod +x /usr/local/bin/bazelisk-linux-amd64
32+
33+
ENV INSTALL_PACKAGES=${INSTALL_PACKAGES}
34+
ENV USER_NAME=devuser
35+
ENV USER_UID=${USER_UID}
36+
ENV USER_GID=${USER_GID}
37+
ENV IS_CONTAINER_BUILD=true
38+
39+
COPY install /opt/install
40+
COPY ./.devcontainer/customize_container.sh /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
41+
RUN /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
42+
RUN apt install -y npm && npm install -g [email protected]
43+
44+
USER devuser
45+
46+
WORKDIR /workspaces/opentelemetry-cpp
47+
RUN cd /opt && bash ci/install_thirdparty.sh --install-dir /home/devuser/third-party/install-stable --tags-file install/cmake/third_party_stable
48+
ENV CMAKE_PREFIX_PATH=/home/devuser/third-party/install-stable
49+
50+
ENTRYPOINT []
51+
52+
CMD ["/bin/bash"]

.devcontainer/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
* **CXX standard:**
7+
This is the C++ standard to build from (eg: 17, 20, ...). (Default: 17)
8+
* Docker ARG:
9+
`CXX_STANDARD`
10+
* Host Environment Variable:
11+
`OTEL_CPP_DEVCONTAINER_CXX_STANDARD`
12+
13+
* **User ID (UID):**
14+
User ID (Default: `1000`)
15+
* Docker ARG:
16+
`USER_UID`
17+
* Host Environment Variable:
18+
`OTEL_CPP_DEVCONTAINER_USER_UID`
19+
20+
* **Group ID (GID):**
21+
User group ID (Default: `1000`)
22+
* Docker ARG:
23+
`USER_GID`
24+
* Host Environment Variable:
25+
`OTEL_CPP_DEVCONTAINER_USER_GID`
26+
27+
* **Install Packages:**
28+
These are the additional packages that will be installed via `apt install` in the devcontainer. This is a space separated list.
29+
* Docker ARG:
30+
`INSTALL_PACKAGES` (Default: ``)
31+
* Host Environment Variable:
32+
`OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES` (Default: ``)
33+
34+
## Examples
35+
36+
* `docker build --build-arg CXX_STANDARD="20" --build-arg INSTALL_PACKAGES="nano gitk"...`
37+
* `export OTEL_CPP_DEVCONTAINER_CXX_STANDARD=20`
38+
* `export OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES="nano gitk"`
Lines changed: 39 additions & 0 deletions
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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
4+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.162.0/containers/javascript-node
5+
{
6+
"name": "opentelemetry-cpp",
7+
"build": {
8+
"context": "..",
9+
"dockerfile": "Dockerfile.dev",
10+
"args": {
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+
"CXX_STANDARD": "${localEnv:OTEL_CPP_DEVCONTAINER_CXX_STANDARD:17}"
15+
}
16+
},
17+
"customizations": {
18+
"vscode": {
19+
"extensions": [
20+
"ms-vscode.cpptools",
21+
"ms-azuretools.vscode-docker",
22+
"ms-vscode.cpptools-extension-pack"
23+
],
24+
"settings": {
25+
"terminal.integrated.shell.linux": "/bin/bash",
26+
}
27+
}
28+
},
29+
30+
"remoteUser": "devuser"
31+
}

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ updates:
66
interval: "daily"
77
labels:
88
- "GHA"
9+
10+
- package-ecosystem: "devcontainers"
11+
directory: "/"
12+
schedule:
13+
interval: daily

.github/workflows/benchmark.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ on:
55
- main
66

77
permissions:
8-
contents: write
9-
deployments: write
8+
contents: read
109

1110
jobs:
1211
benchmark:
1312
name: Run OpenTelemetry-cpp benchmarks
1413
runs-on: ubuntu-latest
1514
steps:
16-
- uses: actions/checkout@v4
15+
- name: Harden the runner (Audit all outbound calls)
16+
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
17+
with:
18+
egress-policy: audit
19+
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1721
with:
1822
submodules: 'recursive'
1923
- name: Mount Bazel Cache
20-
uses: actions/cache@v4
24+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
2125
env:
2226
cache-name: bazel_cache
2327
with:
@@ -35,20 +39,28 @@ jobs:
3539
mv api-benchmark_result.json benchmarks
3640
mv sdk-benchmark_result.json benchmarks
3741
mv exporters-benchmark_result.json benchmarks
38-
- uses: actions/upload-artifact@v4
42+
- uses: actions/upload-artifact@6027e3dd177782cd8ab9af838c04fd81a07f1d47 # main March 2025
3943
with:
4044
name: benchmark_results
4145
path: benchmarks
4246
store_benchmark:
4347
needs: benchmark
48+
permissions:
49+
contents: write
50+
deployments: write
4451
strategy:
4552
matrix:
4653
components: ["api", "sdk", "exporters"]
4754
name: Store benchmark result
4855
runs-on: ubuntu-latest
4956
steps:
50-
- uses: actions/checkout@v4
51-
- uses: actions/download-artifact@master
57+
- name: Harden the runner (Audit all outbound calls)
58+
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
59+
with:
60+
egress-policy: audit
61+
62+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # main March 2025
5264
with:
5365
name: benchmark_results
5466
path: benchmarks
@@ -57,7 +69,7 @@ jobs:
5769
run: |
5870
cat benchmarks/*
5971
- name: Push benchmark result
60-
uses: benchmark-action/github-action-benchmark@v1
72+
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
6173
with:
6274
name: OpenTelemetry-cpp ${{ matrix.components }} Benchmark
6375
tool: 'googlecpp'

0 commit comments

Comments
 (0)